From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, Kiryl Shutsemau <kas@kernel.org>,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-coco@lists.linux.dev, Binbin Wu <binbin.wu@linux.intel.com>,
Changyuan Lyu <changyuanl@google.com>,
Sashiko <sashiko-bot@kernel.org>
Subject: Re: [PATCH v2 2/3] KVM: TDX: Set SIGNIFCANT_INDEX flag as appropriate when filling CPUID entries
Date: Wed, 28 Oct 2026 09:02:56 +0800 [thread overview]
Message-ID: <f81cb4a0-2d36-4743-9c4a-22987c50d237@intel.com> (raw)
In-Reply-To: <auC7VoynSWStxCg3@google.com>
On 10/27/2026 10:55 PM, Sean Christopherson wrote:
> On Tue, Oct 27, 2026, Xiaoyao Li wrote:
>> On 10/27/2026 10:05 PM, Sean Christopherson wrote:
>>> On Tue, Oct 27, 2026, Xiaoyao Li wrote:
>>>> On 10/23/2026 5:01 AM, Sean Christopherson wrote:
>>>>> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
>>>>> index 271c2f94b8dd..37d088f6f7a8 100644
>>>>> --- a/arch/x86/kvm/vmx/tdx.c
>>>>> +++ b/arch/x86/kvm/vmx/tdx.c
>>>>> @@ -2,6 +2,7 @@
>>>>> #include <linux/cleanup.h>
>>>>> #include <linux/cpu.h>
>>>>> #include <asm/cpufeature.h>
>>>>> +#include <asm/cpuid/api.h>
>>>>> #include <asm/fpu/xcr.h>
>>>>> #include <linux/misc_cgroup.h>
>>>>> #include <linux/mmu_context.h>
>>>>> @@ -163,12 +164,23 @@ static void td_init_cpuid_entry2(struct kvm_cpuid_entry2 *entry, unsigned char i
>>>>>
>>>>> entry->function = (u32)td_conf->cpuid_config_leaves[idx];
>>>>> entry->index = td_conf->cpuid_config_leaves[idx] >> 32;
>>>>> + entry->flags = 0;
>>>>> entry->eax = (u32)td_conf->cpuid_config_values[idx][0];
>>>>> entry->ebx = td_conf->cpuid_config_values[idx][0] >> 32;
>>>>> entry->ecx = (u32)td_conf->cpuid_config_values[idx][1];
>>>>> entry->edx = td_conf->cpuid_config_values[idx][1] >> 32;
>>>>>
>>>>> - if (entry->index == KVM_TDX_CPUID_NO_SUBLEAF)
>>>>> + WARN_ON_ONCE(cpuid_function_is_indexed(entry->function) !=
>>>>> + (entry->index != KVM_TDX_CPUID_NO_SUBLEAF));
>>>>
>>>> I think the WARN_ON_ONCE() is very likely to be triggered in the future when
>>>> people run old kernel with new TDX modules.
>>>
>>> Then upstream patches to make that not happen. Intel insists on treating the TDX
>>> Module like hardware. So, treat new TDX Modules like new hardware. Upstream
>>> support for the new "hardware" before it ships, cc'd to stable@vger.kernel.org
>>> if necessary.
>>>
>>> Because IMO, the WARN is doing exactly what it's intended to do: alerting the
>>> admin that they are running a potentially dangerous setup.
>>
>> For this specific case, does it mean every later patch to add a new leaf in
>> cpuid_function_is_indexed() needs to be backported to stable?
>
> If you want to ship a new TDX Module that enumerates features in those leaves and
> works as-is on older kernels, yes. Again, this isn't really any different than
> enabling new hardware. E.g. a kernel from 2024 generally doesn't work flawlessly
> on a CPU being released in 2026.
OK. Fair enough.
next prev parent reply other threads:[~2026-10-28 1:03 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 21:01 [PATCH v2 0/3] x86/cpuid: KVM: TDX CPUID fixes Sean Christopherson
2026-10-22 21:01 ` [PATCH v2 1/3] x86/cpuid: Mark CPUID function 0x23 as being indexed Sean Christopherson
2026-10-23 8:03 ` Xiaoyao Li
2026-10-22 21:01 ` [PATCH v2 2/3] KVM: TDX: Set SIGNIFCANT_INDEX flag as appropriate when filling CPUID entries Sean Christopherson
2026-10-23 2:45 ` Binbin Wu
2026-10-24 2:03 ` Sean Christopherson
2026-10-27 2:10 ` Binbin Wu
2026-10-27 12:01 ` Xiaoyao Li
2026-10-27 14:05 ` Sean Christopherson
2026-10-27 14:12 ` Xiaoyao Li
2026-10-27 14:55 ` Sean Christopherson
2026-10-28 1:02 ` Xiaoyao Li [this message]
2026-10-28 1:04 ` Xiaoyao Li
2026-10-22 21:01 ` [PATCH v2 3/3] KVM: TDX: Reject KVM_TDX_INIT_VM if indexed CPUID functions don't match Sean Christopherson
2026-10-23 3:05 ` Binbin Wu
2026-10-23 8:11 ` Xiaoyao Li
2026-10-28 1:07 ` Xiaoyao Li
2026-10-23 1:25 ` [PATCH v2 0/3] x86/cpuid: KVM: TDX CPUID fixes Edgecombe, Rick P
2026-10-23 2:01 ` Edgecombe, Rick P
2026-10-27 10:07 ` Binbin Wu
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=f81cb4a0-2d36-4743-9c4a-22987c50d237@intel.com \
--to=xiaoyao.li@intel.com \
--cc=binbin.wu@linux.intel.com \
--cc=bp@alien8.de \
--cc=changyuanl@google.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kas@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rick.p.edgecombe@intel.com \
--cc=sashiko-bot@kernel.org \
--cc=seanjc@google.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