Re: [PATCH v1 3/8] x86/virt/tdx: Add a table-driven TDX global metadata reader

Chao Gao <[email protected]>
Newsgroups dev.linux.lists.linux-coco,org.kernel.vger.kvm,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Thu, Aug 06, 2026 at 01:48:11AM +0800, Edgecombe, Rick P wrote:
>On Tue, 2026-08-04 at 04:29 -0700, Chao Gao wrote:
>> +/*
>> + * Mapping between a TDX global metadata field and the C member that
>> + * holds its value. Use TD_SYSINFO_MAP() to populate entries.
>> + */
>> +struct tdx_sys_field {
>> +	u64 field_id;
>> +	u16 offset;
>> +	u8  size;
>
>We are supposed to be able to extract the size from the field id too. We could
>leave the bits out of the field id and have it constructed on the fly, or we
>could do a static assert based on the size matching between field id size and
>struct size. It depends on how we want to have the field ids defines I guess.

Patch 8 does exactly that -- it pulls the element size from bits 33:32
of the field ID and static-asserts it against sizeof the destination
C member.
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.