Linux Confidential Computing Development
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Nikolay Borisov <nik.borisov@suse.com>
Cc: Xiaoyao Li <xiaoyao.li@intel.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	 Kiryl Shutsemau <kas@kernel.org>,
	Rick Edgecombe <rick.p.edgecombe@intel.com>,
	kvm@vger.kernel.org,  linux-kernel@vger.kernel.org,
	linux-coco@lists.linux.dev
Subject: Re: [PATCH v4 9/9] KVM: VMX: Consolidate the exit handler for VMX and TDX
Date: Wed, 26 Aug 2026 06:59:45 -0700	[thread overview]
Message-ID: <ao7xUc88m1fopax7@google.com> (raw)
In-Reply-To: <d9d4264f-eb8f-4407-951b-245d144b3ec8@suse.com>

On Wed, Aug 26, 2026, Nikolay Borisov wrote:
> 
> 
> On 8/26/26 13:43, Xiaoyao Li wrote:
> > On 8/26/2026 6:03 PM, Nikolay Borisov wrote:
> > > > @@ -960,7 +978,7 @@ struct kvm_x86_ops vt_x86_ops __initdata = {
> > > >       .vcpu_needs_initialization =
> > > > vt_op_tdx_only(vcpu_needs_initialization),
> > > >       .vcpu_run = vt_op(vcpu_run),
> > > > -    .handle_exit = vt_op(handle_exit),
> > > > +    .handle_exit = vt_handle_exit,
> > > 
> > > nit: Why isn't this vt_op() for the sake of consistency and
> > > introduce needless churn ?
> > 
> > I didn't see how to make vt_op() still work here while dedupping the
> > code. Do you have a better idea?
> 
> Indeed, I saw that vt_op is actually different for the TDX/!TDX case. I
> guess that function is always bound to have some quirk - i.e it has an
> #ifdef guard inside even though is_td_vcpu() is defined for the !TDX case
> but tdx_handle_exit() isn't. It's named VT, even though it's defined  in the
> "vmx section" ...

Because the name and the implementation are two separate things.  The scope is
"vt_" to communicate that the operation is common to all flavors of VT, i.e. to
both VMX and TDX.  But when support for TDX is disabled, there's no need to
trampoline through the routing code and so the vt_op() implementation wires the
hooks up directly to the VMX functions.

.handle_exit doesn't use vt_op() because the implementation of vt_handle_exit()
itself is completely common to VMX and TDX, i.e. there is no routing code and
thus no need to define a wrapper via vt_op().

  reply	other threads:[~2026-08-26 13:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19  9:48 [PATCH v4 0/9] KVM: TDX: Enable VM-DoS Prevention Features for TDX Xiaoyao Li
2026-08-19  9:48 ` [PATCH v4 1/9] KVM: TDX: Enable Notify VM exit Xiaoyao Li
2026-08-20  8:48   ` Binbin Wu
2026-08-19  9:48 ` [PATCH v4 2/9] KVM: TDX: Check if there is valid exit infos based on vp_enter_ret Xiaoyao Li
2026-08-19 16:39   ` Edgecombe, Rick P
2026-08-20  1:53     ` Xiaoyao Li
2026-08-20  9:11   ` Binbin Wu
2026-08-19  9:48 ` [PATCH v4 3/9] KVM: TDX: Set bits 31:16 to 0 for the synthesized Exit Reason Xiaoyao Li
2026-08-20  9:16   ` Binbin Wu
     [not found] ` <20260819094903.3060020-6-xiaoyao.li@intel.com>
2026-08-19 19:08   ` [PATCH v4 5/9] KVM: TDX: Update exit_reason on wait_for_sept_zap return Edgecombe, Rick P
2026-08-19 22:57 ` [PATCH v4 0/9] KVM: TDX: Enable VM-DoS Prevention Features for TDX Edgecombe, Rick P
2026-08-19 23:03   ` Sean Christopherson
2026-08-19 23:08     ` Edgecombe, Rick P
2026-08-21 13:14       ` Sean Christopherson
     [not found] ` <20260819094903.3060020-10-xiaoyao.li@intel.com>
2026-08-26  9:51   ` [PATCH v4 9/9] KVM: VMX: Consolidate the exit handler for VMX and TDX Nikolay Borisov
2026-08-26 10:03   ` Nikolay Borisov
2026-08-26 10:43     ` Xiaoyao Li
2026-08-26 11:03       ` Nikolay Borisov
2026-08-26 13:59         ` Sean Christopherson [this message]
     [not found] ` <20260819094903.3060020-8-xiaoyao.li@intel.com>
2026-08-26 10:38   ` [PATCH v4 7/9] KVM: VMX: Make handle_bus_lock_vmexit() a shared helper Nikolay Borisov
     [not found] ` <20260819094903.3060020-9-xiaoyao.li@intel.com>
2026-08-26 10:38   ` [PATCH v4 8/9] KVM: TDX: Enable Bus Lock VM exit Nikolay Borisov

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=ao7xUc88m1fopax7@google.com \
    --to=seanjc@google.com \
    --cc=kas@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nik.borisov@suse.com \
    --cc=pbonzini@redhat.com \
    --cc=rick.p.edgecombe@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox