Re: [RFC PATCH 08/15] x86/virt/tdx: Add interface to check Quoting availability

From: Peter Fang

Date: Wed Jul 01 2026 - 20:19:59 EST


On Wed, Jul 01, 2026 at 02:25:05PM +0300, Nikolay Borisov wrote:
> > diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
> > index 9d04293394d7..b305fa5aab5c 100644
> > --- a/arch/x86/virt/vmx/tdx/tdx.c
> > +++ b/arch/x86/virt/vmx/tdx/tdx.c
> > @@ -1213,6 +1213,21 @@ static inline u64 tdx_tdr_pa(struct tdx_td *td)
> > return page_to_phys(td->tdr_page);
> > }
> > +/**
> > + * tdx_quote_enabled() - Check whether TDX Quoting extension is available
> > + *
> > + * Return: %true if the Quoting extension is available, otherwise %false.
> > + */
> > +bool tdx_quote_enabled(void)
>
> nit: Probably rename the function to tdx_quoting_ext_enabled or
> tdx_quote_ext_enabled, so it's abundantly clear it's about an extension and
> not the quoting functionality in general.

Makes sense to me. I'll fix that. Thanks.

>
>
> > +{
> > + /*
> > + * No need for locking here. The quote buffer is initialized as part of
> > + * core TDX bringup, which comes before KVM is ready for userspace.
> > + */
> > + return !!quote_data.buf;
>
> While this works it feels a bit like a hack, perhaps have a static boolean
> variable being set by the init code which is simply returned by this
> function.

I'll fix this as well.

>
> > +}
> > +EXPORT_SYMBOL_FOR_KVM(tdx_quote_enabled);
> > +
> > #define HPAS_PER_PAGE (PAGE_SIZE / sizeof(u64))
> > static int tdx_quote_create_buf(unsigned int nr_pages, struct quote_data *qdata)
>