All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Lisa Wang" <wyihan@google.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH RFC 9/9] KVM: selftests: TDX: Add TDX CPUID leaf 0x1 test
Date: Sat, 05 Dec 2026 00:57:31 +0000	[thread overview]
Message-ID: <sashiko-outbox-250861@kernel.org> (raw)
In-Reply-To: <20261205-tdx-selftests-ii-v1-9-dd9f6b6fe20c@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] kvm: verify_td_cpuid() only tests vcpu->id 0 via single-vCPU
  TDX_TEST()
--

commit 351b7289ac815b3b7bcacb25440b065cf62ca0fc
Author: Sagi Shahar <sagis@google.com>

KVM: selftests: TDX: Add TDX CPUID leaf 0x1 test

This commit adds a TDX selftest that runs CPUID leaf 0x1 inside a TD
guest to check KVM's TDX CPUID/XFAM setup and vCPU ID initialization,
along with FMA and AVX feature definitions in processor.h.

> diff --git a/tools/testing/selftests/kvm/x86/tdx_vm_test.c b/tools/testing/selftests/kvm/x86/tdx_vm_test.c
> index 80d1cb1f8d1ac..5de0ffccf0753 100644
> --- a/tools/testing/selftests/kvm/x86/tdx_vm_test.c
> +++ b/tools/testing/selftests/kvm/x86/tdx_vm_test.c
> @@ -255,6 +255,51 @@ TDX_TEST(verify_td_mmio_read, guest_mmio_read)
[ ... ]
> +TDX_TEST(verify_td_cpuid, guest_code_cpuid)
> +{
[ ... ]
> +	/*
> +	 * Verify KVM's TDX CPUID/XFAM setup (KVM_TDX_INIT_VM) and vCPU ID
> +	 * initialization (KVM_TDX_INIT_VCPU) through guest CPUID leaf 0x1.
> +	 */
> +	TEST_ASSERT_EQ(eax, supported_entry->eax);
> +	TEST_ASSERT_EQ(guest_max_addressable_ids, supported_max_addressable_ids);
> +	TEST_ASSERT_EQ(guest_initial_apic_id, vcpu->id);

[Severity: Low]
Can this assertion catch broken vCPU ID propagation in KVM_TDX_INIT_VCPU
when vcpu->id is always 0?

TDX_TEST() uses vm_create_shape_with_one_vcpu(), which always creates a
single vCPU with ID 0.  Comparing guest_initial_apic_id against vcpu->id
then passes even if tdx_td_vcpu_init() fails to propagate a non-zero ID
to tdh_vp_init() or EBX[31:24] is zeroed.

Using __vm_create_with_vcpus() to create a multi-vCPU TD would exercise
at least one non-zero vCPU ID.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261205-tdx-selftests-ii-v1-0-dd9f6b6fe20c@google.com?part=9

      reply	other threads:[~2026-12-05  0:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05  0:36 [PATCH RFC 0/9] TDX KVM selftests phase II Lisa Wang
2026-12-05  0:36 ` [PATCH RFC 1/9] KVM: selftests: TDX: Add TDX_TEST() macro to tdx_vm_test Lisa Wang
2026-12-05  0:36 ` [PATCH RFC 2/9] KVM: selftests: TDX: Add TDX IO writes test Lisa Wang
2026-12-05  0:48   ` sashiko-bot
2026-12-05  0:36 ` [PATCH RFC 3/9] KVM: selftests: TDX: Support single output in __tdvmcall() Lisa Wang
2026-12-05  0:36 ` [PATCH RFC 4/9] KVM: selftests: TDX: Add TDX IO reads test Lisa Wang
2026-12-05  0:47   ` sashiko-bot
2026-12-05  0:36 ` [PATCH RFC 5/9] KVM: selftests: TDX: Add TDX MSR writes test Lisa Wang
2026-12-05  0:52   ` sashiko-bot
2026-12-05  0:36 ` [PATCH RFC 6/9] KVM: selftests: TDX: Add TDX MSR reads test Lisa Wang
2026-12-05  0:36 ` [PATCH RFC 7/9] KVM: selftests: TDX: Add TDX MMIO writes test Lisa Wang
2026-12-05  0:36 ` [PATCH RFC 8/9] KVM: selftests: TDX: Add TDX MMIO reads test Lisa Wang
2026-12-05  0:36 ` [PATCH RFC 9/9] KVM: selftests: TDX: Add TDX CPUID leaf 0x1 test Lisa Wang
2026-12-05  0:57   ` sashiko-bot [this message]

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=sashiko-outbox-250861@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wyihan@google.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.