Re: [PATCH v2 11/17] x86/virt/tdx: Add interface to generate a Quote
From: Peter Fang
Date: Tue Jun 30 2026 - 00:23:40 EST
On Thu, Jun 25, 2026 at 09:05:28AM +0300, Tony Lindgren wrote:
> On Thu, Jun 18, 2026 at 04:13:49PM +0800, Xu Yilun wrote:
> > From: Peter Fang <peter.fang@xxxxxxxxx>
> > --- a/arch/x86/virt/vmx/tdx/tdx.c
> > +++ b/arch/x86/virt/vmx/tdx/tdx.c
> ...
> > +void *tdx_quote_generate(struct tdx_td *td, void *in_data, u32 in_data_len,
> > + u32 *quote_len)
> > +{
> > + struct tdx_quote_data *qdata = &tdx_quote;
> > + void *quote_dup = NULL;
> > + u64 r, out_len;
> > +
> > + if (!tdx_quote_enabled())
> > + return NULL;
> > +
> > + mutex_lock(&tdx_quote_lock);
>
> How about make the pre-generated static tdx_quote a template page that only
> gets read and copied to an allocated bufer here?
>
> If the tdx_quote template is only read for copying here, seems you're not
> going to need the mutex at all? That is assuming tdx_quote template does
> not change after init.
Hm, actually tdx_quote is an output buffer as well (in the form of a
head pointer: qdata->hpa_entries_pa). Maybe this code needs better
commenting...