Re: [PATCH v1 3/8] x86/virt/tdx: Add a table-driven TDX global metadata reader
From: Chao Gao
Date: Mon Aug 10 2026 - 02:50:42 EST
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.