Re: [PATCH v3 1/4] x86/tdx: Add helper to query maximum TD Quote size

From: Peter Fang

Date: Thu Sep 03 2026 - 18:45:49 EST


On Thu, Sep 03, 2026 at 09:04:31AM +0300, Tony Lindgren wrote:
> On Wed, Jul 29, 2026 at 05:29:31AM -0700, Peter Fang wrote:
> > +/**
> > + * tdx_get_max_quote_size() - Get the maximum TD Quote size
> > + *
> > + * Read the maximum size of a TD Quote from a 4-byte TD metadata field. The TDX
> > + * guest driver uses it to size the buffer for Quote retrieval. Older TDX
> > + * modules do not support this field and return an error.
> > + *
> > + * Return: Maximum Quote size in bytes on success, or 0 on failure.
> > + */
> > +u32 tdx_get_max_quote_size(void)
> > +{
> > + u64 val, ret;
> > +
> > + ret = tdg_vm_rd(TDCS_QUOTE_MAX_SIZE, &val);
> > +
> > + return ret ? 0 : (u32)val;
> > +}
>
> I think you can leave out the u32 cast above.
>
> Other than that:
>
> Reviewed-by: Tony Lindgren <tony.lindgren@xxxxxxxxxxxxxxx>

Thanks Tony! This was discussed previously [1] and Binbin pointed out
that this makes the field width more explicit:

[1] https://lore.kernel.org/all/20260714055421.GB3178326@pedri/