[RFC PATCH v1 3/3] x86/virt/seamldr: Support multiple sigstruct pages
From: Chao Gao
Date: Fri Oct 30 2026 - 04:55:27 EST
Each TDX module update image carries a sigstruct, which is passed along
with the module binary to P-SEAMLDR. 'struct seamldr_params' has a single
physical address slot for it, so a sigstruct can be at most one 4KB page.
TDX modules are moving to a post-quantum signature algorithm. Its
signatures are far larger than the ones in use today, so the sigstruct
no longer fits in 4KB.
The P-SEAMLDR ABI was extended for this. It now has four sigstruct
address slots instead of one, for sigstructs of up to 16KB. A new
'version' value of 1 tells P-SEAMLDR that this layout is in use.
Extend 'struct seamldr_params' to match the new ABI.
Set 'version' to 1 only when the sigstruct spans more than one page. Old
P-SEAMLDRs reject version 1, so this keeps updates with a single-page
sigstruct working on them.
Do not query P-SEAMLDR for version 1 support. Userspace selects the
update image and is responsible for ensuring the module is compatible
with P-SEAMLDR.
AI was used under supervision to review code and workshop logs
Signed-off-by: Chao Gao <chao.gao@xxxxxxxxx>
---
arch/x86/virt/vmx/tdx/seamldr.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/arch/x86/virt/vmx/tdx/seamldr.c b/arch/x86/virt/vmx/tdx/seamldr.c
index 09c8f6e30e9f..04681e67072f 100644
--- a/arch/x86/virt/vmx/tdx/seamldr.c
+++ b/arch/x86/virt/vmx/tdx/seamldr.c
@@ -32,7 +32,15 @@
#define SEAMLDR_MAX_NR_MODULE_PAGES (SZ_1G / PAGE_SIZE)
#define SEAMLDR_NR_MODULE_PA_ENTRIES 496
-#define SEAMLDR_MAX_NR_SIG_PAGES 1
+#define SEAMLDR_MAX_NR_SIG_PAGES 4
+
+/*
+ * The seamldr_params "version" field specifies the layout of the
+ * structure. Version 0 supports only 1 sigstruct page while version 1
+ * supports up to 4.
+ */
+#define SEAMLDR_PARAMS_VERSION_0 0
+#define SEAMLDR_PARAMS_VERSION_1 1
/*
* The seamldr_params "scenario" field specifies the operation mode:
@@ -66,7 +74,7 @@ struct seamldr_params {
u32 version;
u32 scenario;
u64 sigstruct_pages_pa_list[SEAMLDR_MAX_NR_SIG_PAGES];
- u8 reserved[104];
+ u8 reserved[80];
u64 module_nr_pages;
u64 module_pages_pa_list[SEAMLDR_NR_MODULE_PA_ENTRIES];
@@ -232,7 +240,14 @@ static void populate_seamldr_params(struct seamldr_params *params,
const u8 *sig, u32 sig_nr_pages,
const u8 *mod, u32 mod_nr_pages)
{
- params->version = 0;
+ params->version = SEAMLDR_PARAMS_VERSION_0;
+ /*
+ * Use version 1 only for multi-page sigstructs, to stay
+ * compatible with old P-SEAMLDRs that lack version 1 support.
+ */
+ if (sig_nr_pages > 1)
+ params->version = SEAMLDR_PARAMS_VERSION_1;
+
params->scenario = SEAMLDR_SCENARIO_UPDATE;
params->module_nr_pages = mod_nr_pages;
--
2.52.0