[PATCH v3 2/4] KVM: TDX: Report CORE_CAPABILITIES as configurable
From: Binbin Wu
Date: Wed Aug 26 2026 - 23:16:00 EST
Add CORE_CAPABILITIES (CPUID.0x7.0.EDX[30]) to KVM's allowlist of TDX
directly configurable CPUID feature bits, even though KVM doesn't support
MSR_IA32_CORE_CAPS for TDX guests, to accommodate legacy TDX module
behavior.
Older TDX specs define the CORE_CAPABILITIES CPUID bit as fixed-1, so
userspace may expect the bit to be enabled for TDs. If the bit becomes
directly configurable in a newer TDX module but is not reported as such to
userspace, userspace can no longer enable it once KVM starts validating
the CPUID configuration input.
Reporting CORE_CAPABILITIES as configurable keeps userspace able to enable
the bit across the fixed-1 => configurable transition, and lets userspace
infer that the bit is no longer fixed-1 so it can adjust its expectations.
Keep MSR_IA32_CORE_CAPS unsupported for TDX guests, as existing TDX users
have not needed guest access to the MSR, and advertising the CPUID bit as
configurable is enough for userspace to handle the legacy-module
compatibility case.
Signed-off-by: Binbin Wu <binbin.wu@xxxxxxxxxxxxxxx>
---
v3:
- Move this patch earlier in the series to avoid breaking userspace during
bisection. (Xiaoyao)
- Drop the code for MSR_IA32_CORE_CAPS access.
---
arch/x86/kvm/vmx/tdx.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
index d4a3a42cfd9d..b020518717ac 100644
--- a/arch/x86/kvm/vmx/tdx.c
+++ b/arch/x86/kvm/vmx/tdx.c
@@ -147,6 +147,12 @@ static void __init tdx_initialize_cpu_cfg_caps(void)
TDX_CFG_F(AVX512_VP2INTERSECT),
TDX_CFG_F(SERIALIZE),
TDX_CFG_F(TSXLDTRK),
+ /*
+ * KVM does not support MSR_IA32_CORE_CAPS, but older TDX specs
+ * define this bit as fixed-1. Report it as configurable so
+ * userspace can know the feature is no longer a fixed-1 bit.
+ */
+ TDX_CFG_EXTRA_F(CORE_CAPABILITIES),
);
tdx_cpu_cfg_cap_init(CPUID_7_1_EAX,
--
2.46.0