From 9e3619c5355268948cefba4d8fbcd1aea3616236 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Sat, 19 Mar 2022 12:48:28 -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 3b52ccd7d 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 6d4c7a09fe..0f6a222ba6 100644 --- a/include/os/linux/kernel/linux/simd_x86.h +++ b/include/os/linux/kernel/linux/simd_x86.h @@ -420,9 +420,9 @@ kfpu_end(void) if (static_cpu_has(X86_FEATURE_XSAVE)) { kfpu_do_xrstor("xrstor", &state->xsave, ~0); } else if (static_cpu_has(X86_FEATURE_FXSR)) { - kfpu_save_fxsr(&state->fxsave); + kfpu_restore_fxsr(&state->fxsave); } else { - kfpu_save_fsave(&state->fsave); + kfpu_restore_fsave(&state->fsave); } out: local_irq_enable();