From 6efc1343412e290c8dacfbcf657528b6167ad070 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 18 Mar 2022 13:33:10 -0700 Subject: [PATCH] Linux 5.16 compat: restore FSR and FSAVE 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. Signed-off-by: Brian Behlendorf Issue #13210 --- 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();