[PATCH 3/4] KVM: TDX: Don't zero non-significant CPUID entry indices

From: Sean Christopherson

Date: Thu Oct 15 2026 - 21:42:36 EST


Now that KVM sets KVM_CPUID_FLAG_SIGNIFCANT_INDEX when filling CPUID
entries based on output from the TDX Module, don't zero the index for
entries without a signficant index, as doing so incorrectly suggests that
zero is somehow special, which it is not. The critical piece of info is
the SIGNIFCANT_INDEX flag, which tells KVM (and userspace) to simply ignore
the index.

Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
arch/x86/kvm/vmx/tdx.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
index bcfecd2b1f31..75a86d64892a 100644
--- a/arch/x86/kvm/vmx/tdx.c
+++ b/arch/x86/kvm/vmx/tdx.c
@@ -176,9 +176,6 @@ static void td_init_cpuid_entry2(struct kvm_cpuid_entry2 *entry, unsigned char i
WARN_ON_ONCE(cpuid_function_is_indexed(entry->function) !=
(entry->index != KVM_TDX_CPUID_NO_SUBLEAF));

- if (entry->index == KVM_TDX_CPUID_NO_SUBLEAF)
- entry->index = 0;
-
/*
* The TDX module doesn't allow configuring the guest phys addr bits
* (EAX[23:16]). However, KVM uses it as an interface to the userspace
--
2.56.0.176.g3575e65682-goog


--eT79xhp2T0neg3Wb
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename=0004-KVM-TDX-Reject-KVM_TDX_INIT_VM-if-indexed-CPUID-func.patch