Re: [PATCH v3 02/10] x86/virt/tdx: Convert the version metadata reader
From: Dave Hansen
Date: Thu Oct 01 2026 - 13:27:13 EST
On 10/1/26 09:24, Nikolay Borisov wrote:
> nit: I personally dislike adding this level of indirection, albeit
> rather shallow just so you don't have to repeat 'struct xxxx' in every
> TDX_SYS_INFO_MAP. Same goes for the rest of the patches. In the past I
> remember TDX code also suffered from, in my opinion, excessive macro
> nesting.
>
> Dave, what's your take on this?
>
>> +
>> +static const struct field_mapping version_mappings[] = {
>> + TDX_SYSINFO_MAP_VERSION(TDX_FIELD_MINOR_VERSION, minor_version),
>> + TDX_SYSINFO_MAP_VERSION(TDX_FIELD_MAJOR_VERSION, major_version),
>> + TDX_SYSINFO_MAP_VERSION(TDX_FIELD_UPDATE_VERSION, update_version),
>> +};
I'm kinda ambivalent on it. The width of the structure doesn't really
matter much. It's readable either way and it's already got *PLENTY* of
duplicate gunk in it.
I'd try to remove the macro, and make sure the structure definition
doesn't get too icky.