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

Peter Fang <[email protected]>
Newsgroups dev.linux.lists.linux-coco,org.kernel.vger.kvm,org.kernel.vger.linux-kernel
Message-ID <20260714055421.GB3178326@pedri>
On Fri, Jul 10, 2026 at 10:38:40AM +0800, Binbin Wu wrote:
> On 6/12/2026 8:36 PM, Kiryl Shutsemau 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;
> > 
> > Cast is redundant.
> 
> I thought in Linux kernel, the explicit cast is often preferred?
> E.g. as documentation of the metadata field’s width here?

Hm... I asked AI to find some patterns in arch/x86, and looks
like the explicit cast is more common... Kiryl are you okay with me
keeping the cast?

>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.