* [PATCH v2] arm64/sme: Fix EFI save/restore
@ 2022-06-02 12:41 Mark Brown
2022-06-10 15:25 ` Catalin Marinas
2022-06-10 16:35 ` Catalin Marinas
0 siblings, 2 replies; 4+ messages in thread
From: Mark Brown @ 2022-06-02 12:41 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon
Cc: linux-arm-kernel, Mark Brown, kernel test robot
The EFI save/restore code is confused. When saving the check for saving
FFR is inverted due to confusion with the streaming mode check, and when
restoring we check if we need to restore FFR by checking the percpu
efi_sm_state without the required wrapper rather than based on the
combination of FA64 support and streaming mode.
Fixes: e0838f6373e5 ("arm64/sme: Save and restore streaming mode over EFI runtime calls")
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
Still not tested, that won't happen till next week.
v2:
- Add comments saying when we need to save/restore FFR.
arch/arm64/kernel/fpsimd.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index 819979398127..b93985a33bed 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -1916,10 +1916,15 @@ 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);
+ /*
+ * Unless we have FA64 FFR does not
+ * exist in streaming mode.
+ */
+ if (!system_supports_fa64())
+ ffr = !(svcr & SVCR_SM_MASK);
}
sve_save_state(sve_state + sve_ffr_offset(sve_max_vl()),
@@ -1964,8 +1969,13 @@ void __efi_fpsimd_end(void)
sysreg_clear_set_s(SYS_SVCR,
0,
SVCR_SM_MASK);
+
+ /*
+ * Unless we have FA64 FFR does not
+ * exist in streaming mode.
+ */
if (!system_supports_fa64())
- ffr = efi_sm_state;
+ ffr = false;
}
}
--
2.30.2
_______________________________________________
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] 4+ messages in thread
* Re: [PATCH v2] arm64/sme: Fix EFI save/restore
2022-06-02 12:41 [PATCH v2] arm64/sme: Fix EFI save/restore Mark Brown
@ 2022-06-10 15:25 ` Catalin Marinas
2022-06-10 15:52 ` Mark Brown
2022-06-10 16:35 ` Catalin Marinas
1 sibling, 1 reply; 4+ messages in thread
From: Catalin Marinas @ 2022-06-10 15:25 UTC (permalink / raw)
To: Mark Brown; +Cc: Will Deacon, linux-arm-kernel, kernel test robot
On Thu, Jun 02, 2022 at 02:41:32PM +0200, Mark Brown wrote:
> The EFI save/restore code is confused. When saving the check for saving
> FFR is inverted due to confusion with the streaming mode check, and when
> restoring we check if we need to restore FFR by checking the percpu
> efi_sm_state without the required wrapper rather than based on the
> combination of FA64 support and streaming mode.
>
> Fixes: e0838f6373e5 ("arm64/sme: Save and restore streaming mode over EFI runtime calls")
> Reported-by: kernel test robot <lkp@intel.com>
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>
> Still not tested, that won't happen till next week.
Did you get a chance to test this patch?
--
Catalin
_______________________________________________
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] 4+ messages in thread
* Re: [PATCH v2] arm64/sme: Fix EFI save/restore
2022-06-10 15:25 ` Catalin Marinas
@ 2022-06-10 15:52 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2022-06-10 15:52 UTC (permalink / raw)
To: Catalin Marinas; +Cc: Will Deacon, linux-arm-kernel, kernel test robot
[-- Attachment #1.1: Type: text/plain, Size: 410 bytes --]
On Fri, Jun 10, 2022 at 04:25:19PM +0100, Catalin Marinas wrote:
> On Thu, Jun 02, 2022 at 02:41:32PM +0200, Mark Brown wrote:
> > The EFI save/restore code is confused. When saving the check for saving
> > FFR is inverted due to confusion with the streaming mode check, and when
> > Still not tested, that won't happen till next week.
> Did you get a chance to test this patch?
I'm fairly sure it's fine.
[-- 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] 4+ messages in thread
* Re: [PATCH v2] arm64/sme: Fix EFI save/restore
2022-06-02 12:41 [PATCH v2] arm64/sme: Fix EFI save/restore Mark Brown
2022-06-10 15:25 ` Catalin Marinas
@ 2022-06-10 16:35 ` Catalin Marinas
1 sibling, 0 replies; 4+ messages in thread
From: Catalin Marinas @ 2022-06-10 16:35 UTC (permalink / raw)
To: Will Deacon, Mark Brown; +Cc: kernel test robot, linux-arm-kernel
On Thu, 2 Jun 2022 14:41:32 +0200, Mark Brown wrote:
> The EFI save/restore code is confused. When saving the check for saving
> FFR is inverted due to confusion with the streaming mode check, and when
> restoring we check if we need to restore FFR by checking the percpu
> efi_sm_state without the required wrapper rather than based on the
> combination of FA64 support and streaming mode.
>
>
> [...]
Applied to arm64 (for-next/fixes), thanks!
[1/1] arm64/sme: Fix EFI save/restore
https://git.kernel.org/arm64/c/2e990e63220b
--
Catalin
_______________________________________________
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] 4+ messages in thread
end of thread, other threads:[~2022-06-10 16:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-02 12:41 [PATCH v2] arm64/sme: Fix EFI save/restore Mark Brown
2022-06-10 15:25 ` Catalin Marinas
2022-06-10 15:52 ` Mark Brown
2022-06-10 16:35 ` Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).