All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64/sme: Fix the ffr variable assignment
@ 2022-06-01 17:13 Catalin Marinas
  2022-06-02  8:26 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Catalin Marinas @ 2022-06-01 17:13 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Will Deacon, kernel test robot, Mark Brown

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(-)

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()),

base-commit: 0616ea3f1b93a99264d84f3d002ae117f6526b62

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] arm64/sme: Fix the ffr variable assignment
  2022-06-01 17:13 [PATCH] arm64/sme: Fix the ffr variable assignment Catalin Marinas
@ 2022-06-02  8:26 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2022-06-02  8:26 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: linux-arm-kernel, Will Deacon, kernel test robot


[-- Attachment #1.1: Type: text/plain, Size: 833 bytes --]

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.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-02  8:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-01 17:13 [PATCH] arm64/sme: Fix the ffr variable assignment Catalin Marinas
2022-06-02  8:26 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.