Re: [RFC PATCH 15/15] x86/virt/tdx: Enable TDX Quoting extension

From: Xiaoyao Li

Date: Mon May 25 2026 - 06:55:09 EST


On 5/25/2026 1:17 PM, Tony Lindgren wrote:
On Fri, May 22, 2026 at 11:41:28AM +0800, Xu Yilun wrote:
From: Peter Fang <peter.fang@xxxxxxxxx>

TDX Module updates global metadata when add-on features are enabled.
Host should update the cached tdx_sysinfo to reflect these changes.

This should be made clearer IMO. How about mention that get_tdx_sys_info()
needs to get called again to reload the TDX module global metadata?

Ah ha! This patch answers my comment to patch 1:
https://lore.kernel.org/all/956fa1e6-2920-4b2e-8037-d4b9d812ae53@xxxxxxxxx/

sysinfo_ext->memory_pool_required_pages and sysinfo_ext->ext_required will be updated after extensions are enabled by TDH.SYS.CONFIG.

Patch 06 in this series already reads the tdx_sys_info_quote out of get_tdx_sys_info(), which mean get_tdx_sys_info() doesn't ensure all the global metadata will be update again.

So how about move the read of memory_pool_required_pages and ext_required out of get_tdx_sys_info() and put them after TDH.SYS.CONFIG, so that we don't need call get_tdx_sys_info() again?

--- a/arch/x86/virt/vmx/tdx/tdx.c
+++ b/arch/x86/virt/vmx/tdx/tdx.c
@@ -1049,6 +1049,7 @@ static __init int construct_tdmrs(struct list_head *tmb_list,
static __init int config_tdx_module(struct tdmr_info_list *tdmr_list,
u64 global_keyid)
{
+ u64 seamcall_fn = TDH_SYS_CONFIG_V0;
struct tdx_module_args args = {};
u64 *tdmr_pa_array;
size_t array_sz;
@@ -1074,8 +1075,22 @@ static __init int config_tdx_module(struct tdmr_info_list *tdmr_list,
args.rcx = __pa(tdmr_pa_array);
args.rdx = tdmr_list->nr_consumed_tdmrs;
args.r8 = global_keyid;
- ret = seamcall_prerr(TDH_SYS_CONFIG, &args);
+ if (tdx_sysinfo.features.tdx_features0 & TDX_FEATURES0_QUOTE) {
+ args.r9 |= TDX_FEATURES0_QUOTE;
+ /* These parameters require version >= 1 */
+ seamcall_fn = TDH_SYS_CONFIG;
+ }
+
+ ret = seamcall_prerr(seamcall_fn, &args);
+ if (ret)
+ goto free_tdmr;
+
+ /* enabling TDX Quoting may change tdx_sysinfo, update it */
+ if (tdx_sysinfo.features.tdx_features0 & TDX_FEATURES0_QUOTE)
+ ret = get_tdx_sys_info(&tdx_sysinfo);

The comment above helps, but the change in the handling will be easy to
miss.

+free_tdmr:
/* Free the array as it is not required anymore. */
kfree(tdmr_pa_array);

So I think it would be good to also add a comment to get_tdx_sys_info()
to make it easier for folks to follow that it may get called multiple
times.

Regards,

Tony