Re: [PATCH v4 04/10] x86/virt/tdx: Convert the tdmr metadata reader

From: Binbin Wu

Date: Tue Oct 13 2026 - 05:17:55 EST


On 10/12/2026 5:47 PM, Chao Gao wrote:
> Continue converting the metadata readers to the table-driven helper.
>
> The "TDMR info" metadata class has two readers: one for the fields that are
> always present, and one for the fields that exist only when the module
> supports Dynamic PAMT.
>
> Add a table for each, both pairing field IDs with the 'struct
> tdx_sys_info_tdmr' members that hold their values, and read all fields by
> walking the tables.
>
> Annotate both tables as __initconst since they are referenced only during
> init.
>
> AI was used under supervision to review the code and workshop the
> changelog.
>
> Signed-off-by: Chao Gao <chao.gao@xxxxxxxxx>
> Reviewed-by: Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx>

Reviewed-by: Binbin Wu <binbin.wu@xxxxxxxxxxxxxxx>

[...]

>
> @@ -122,7 +91,7 @@ static __init int get_tdx_sys_info(struct tdx_sys_info *sysinfo)
> * DPAMT but don't expose the metadata.
> */
> if (!ret && tdx_supports_dynamic_pamt(sysinfo))
> - ret = get_tdx_sys_info_tdmr_dpamt(&sysinfo->tdmr);
> + ret = read_sys_metadata_table(dpamt_mappings, &sysinfo->tdmr);

Nit:
dpamt_mappings is a bit inconsistent with others.

May be tdmr_dpampt_mappings?


>
> return ret;
> }