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

From: Edgecombe, Rick P

Date: Thu Oct 08 2026 - 13:01:18 EST


On Fri, 2026-10-09 at 00:47 +0800, Xu Yilun wrote:
> I think something like the following is quite clear to me:
>
>   static const struct field_mapping version_mappings[] = {
> FIELD_MAP(0x0800000100000003ULL, struct tdx_sys_info_version, minor_version),
> ...
>   }
>
>   or even:
>
> FIELD_MAP(0x0800000100000003ULL, version, minor_version),
>
> It clearly tells the mapping for the class, the field, and the field_id.
>
> So I'm not sure what's the downside of a literal hex here. To me, a
> TDX_FIELD_XX MACRO only creates duplicated names in one line and
> unnecessary touch points when we add a new field.

Hmm, yea that is an interesting point.

A point against is that the define names match the "Field" column in the docs.
So there is some extra robustness there. But I can see your way too. Hmm...