Re: [RFC PATCH v2 02/10] x86/virt/tdx: Convert the version metadata reader

From: Binbin Wu

Date: Thu Sep 24 2026 - 02:40:34 EST


On 9/18/2026 9:29 PM, Chao Gao wrote:
> With the helper to read a table of metadata fields in place, the
> existing metadata readers can be standardized on it.
>
> Convert the version metadata reader: add a table that pairs each field ID
> with the 'struct tdx_sys_info_version' member that holds its value, and
> read all version fields by walking that table.
>
> Name the field IDs for readability, so the table entries don't carry raw
> hex literals.
>
> Also add read_sys_metadata_table() macro to derive the number of entries
> with ARRAY_SIZE() so that callers don't need to pass it separately.
>
> AI was used under supervision to review code and workshop logs. It suggests
^
Nit: suggested

> adding read_sys_metadata_table() macro.