Re: [PATCH v1 2/8] x86/virt/tdx: Name the TDX module global metadata field IDs
From: Chao Gao
Date: Mon Aug 10 2026 - 02:37:44 EST
On Thu, Aug 06, 2026 at 01:10:54AM +0800, Edgecombe, Rick P wrote:
>On Tue, 2026-08-04 at 04:29 -0700, Chao Gao wrote:
>> +/*
>> + * Global Scope Metadata field IDs.
>> + *
>> + * See "Global-Scope (TDX Module) Metadata" in the Intel TDX Module ABI
>> + * spec.
>> + *
>> + * A field ID is a 64-bit value that encodes the metadata "Class"
>> + * (which Linux mirrors in 'struct tdx_sys_info' sub-structures),
>> + * the element size, and a per-class field index. Each ID below
>> + * is paired with the C member that holds its value.
>> + */
>
>I wonder about having a macro to construct these. See "Table 3.55: MD_FIELD_ID
>(Metadata Field Identifier / Sequence Header) Definition" in the TDX ABI spec
>for the meaning of the bits set in these defines.
>
>But I'd also think it would nice to have an easy way to cross reference the
>fields between kernel and TDX docs. We could probably consider adjustments to
>the docs as part of the solution for that. Of if the macro makes that cross
>reference harder, then not do it.
I'd rather keep the plain literals. "global_metadata.pdf" [1] lists each
field name next to its ID, so cross-referencing is already easy. Macros that
construct the IDs would make that harder.
[1]: https://www.intel.com/content/www/us/en/content-details/865803/abi-definitions-for-intel-tdx.html