From: Sean Christopherson <seanjc@google.com>
To: Binbin Wu <binbin.wu@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
pbonzini@redhat.com, dave.hansen@linux.intel.com,
andrew.cooper3@citrix.com, nik.borisov@suse.com, kas@kernel.org,
rick.p.edgecombe@intel.com, xiaoyao.li@intel.com,
chao.gao@intel.com, tony.lindgren@linux.intel.com,
kishen.maloor@intel.com, dedekind1@gmail.com,
adrian.hunter@intel.com
Subject: Re: [PATCH v5 1/5] KVM: TDX: Check unsupported CPUID bits against the TDX module's subleaf
Date: Fri, 16 Oct 2026 16:26:28 -0700 [thread overview]
Message-ID: <atKypOb2h87evCY5@google.com> (raw)
In-Reply-To: <e1553e03-7ca8-4507-b608-d9d663759c1f@linux.intel.com>
On Sat, Oct 17, 2026, Binbin Wu wrote:
> On 10/16/2026 11:25 PM, Sean Christopherson wrote:
> > On Fri, Oct 16, 2026, Binbin Wu wrote:
> > @@ -2386,7 +2390,7 @@ static int setup_tdparams_cpuids(struct kvm_cpuid2 *cpuid,
> > if (!entry)
> > continue;
> >
> > - if (tdx_unsupported_cpuid(entry))
> > + if (tdx_is_unsupported_cpuid_entry(entry))
> > return -EINVAL;
> >
> > copy_cnt++;
> >
> > Can you test the attached patches? If they boot TDX with QEMU, I'll go ahead
> > and post.
>
> Patch 3 "KVM: TDX: Don't zero non-significant CPUID entry indices" breaks QEMU.
>
> QEMU uses zero as index for cpuid entries when index is not significant.
Drat. __do_cpuid_func() => do_host_cpuid() also zeros the index for
KVM_GET_SUPPORTED_CPUID, so the ABI is definitely baked at this point.
> And in QEMU, the lookup function doesn't consult the flags at all.
>
> struct kvm_cpuid_entry2 *cpuid_find_entry(struct kvm_cpuid2 *cpuid,
> uint32_t function,
> uint32_t index)
> {
> int i;
> for (i = 0; i < cpuid->nent; ++i) {
> if (cpuid->entries[i].function == function &&
> cpuid->entries[i].index == index) {
Bad QEMU, bad! :-)
> return &cpuid->entries[i];
> }
> }
> /* not found: */
> return NULL;
> }
>
> If KVM doesn't zero the index for the non-significant, QEMU cannot find
> any entry for non-significant entries returned by KVM_TDX_CAPABILITIES.
I'll opportunistically add a comment to call out that even though the index
should be meaningless, it has become ABI that userspace relies on.
> And 0x80000008 is used to pass GPAW, and KVM_TDX_INIT_VM fails when QEMU
> doesn't pass it.
>
> After dropping patch 3, QEMU can boot TD.
> Also our internal TDX CI cases passed.
Thanks much!
next prev parent reply other threads:[~2026-10-16 23:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 9:14 [PATCH v5 0/5] KVM: TDX: Validate directly configurable CPUID bits Binbin Wu
2026-10-16 9:14 ` [PATCH v5 1/5] KVM: TDX: Check unsupported CPUID bits against the TDX module's subleaf Binbin Wu
2026-10-16 15:25 ` Sean Christopherson
2026-10-16 22:15 ` Binbin Wu
2026-10-16 23:26 ` Sean Christopherson [this message]
2026-10-16 9:14 ` [PATCH v5 2/5] KVM: TDX: Track configurable CPUID bits allowed by KVM Binbin Wu
2026-10-16 9:14 ` [PATCH v5 3/5] KVM: TDX: Add CORE_CAPABILITIES to the allowlist Binbin Wu
2026-10-16 9:14 ` [PATCH v5 4/5] KVM: TDX: Report only KVM-allowed CPUIDs in KVM_TDX_CAPABILITIES Binbin Wu
2026-10-16 9:14 ` [PATCH v5 5/5] KVM: TDX: Validate userspace CPUID input for KVM_TDX_INIT_VM Binbin Wu
2026-10-16 9:24 ` sashiko-bot
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=atKypOb2h87evCY5@google.com \
--to=seanjc@google.com \
--cc=adrian.hunter@intel.com \
--cc=andrew.cooper3@citrix.com \
--cc=binbin.wu@linux.intel.com \
--cc=chao.gao@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=dedekind1@gmail.com \
--cc=kas@kernel.org \
--cc=kishen.maloor@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nik.borisov@suse.com \
--cc=pbonzini@redhat.com \
--cc=rick.p.edgecombe@intel.com \
--cc=tony.lindgren@linux.intel.com \
--cc=xiaoyao.li@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.