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

From: Xiaoyao Li

Date: Tue May 26 2026 - 21:31:27 EST


On 5/26/2026 11:45 PM, Xu Yilun wrote:
On Mon, May 25, 2026 at 06:51:27PM +0800, Xiaoyao Li wrote:
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?

Yes, I'm good to it. I hesitated to move them out in case we need some
central control on global data. But now I see there is already a
precedent:

https://lore.kernel.org/kvm/20260520133909.409394-22-chao.gao@xxxxxxxxx/

Once we've agreed on moving add-on data reading out of get_tdx_sys_info(),
we don't have to read them after TDH.SYS.CONFIG, read them when really
needed. How about the following, that makes the Extension part in this
series self-contained.

Actually below is what I meant after TDH.SYS.CONFIG.

And I think we can re-order the patches of enabling TDX extensions by moving the patch 04 as the first one.

----8<----

diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
index 86e5b7ad19b3..b729c1f5ab9e 100644
--- a/arch/x86/virt/vmx/tdx/tdx.c
+++ b/arch/x86/virt/vmx/tdx/tdx.c
@@ -1536,6 +1536,10 @@ static __init int init_tdx_ext(void)
if (!(tdx_sysinfo.features.tdx_features0 & TDX_FEATURES0_EXT))
return 0;

+ ret = get_tdx_sys_info_ext(&tdx_sysinfo.ext);
+ if (ret)
+ return ret;
+
/* No feature requires TDX Module Extensions. */
if (!tdx_sysinfo.ext.ext_required)
return 0;
diff --git a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
index f9cc2dd02caf..e7d9e0c4b604 100644
--- a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
+++ b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
@@ -140,8 +140,5 @@ static __init int get_tdx_sys_info(struct tdx_sys_info *sysinfo)
ret = ret ?: get_tdx_sys_info_td_ctrl(&sysinfo->td_ctrl);
ret = ret ?: get_tdx_sys_info_td_conf(&sysinfo->td_conf);

- if (sysinfo->features.tdx_features0 & TDX_FEATURES0_EXT)
- ret = ret ?: get_tdx_sys_info_ext(&sysinfo->ext);
-
return ret;
}