From 7fc804d553adb791449e689c6532332f681672b8 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Sat, 19 Mar 2022 12:46:33 -0700 Subject: [PATCH] Linux 5.16 compat: restore FSR and FSAVE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 3b52ccd introduced a flaw where FSR and FSAVE are not restored when using a Linux 5.16 kernel. These instructions are only used when XSAVE is not supported by the processor meaning only some systems will encounter this issue. Reviewed-by: Tony Hutter Reviewed-by: Attila Fülöp Signed-off-by: Brian Behlendorf Closes #13210 Closes #13236 --- include/os/linux/kernel/linux/simd_x86.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/os/linux/kernel/linux/simd_x86.h b/include/os/linux/kernel/linux/simd_x86.h index 543ef3cb42d2..0fc4168b74e0 100644 --- a/include/os/linux/kernel/linux/simd_x86.h +++ b/include/os/linux/kernel/linux/simd_x86.h @@ -379,9 +379,9 @@ kfpu_end(void) if (static_cpu_has(X86_FEATURE_XSAVE)) { kfpu_do_xrstor("xrstor", state, ~0); } else if (static_cpu_has(X86_FEATURE_FXSR)) { - kfpu_save_fxsr(state); + kfpu_restore_fxsr(state); } else { - kfpu_save_fsave(state); + kfpu_restore_fsave(state); } out: local_irq_enable();