On Mon, Feb 07, 2022 at 03:20:37PM +0000, Mark Brown wrote:
As with SVE rather than impose ambitious toolchain requirements for SME we manually encode the few instructions which we require in order to perform the work the kernel needs to do. The instructions used to save and restore context are provided as assembler macros while those for entering and leaving streaming mode are done in asm volatile blocks since they are expected to be used from C.
We could do the SMSTART and SMSTOP operations with read/modify/write cycles on SVCR but using the aliases provided for individual field accesses should be slightly faster. These instructions are aliases for MSR but since our minimum toolchain requirements are old enough to mean that we can't use the sX_X_cX_cX_X form and they always use xzr rather than taking a value like write_sysreg_s() wants we just use .inst.
Signed-off-by: Mark Brown broonie@kernel.org
arch/arm64/include/asm/fpsimd.h | 25 +++++++++++++ arch/arm64/include/asm/fpsimdmacros.h | 53 +++++++++++++++++++++++++++ 2 files changed, 78 insertions(+)
diff --git a/arch/arm64/include/asm/fpsimd.h b/arch/arm64/include/asm/fpsimd.h index cb24385e3632..c90f7f99a768 100644 --- a/arch/arm64/include/asm/fpsimd.h +++ b/arch/arm64/include/asm/fpsimd.h @@ -249,6 +249,31 @@ static inline void sve_setup(void) { } #endif /* ! CONFIG_ARM64_SVE */ +#ifdef CONFIG_ARM64_SME
+static inline void sme_smstart_sm(void) +{
- asm volatile(".inst 0xd503437f");
+}
+static inline void sme_smstop_sm(void) +{
- asm volatile(".inst 0xd503427f");
+}
+static inline void sme_smstop(void) +{
- asm volatile(".inst 0xd503467f");
+}
I think you can use xzr with __msr_s. It would be more consistent if we had some sysregs defined to be used with __msr_s.