Re: [PATCH v2 17/17] KVM: TDX: Support event-notify interrupts only with userspace Quoting
From: Peter Fang
Date: Tue Jun 30 2026 - 02:44:28 EST
On Thu, Jun 25, 2026 at 09:28:39AM +0300, Tony Lindgren wrote:
> On Thu, Jun 18, 2026 at 04:13:55PM +0800, Xu Yilun wrote:
> > From: Peter Fang <peter.fang@xxxxxxxxx>
> > --- a/arch/x86/kvm/vmx/tdx.c
> > +++ b/arch/x86/kvm/vmx/tdx.c
> > @@ -202,8 +202,15 @@ static int init_kvm_tdx_caps(const struct tdx_sys_info_td_conf *td_conf,
> >
> > caps->cpuid.nent = td_conf->num_cpuid_config;
> >
> > - caps->user_tdvmcallinfo_1_r11 =
> > - TDVMCALLINFO_SETUP_EVENT_NOTIFY_INTERRUPT;
> > + /*
> > + * Don't advertise userspace event-notify interrupt support if TDX
> > + * quoting service is enabled, as quote generation will be handled
> > + * entirely in the kernel. Support in the kernel can be added later.
> > + */
> > + if (!tdx_quote_enabled()) {
> > + caps->user_tdvmcallinfo_1_r11 |=
> > + TDVMCALLINFO_SETUP_EVENT_NOTIFY_INTERRUPT;
> > + }
>
> Can you use kvm_tdx->get_quote_in_kernel also above? Or should it maybe
> be initialized here if not used earlier?
This is a bit tricky. init_kvm_tdx_caps() is designed to be independent
of a TDX VM instance (it reports the overall TDX capabilities), so there
is no struct kvm_tdx available.
>
> > @@ -1684,9 +1691,16 @@ static int tdx_get_quote(struct kvm_vcpu *vcpu)
> >
> > static int tdx_setup_event_notify_interrupt(struct kvm_vcpu *vcpu)
> > {
> > + struct kvm_tdx *kvm_tdx = to_kvm_tdx(vcpu->kvm);
> > struct vcpu_tdx *tdx = to_tdx(vcpu);
> > u64 vector = tdx->vp_enter_args.r12;
> >
> > + /* See comment in init_kvm_tdx_caps() */
> > + if (kvm_tdx->get_quote_in_kernel) {
> > + tdvmcall_set_return_code(vcpu, TDVMCALL_STATUS_SUBFUNC_UNSUPPORTED);
> > + return 1;
> > + }
> > +
>
> Since you're using kvm_tdx->get_quote_in_kernel here.
This is in per-vCPU context, so struct kvm_tdx is available.