Re: [PATCH v3 2/8] x86/virt/tdx: Remove 'struct field_mapping' and implement TD_SYSINFO_MAP() macro
From: Huang, Kai
Date: Mon Sep 09 2024 - 06:00:10 EST
On Fri, 2024-09-06 at 14:30 -0700, Dan Williams wrote:
> Adrian Hunter wrote:
> [..]
> > Another possibility is to put the macro at the invocation site:
> >
> > #define READ_SYS_INFO(_field_id, _member) \
> > ret = ret ?: read_sys_metadata_field16(MD_FIELD_ID_##_field_id, \
> > &sysinfo_tdmr->_member)
> >
> > READ_SYS_INFO(MAX_TDMRS, max_tdmrs);
> > READ_SYS_INFO(MAX_RESERVED_PER_TDMR, max_reserved_per_tdmr);
> > READ_SYS_INFO(PAMT_4K_ENTRY_SIZE, pamt_entry_size[TDX_PS_4K]);
> > READ_SYS_INFO(PAMT_2M_ENTRY_SIZE, pamt_entry_size[TDX_PS_2M]);
> > READ_SYS_INFO(PAMT_1G_ENTRY_SIZE, pamt_entry_size[TDX_PS_1G]);
> >
> > #undef READ_SYS_INFO
> >
> > And so on in later patches:
> >
> > #define READ_SYS_INFO(_field_id, _member) \
> > ret = ret ?: read_sys_metadata_field(MD_FIELD_ID_##_field_id, \
> > &sysinfo_version->_member)
> >
> > READ_SYS_INFO(MAJOR_VERSION, major);
> > READ_SYS_INFO(MINOR_VERSION, minor);
> > READ_SYS_INFO(UPDATE_VERSION, update);
> > READ_SYS_INFO(INTERNAL_VERSION, internal);
> > READ_SYS_INFO(BUILD_NUM, build_num);
> > READ_SYS_INFO(BUILD_DATE, build_date);
> >
> > #undef READ_SYS_INFO
>
> Looks like a reasonable enhancement to me.
Yeah will do. Thanks.