Re: [RFC PATCH 11/15] KVM: TDX: Factor out userspace return path from tdx_get_quote()
From: Peter Fang
Date: Tue Jul 07 2026 - 01:04:32 EST
On Thu, Jul 02, 2026 at 01:08:57PM +0300, Nikolay Borisov wrote:
>
>
> > diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> > index ed12805bbb44..9f7c39e0d4b5 100644
> > --- a/arch/x86/kvm/vmx/tdx.c
> > +++ b/arch/x86/kvm/vmx/tdx.c
> > @@ -1524,6 +1524,20 @@ static int tdx_complete_simple(struct kvm_vcpu *vcpu)
> > return 1;
> > }
> > +static int tdx_get_quote_user(struct kvm_vcpu *vcpu, u64 gpa, u64 size)
> > +{
> nit: Function name is misleading, imo appropriate name should have
> "fill"/"init" in the name as what it does is to fill the run->tdx structure.
>
>
> tdx_fill_quote_user/tdx_init_quote_user
>
Oh I see that now. Patch 12 adds this pattern to tdx_get_quote():
if (kvm_tdx->get_quote_in_kernel)
ret = tdx_get_quote_kernel(vcpu, gpa, size);
else
ret = tdx_get_quote_user(vcpu, gpa, size);
The intent was to create some symmetry between the two functions. The
kernel path generates the quote in the kernel without needing to touch
run->tdx, so the two functions are slightly different and perhaps
symmetry doesn't make sense.
How about tdx_prepare_quote_user()? That seems to pair well with
tdx_get_quote_kernel()?
>
>
> <snip>
>