[PATCH 2/2] arm64/sme: Restore SMCR_EL1.EZT0 on exit from suspend

Dave Martin Dave.Martin at arm.com
Tue Jan 30 02:54:06 PST 2024


On Tue, Jan 30, 2024 at 12:02:49AM +0000, Mark Brown wrote:
> The fields in SMCR_EL1 reset to an architecturally UNKNOWN value. Since we
> do not otherwise manage the traps configured in this register at runtime we
> need to reconfigure them after a suspend in case nothing else was kind
> enough to preserve them for us. Do so for SMCR_EL1.EZT0.
> 
> Fixes: d4913eee152d (arm64/sme: Add basic enumeration for SME2)
> Reported-by: Jackson Cooper-Driver <Jackson.Cooper-Driver at arm.com>
> Signed-off-by: Mark Brown <broonie at kernel.org>
> ---
>  arch/arm64/kernel/fpsimd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
> index 69201208bb13..329782fe39c5 100644
> --- a/arch/arm64/kernel/fpsimd.c
> +++ b/arch/arm64/kernel/fpsimd.c
> @@ -1320,6 +1320,8 @@ void sme_suspend_exit(void)
>  
>  	if (system_supports_fa64())
>  		smcr |= SMCR_ELx_FA64;

Ditto comments on patch 1.

Unrelated to this patch, it is worth having a prctl for this?  The
architecture seems to discourage software written for the SME ISA to
implicitly rely on FA64, so it would useful to be able to run with it
disabled even on hardware that supports it.

> +	if (system_supports_sme2())
> +		smcr |= SMCR_ELx_EZT0;

Side question: since ZT0 is likely to be sporadically used, maybe it
is worth having separate lazy restore for it versus the main SME state?
(Not relevant for this series though, and probably best deferred until
there is hardware to benchmark on.  Also, ZT0 is small compared with
the SME state proper...)

[...]

Cheers
---Dave



More information about the linux-arm-kernel mailing list