From: Dave Martin <Dave.Martin@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: gdb@sourceware.org, "Alex Bennée" <alex.bennee@linaro.org>,
"Will Deacon" <will.deacon@arm.com>,
"Julien Grall" <julien.grall@arm.com>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Zhang Lei" <zhang.lei@jp.fujitsu.com>,
"Alan Hayward" <alan.hayward@arm.com>
Subject: [PATCH v2 2/3] arm64/sve: Factor out FPSIMD to SVE state conversion
Date: Wed, 12 Jun 2019 16:01:00 -0000 [thread overview]
Message-ID: <1560355234-25516-3-git-send-email-Dave.Martin@arm.com> (raw)
In-Reply-To: <1560355234-25516-1-git-send-email-Dave.Martin@arm.com>
Currently we convert from FPSIMD to SVE register state in memory in
two places.
To ease future maintenance, let's consolidate this in one place.
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
---
arch/arm64/kernel/fpsimd.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index bb42cd0..d2f7544 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -370,6 +370,18 @@ static __uint128_t arm64_cpu_to_le128(__uint128_t x)
#define arm64_le128_to_cpu(x) arm64_cpu_to_le128(x)
+static void __fpsimd_to_sve(void *sst, struct user_fpsimd_state const *fst,
+ unsigned int vq)
+{
+ unsigned int i;
+ __uint128_t *p;
+
+ for (i = 0; i < 32; ++i) {
+ p = (__uint128_t *)ZREG(sst, vq, i);
+ *p = arm64_cpu_to_le128(fst->vregs[i]);
+ }
+}
+
/*
* Transfer the FPSIMD state in task->thread.uw.fpsimd_state to
* task->thread.sve_state.
@@ -386,17 +398,12 @@ static void fpsimd_to_sve(struct task_struct *task)
unsigned int vq;
void *sst = task->thread.sve_state;
struct user_fpsimd_state const *fst = &task->thread.uw.fpsimd_state;
- unsigned int i;
- __uint128_t *p;
if (!system_supports_sve())
return;
vq = sve_vq_from_vl(task->thread.sve_vl);
- for (i = 0; i < 32; ++i) {
- p = (__uint128_t *)ZREG(sst, vq, i);
- *p = arm64_cpu_to_le128(fst->vregs[i]);
- }
+ __fpsimd_to_sve(sst, fst, vq);
}
/*
@@ -512,8 +519,6 @@ void sve_sync_from_fpsimd_zeropad(struct task_struct *task)
unsigned int vq;
void *sst = task->thread.sve_state;
struct user_fpsimd_state const *fst = &task->thread.uw.fpsimd_state;
- unsigned int i;
- __uint128_t *p;
if (!test_tsk_thread_flag(task, TIF_SVE))
return;
@@ -521,11 +526,7 @@ void sve_sync_from_fpsimd_zeropad(struct task_struct *task)
vq = sve_vq_from_vl(task->thread.sve_vl);
memset(sst, 0, SVE_SIG_REGS_SIZE(vq));
-
- for (i = 0; i < 32; ++i) {
- p = (__uint128_t *)ZREG(sst, vq, i);
- *p = arm64_cpu_to_le128(fst->vregs[i]);
- }
+ __fpsimd_to_sve(sst, fst, vq);
}
int sve_set_vector_length(struct task_struct *task,
--
2.1.4
next prev parent reply other threads:[~2019-06-12 16:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-12 16:00 [PATCH v2 0/3] arm64/sve: Fix mutating register endianness on big-endian Dave Martin
2019-06-12 16:01 ` [PATCH v2 1/3] arm64/sve: Fix missing SVE/FPSIMD endianness conversions Dave Martin
2019-06-12 17:29 ` Will Deacon
2019-06-12 17:46 ` Julien Grall
2019-06-13 10:00 ` Dave Martin
2019-06-13 10:17 ` Will Deacon
2019-06-13 10:20 ` Dave Martin
2019-06-12 16:01 ` Dave Martin [this message]
2019-06-20 13:45 ` [PATCH v2 2/3] arm64/sve: Factor out FPSIMD to SVE state conversion Julien Grall
2019-07-22 10:31 ` Catalin Marinas
2019-06-12 16:01 ` [PATCH v2 3/3] arm64/sve: Fix a couple of magic numbers for the Z-reg count Dave Martin
2019-06-20 13:43 ` Julien Grall
2019-07-22 10:32 ` Catalin Marinas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1560355234-25516-3-git-send-email-Dave.Martin@arm.com \
--to=dave.martin@arm.com \
--cc=alan.hayward@arm.com \
--cc=alex.bennee@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=gdb@sourceware.org \
--cc=julien.grall@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=peter.maydell@linaro.org \
--cc=will.deacon@arm.com \
--cc=zhang.lei@jp.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox