Re: [PATCH v2 11/17] x86/virt/tdx: Add interface to generate a Quote

From: Tony Lindgren

Date: Thu Jun 25 2026 - 02:05:49 EST


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.