From: Julien Grall <julien.grall@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Anton.Kirilov@arm.com, catalin.marinas@arm.com,
will.deacon@arm.com, oleg@redhat.com, zhang.lei@jp.fujitsu.com,
Julien Grall <julien.grall@arm.com>,
alex.bennee@linaro.org, Dave.Martin@arm.com, Daniel.Kiss@arm.com
Subject: [RFC PATCH v2 6/8] arm64/sve: Implement an helper to load SVE registers from FPSIMD state
Date: Thu, 13 Jun 2019 17:16:54 +0100 [thread overview]
Message-ID: <20190613161656.20765-7-julien.grall@arm.com> (raw)
In-Reply-To: <20190613161656.20765-1-julien.grall@arm.com>
In a follow-up patch, we may save the FPSIMD rather than the full SVE
state when the state has to be zeroed on return to userspace (e.g
during a syscall).
Introduce an helper to load SVE vectors from FPSIMD state and zero the rest
of SVE registers.
Signed-off-by: Julien Grall <julien.grall@arm.com>
---
arch/arm64/include/asm/fpsimd.h | 3 +++
arch/arm64/kernel/entry-fpsimd.S | 17 +++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/arch/arm64/include/asm/fpsimd.h b/arch/arm64/include/asm/fpsimd.h
index fda3544c9606..f07a88552588 100644
--- a/arch/arm64/include/asm/fpsimd.h
+++ b/arch/arm64/include/asm/fpsimd.h
@@ -86,6 +86,9 @@ extern void sve_load_state(void const *state, u32 const *pfpsr,
extern void sve_flush_live(void);
+extern void sve_load_from_fpsimd_state(struct user_fpsimd_state const *state,
+ unsigned long vq_minus_1);
+
extern unsigned int sve_get_vl(void);
struct arm64_cpu_capabilities;
diff --git a/arch/arm64/kernel/entry-fpsimd.S b/arch/arm64/kernel/entry-fpsimd.S
index 17121a51c41f..35c21a707730 100644
--- a/arch/arm64/kernel/entry-fpsimd.S
+++ b/arch/arm64/kernel/entry-fpsimd.S
@@ -58,6 +58,23 @@ ENTRY(sve_get_vl)
ret
ENDPROC(sve_get_vl)
+/*
+ * Load SVE state from FPSIMD state.
+ *
+ * x0 = pointer to struct fpsimd_state
+ * x1 = VQ - 1
+ *
+ * Each SVE vector will be loaded with the first 128-bits taken from FPSIMD
+ * and the rest zeroed. All the other SVE registers will be zeroed.
+ */
+ENTRY(sve_load_from_fpsimd_state)
+ sve_load_vq x1, x2, x3
+ fpsimd_restore x0, 8
+ _for n, 0, 15, _sve_pfalse \n
+ _sve_wrffr 0
+ ret
+ENDPROC(sve_load_from_fpsimd_state)
+
/* Zero all SVE registers but the first 128-bits of each vector */
ENTRY(sve_flush_live)
sve_flush
--
2.11.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-06-13 16:19 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-13 16:16 [RFC PATCH v2 0/8] arm64/sve: First steps towards optimizing syscalls Julien Grall
2019-06-13 16:16 ` [RFC PATCH v2 1/8] arm64/fpsimd: Update documentation of do_sve_acc Julien Grall
2019-06-13 16:19 ` Julien Grall
2019-06-21 15:32 ` Dave Martin
2019-06-13 16:16 ` [RFC PATCH v2 2/8] arm64/signal: Update the comment in preserve_sve_context Julien Grall
2019-06-21 15:32 ` Dave Martin
2019-06-13 16:16 ` [RFC PATCH v2 3/8] arm64/fpsimdmacros: Allow the macro "for" to be used in more cases Julien Grall
2019-06-21 15:32 ` Dave Martin
2019-06-24 16:10 ` Julien Grall
2019-06-25 9:35 ` Dave Martin
2019-06-13 16:16 ` [RFC PATCH v2 4/8] arm64/fpsimdmacros: Introduce a macro to update ZCR_EL1.LEN Julien Grall
2019-06-21 15:32 ` Dave Martin
2019-06-13 16:16 ` [RFC PATCH v2 5/8] arm64/sve: Implement an helper to flush SVE registers Julien Grall
2019-06-21 15:33 ` Dave Martin
2019-06-24 16:28 ` Julien Grall
2019-06-25 9:37 ` Dave Martin
2019-06-13 16:16 ` Julien Grall [this message]
2019-06-21 15:33 ` [RFC PATCH v2 6/8] arm64/sve: Implement an helper to load SVE registers from FPSIMD state Dave Martin
2019-06-24 16:29 ` Julien Grall
2019-06-13 16:16 ` [RFC PATCH v2 7/8] arm64/sve: Don't disable SVE on syscalls return Julien Grall
2019-06-21 15:33 ` Dave Martin
2019-06-24 16:44 ` Julien Grall
2019-06-25 9:41 ` Dave Martin
2019-07-04 14:15 ` Catalin Marinas
2019-08-02 11:06 ` Julien Grall
2019-06-13 16:16 ` [RFC PATCH v2 8/8] arm64/sve: Rework SVE trap access to use TIF_SVE_NEEDS_FLUSH Julien Grall
2019-06-21 15:33 ` Dave Martin
2019-06-21 15:32 ` [RFC PATCH v2 0/8] arm64/sve: First steps towards optimizing syscalls Dave Martin
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=20190613161656.20765-7-julien.grall@arm.com \
--to=julien.grall@arm.com \
--cc=Anton.Kirilov@arm.com \
--cc=Daniel.Kiss@arm.com \
--cc=Dave.Martin@arm.com \
--cc=alex.bennee@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=oleg@redhat.com \
--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