[PATCH] arm64/sme: Fix EFI save/restore

Catalin Marinas catalin.marinas at arm.com
Thu Jun 2 05:17:38 PDT 2022


On Thu, Jun 02, 2022 at 11:45:44AM +0200, Mark Brown wrote:
> diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
> index 819979398127..3c66a061ff6f 100644
> --- a/arch/arm64/kernel/fpsimd.c
> +++ b/arch/arm64/kernel/fpsimd.c
> @@ -1916,10 +1916,11 @@ void __efi_fpsimd_begin(void)
>  			if (system_supports_sme()) {
>  				svcr = read_sysreg_s(SYS_SVCR);
>  
> -				if (!system_supports_fa64())
> -					ffr = svcr & SVCR_SM_MASK;
> +				__this_cpu_write(efi_sm_state,
> +						 svcr & SVCR_SM_MASK);
>  
> -				__this_cpu_write(efi_sm_state, ffr);
> +				if (!system_supports_fa64())
> +					ffr = !(svcr & SVCR_SM_MASK);
>  			}
>  
>  			sve_save_state(sve_state + sve_ffr_offset(sve_max_vl()),
> @@ -1965,7 +1966,7 @@ void __efi_fpsimd_end(void)
>  							   0,
>  							   SVCR_SM_MASK);
>  					if (!system_supports_fa64())
> -						ffr = efi_sm_state;
> +						ffr = false;
>  				}
>  			}

This looks fine to me:

Reviewed-by: Catalin Marinas <catalin.marinas at arm.com>

Please add some comments to the code for when we need to save/restore
the FFR state and let me know when you got a chance to test it so that I
can send it upstream.

Thanks.

-- 
Catalin



More information about the linux-arm-kernel mailing list