Kernel KVM virtualization development
 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 2/9] KVM: selftests: TDX: Add TDX IO writes test
Date: Sat, 05 Dec 2026 00:48:59 +0000	[thread overview]
Message-ID: <sashiko-outbox-250853@kernel.org> (raw)
In-Reply-To: <20261205-tdx-selftests-ii-v1-2-dd9f6b6fe20c@google.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] KVM: selftests: wrong io.direction constant in
  verify_td_io_write()
- [Low] KVM: selftests: bypass TEST_ASSERT_KVM_EXIT_REASON in
  verify_td_io_write()
--

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

KVM: selftests: TDX: Add TDX IO writes test

This commit adds a tdx_io_write() helper and a selftest in tdx_vm_test.c
that checks valid and invalid TDX guest IO writes.

> diff --git a/tools/testing/selftests/kvm/x86/tdx_vm_test.c b/tools/testing/selftests/kvm/x86/tdx_vm_test.c
> index 6ab8ad52bd4ee..07bfaad422fe6 100644
> --- a/tools/testing/selftests/kvm/x86/tdx_vm_test.c
> +++ b/tools/testing/selftests/kvm/x86/tdx_vm_test.c

[ ... ]

> +TDX_TEST(verify_td_io_write, guest_io_write)
> +{
> +	struct ucall uc;
> +	u32 port_data;
> +
> +	vcpu_run(vcpu);
> +	TEST_ASSERT_EQ(vcpu->run->exit_reason, KVM_EXIT_IO);

[Severity: Low]
Could this reuse TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_IO) instead of
TEST_ASSERT_EQ()?  The shared KVM selftest helper prints symbolic exit
reason names via exit_reason_str() on failure instead of raw numbers.

> +	TEST_ASSERT_EQ(vcpu->run->io.port, TEST_IO_PORT);
> +	TEST_ASSERT_EQ(vcpu->run->io.size, sizeof(TEST_IO_DATA_VALUE));
> +	TEST_ASSERT_EQ(vcpu->run->io.direction, TDVMCALL_IO_WRITE);

[Severity: Low]
Should this compare vcpu->run->io.direction against KVM_EXIT_IO_OUT instead
of TDVMCALL_IO_WRITE?  KVM populates io.direction with KVM_EXIT_IO_OUT from
the KVM UAPI, whereas TDVMCALL_IO_WRITE is a TDX guest hypercall argument;
the assertion only passes because both happen to evaluate to 1.

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

  reply	other threads:[~2026-12-05  0:48 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 [this message]
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

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-250853@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox