diff mbox series

arm64/sme: Fix the ffr variable assignment

Message ID 20220601171346.2143699-1-catalin.marinas@arm.com (mailing list archive)
State New, archived
Headers show
Series arm64/sme: Fix the ffr variable assignment | expand

Commit Message

Catalin Marinas June 1, 2022, 5:13 p.m. UTC
This variable is a bool and expected to be set to true if the FFR
state needs saving/restoring, false otherwise. In __efi_fpsimd_end()
this variable should be restored to the value of efi_sm_state but this
is a per-CPU variable, not to be read directly. Make ffr false if
!__this_cpu_read(efi_sm_state), leave it true otherwise.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Fixes: e0838f6373e5 ("arm64/sme: Save and restore streaming mode over EFI runtime calls")
Reported-by: kernel test robot <lkp@intel.com>
Cc: Mark Brown <broonie@kernel.org>
---
 arch/arm64/kernel/fpsimd.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)


base-commit: 0616ea3f1b93a99264d84f3d002ae117f6526b62

Comments

Mark Brown June 2, 2022, 8:26 a.m. UTC | #1
On Wed, Jun 01, 2022 at 06:13:46PM +0100, Catalin Marinas wrote:
> This variable is a bool and expected to be set to true if the FFR
> state needs saving/restoring, false otherwise. In __efi_fpsimd_end()
> this variable should be restored to the value of efi_sm_state but this
> is a per-CPU variable, not to be read directly. Make ffr false if
> !__this_cpu_read(efi_sm_state), leave it true otherwise.

> -				if (__this_cpu_read(efi_sm_state)) {
> +				if (__this_cpu_read(efi_sm_state))
>  					sysreg_clear_set_s(SYS_SVCR,
>  							   0,
>  							   SVCR_SM_MASK);
> -					if (!system_supports_fa64())
> -						ffr = efi_sm_state;
> -				}
> +				else
> +					ffr = false;

In the case where we support FA64 we need to load FFR so this
needs to be conditional on system_supports_fa64() in the case
where efi_sm_state is true.
diff mbox series

Patch

diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index 819979398127..8bc9080adab2 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -1960,13 +1960,12 @@  void __efi_fpsimd_end(void)
 			 * streaming mode.
 			 */
 			if (system_supports_sme()) {
-				if (__this_cpu_read(efi_sm_state)) {
+				if (__this_cpu_read(efi_sm_state))
 					sysreg_clear_set_s(SYS_SVCR,
 							   0,
 							   SVCR_SM_MASK);
-					if (!system_supports_fa64())
-						ffr = efi_sm_state;
-				}
+				else
+					ffr = false;
 			}
 
 			sve_load_state(sve_state + sve_ffr_offset(sve_max_vl()),