* [PATCH] x86/fpu: Remove unnecessary checks for X86_FEATURE_FPU
@ 2026-08-31 18:57 Eric Biggers
2026-08-31 19:59 ` H. Peter Anvin
0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2026-08-31 18:57 UTC (permalink / raw)
To: x86, Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen
Cc: linux-kernel, H . Peter Anvin, Arnd Bergmann, Eric Biggers
Since commit ab05214025ee ("x86/fpu: Remove MATH_EMULATION and related
glue code"), X86_FEATURE_FPU is mandatory. If it's absent, the kernel
halts execution in fpu__init_system_early_generic(). Remove unnecessary
checks for X86_FEATURE_FPU that occur later in core x86 code.
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
arch/x86/kernel/fpu/bugs.c | 4 ----
arch/x86/kernel/fpu/core.c | 2 +-
arch/x86/kernel/fpu/init.c | 2 --
arch/x86/kernel/fpu/xstate.c | 5 -----
4 files changed, 1 insertion(+), 12 deletions(-)
diff --git a/arch/x86/kernel/fpu/bugs.c b/arch/x86/kernel/fpu/bugs.c
index edbafc5940e3..4b84cd0a9d24 100644
--- a/arch/x86/kernel/fpu/bugs.c
+++ b/arch/x86/kernel/fpu/bugs.c
@@ -29,10 +29,6 @@ void __init fpu__init_check_bugs(void)
{
s32 fdiv_bug;
- /* kernel_fpu_begin/end() relies on patched alternative instructions. */
- if (!boot_cpu_has(X86_FEATURE_FPU))
- return;
-
kernel_fpu_begin();
/*
diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
index d1aeecd57f5e..100bfe7336dd 100644
--- a/arch/x86/kernel/fpu/core.c
+++ b/arch/x86/kernel/fpu/core.c
@@ -491,7 +491,7 @@ void kernel_fpu_begin_mask(unsigned int kfpu_mask)
if (likely(kfpu_mask & KFPU_MXCSR) && boot_cpu_has(X86_FEATURE_XMM))
ldmxcsr(MXCSR_DEFAULT);
- if (unlikely(kfpu_mask & KFPU_387) && boot_cpu_has(X86_FEATURE_FPU))
+ if (unlikely(kfpu_mask & KFPU_387))
asm volatile ("fninit");
}
EXPORT_SYMBOL_GPL(kernel_fpu_begin_mask);
diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c
index 0d33c217b71c..8804ef0295dc 100644
--- a/arch/x86/kernel/fpu/init.c
+++ b/arch/x86/kernel/fpu/init.c
@@ -31,8 +31,6 @@ static void fpu__init_cpu_generic(void)
cr0 = read_cr0();
cr0 &= ~(X86_CR0_TS|X86_CR0_EM); /* clear TS and EM */
- if (!boot_cpu_has(X86_FEATURE_FPU))
- cr0 |= X86_CR0_EM;
write_cr0(cr0);
/* Flush out any pending x87 state: */
diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
index a7b6524a9dea..029a9b896997 100644
--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -810,11 +810,6 @@ void __init fpu__init_system_xstate(unsigned int legacy_size)
int err;
int i;
- if (!boot_cpu_has(X86_FEATURE_FPU)) {
- pr_info("x86/fpu: No FPU detected\n");
- return;
- }
-
if (!boot_cpu_has(X86_FEATURE_XSAVE)) {
pr_info("x86/fpu: x87 FPU will use %s\n",
boot_cpu_has(X86_FEATURE_FXSR) ? "FXSAVE" : "FSAVE");
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
--
2.55.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] x86/fpu: Remove unnecessary checks for X86_FEATURE_FPU
2026-08-31 18:57 [PATCH] x86/fpu: Remove unnecessary checks for X86_FEATURE_FPU Eric Biggers
@ 2026-08-31 19:59 ` H. Peter Anvin
0 siblings, 0 replies; 2+ messages in thread
From: H. Peter Anvin @ 2026-08-31 19:59 UTC (permalink / raw)
To: Eric Biggers, x86, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen
Cc: linux-kernel, Arnd Bergmann
On 2026-08-31 11:57, Eric Biggers wrote:
> Since commit ab05214025ee ("x86/fpu: Remove MATH_EMULATION and related
> glue code"), X86_FEATURE_FPU is mandatory. If it's absent, the kernel
> halts execution in fpu__init_system_early_generic(). Remove unnecessary
> checks for X86_FEATURE_FPU that occur later in core x86 code.
>
> Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Reviewed-by: H. Peter Anvin <hpa@zytor.com>
-hpa
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-31 19:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-31 18:57 [PATCH] x86/fpu: Remove unnecessary checks for X86_FEATURE_FPU Eric Biggers
2026-08-31 19:59 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®