From: Eric Biggers <ebiggers@kernel.org>
To: x86@kernel.org, Thomas Gleixner <tglx@kernel.org>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Dapeng Mi <dapeng1.mi@linux.intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Jiaming Zhang <r772577952@gmail.com>,
Eric Biggers <ebiggers@kernel.org>
Subject: [PATCH 2/4] x86/fpu: Check for missing APX xstate component
Date: Sat, 5 Dec 2026 21:12:23 -0800 [thread overview]
Message-ID: <20261206051225.298193-3-ebiggers@kernel.org> (raw)
In-Reply-To: <20261206051225.298193-1-ebiggers@kernel.org>
If the CPU enumerates APX support, verify that the corresponding xstate
component is also enumerated. If not, warn and clear X86_FEATURE_APX.
This allows kernel code to assume that X86_FEATURE_APX implies
XFEATURE_MASK_APX.
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
arch/x86/kernel/fpu/xstate.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
index 346aa126e1730..12759e17f3410 100644
--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -868,6 +868,13 @@ void __init fpu__init_system_xstate(unsigned int legacy_size)
setup_clear_cpu_cap(X86_FEATURE_SHSTK);
}
+ if (boot_cpu_has(X86_FEATURE_APX) &&
+ !(fpu_kernel_cfg.max_features & XFEATURE_MASK_APX)) {
+ pr_err(FW_BUG
+ "x86/fpu: Disabling APX support due to missing xstate feature\n");
+ setup_clear_cpu_cap(X86_FEATURE_APX);
+ }
+
if (fpu_kernel_cfg.max_features & XFEATURE_MASK_APX &&
fpu_kernel_cfg.max_features & (XFEATURE_MASK_BNDREGS | XFEATURE_MASK_BNDCSR)) {
/*
--
2.56.1
next prev parent reply other threads:[~2026-12-06 5:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-06 5:12 [PATCH 0/4] x86/fpu: Complete the removal of cpu_has_xfeatures() Eric Biggers
2026-12-06 5:12 ` [PATCH 1/4] x86/fpu: Check for missing CET_USER xstate component Eric Biggers
2026-12-06 5:12 ` Eric Biggers [this message]
2026-12-06 5:12 ` [PATCH 3/4] perf/x86/intel: Remove redundant cpu_has_xfeatures() checks Eric Biggers
2026-12-06 5:12 ` [PATCH 4/4] x86/fpu: Remove cpu_has_xfeatures() Eric Biggers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261206051225.298193-3-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=bp@alien8.de \
--cc=dapeng1.mi@linux.intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hch@lst.de \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=r772577952@gmail.com \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox