summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/fpu/api.h
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2021-03-08 11:34:12 +0200
committerTony Lindgren <tony@atomide.com>2021-03-08 11:34:12 +0200
commit4c9f4865f4604744d4f1a43db22ac6ec9dc8e587 (patch)
tree46abf93c9b90b880464772ce7d23309ee3616b91 /arch/x86/include/asm/fpu/api.h
parenteffe89e40037038db7711bdab5d3401fe297d72c (diff)
parent77335a040178a0456d4eabc8bf17a7ca3ee4a327 (diff)
Merge branch 'fixes-rc2' into fixes
Diffstat (limited to 'arch/x86/include/asm/fpu/api.h')
-rw-r--r--arch/x86/include/asm/fpu/api.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/include/asm/fpu/api.h b/arch/x86/include/asm/fpu/api.h
index 67a4f1cb2aac..ed33a14188f6 100644
--- a/arch/x86/include/asm/fpu/api.h
+++ b/arch/x86/include/asm/fpu/api.h
@@ -32,7 +32,19 @@ extern void fpregs_mark_activate(void);
/* Code that is unaware of kernel_fpu_begin_mask() can use this */
static inline void kernel_fpu_begin(void)
{
+#ifdef CONFIG_X86_64
+ /*
+ * Any 64-bit code that uses 387 instructions must explicitly request
+ * KFPU_387.
+ */
+ kernel_fpu_begin_mask(KFPU_MXCSR);
+#else
+ /*
+ * 32-bit kernel code may use 387 operations as well as SSE2, etc,
+ * as long as it checks that the CPU has the required capability.
+ */
kernel_fpu_begin_mask(KFPU_387 | KFPU_MXCSR);
+#endif
}
/*