Linux Confidential Computing Development
 help / color / mirror / Atom feed
From: Chao Gao <chao.gao@intel.com>
To: linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev,
	kvm@vger.kernel.org
Cc: yilun.xu@intel.com, arjan.van.de.ven@intel.com,
	binbin.wu@linux.intel.com, Chao Gao <chao.gao@intel.com>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Kiryl Shutsemau <kas@kernel.org>,
	Rick Edgecombe <rick.p.edgecombe@intel.com>
Subject: [PATCH v4 2/2] x86/virt/seamldr: Support multiple sigstruct pages
Date: Fri,  4 Dec 2026 02:59:48 -0800	[thread overview]
Message-ID: <20261204105951.1811487-3-chao.gao@intel.com> (raw)
In-Reply-To: <20261204105951.1811487-1-chao.gao@intel.com>

TDX module sigstructs are limited to 4KB. Each update image carries a
sigstruct, which is handed to P-SEAMLDR in 'struct seamldr_params'
along with the module binary. The structure has room for the physical
address of only one sigstruct 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 to take up to four sigstruct pages. The
physical addresses of the three added pages follow the existing one, in
space that was reserved. Setting the 'version' field of the structure
to 1 tells P-SEAMLDR that the added addresses are in use.

Grow sigstruct_pages_pa_list[] to four entries to match. In anticipation
of this change, the list is already filled in a loop, so filling the
new entries needs no new code.

Use version 1 only when the sigstruct spans more than one page. Old
P-SEAMLDRs reject version 1, so this keeps today's modules working on
them.

P-SEAMLDR enumerates its support for version 1 with a feature bit. Do
not query it. Userspace selects the update image and is responsible
for ensuring the module is compatible with P-SEAMLDR.

Signed-off-by: Chao Gao <chao.gao@intel.com>
---
v4:
 - Describe where the added sigstruct page addresses go in the
   structure and what version 1 tells P-SEAMLDR
 - Mention that P-SEAMLDR enumerates version 1 with a feature bit

v3:
 - Explain why sigstruct filling code is a loop already [Rick]
 - Drop the boilerplate AI usage note [Dave]

v2:
 - drop macros for versions to keep the diff minimal
 - explain why the sigstruct filling code needs no change
---
 arch/x86/virt/vmx/tdx/seamldr.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/x86/virt/vmx/tdx/seamldr.c b/arch/x86/virt/vmx/tdx/seamldr.c
index 5678309624ab..497d83cc3432 100644
--- a/arch/x86/virt/vmx/tdx/seamldr.c
+++ b/arch/x86/virt/vmx/tdx/seamldr.c
@@ -41,7 +41,7 @@
 #define SEAMLDR_MAX_NR_MODULE_PAGES \
 	(SEAMLDR_NR_PA_ENTRIES_FIRST_PAGE + \
 	 (SEAMLDR_PARAMS_NR_PAGES - 1) * SEAMLDR_NR_PA_ENTRIES_CHAINED_PAGE)
-#define SEAMLDR_MAX_NR_SIG_PAGES	1
+#define SEAMLDR_MAX_NR_SIG_PAGES	4
 
 /*
  * The seamldr_params "scenario" field specifies the operation mode:
@@ -62,7 +62,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_PA_ENTRIES_FIRST_PAGE];
 	u64	next_pa; /* Points to chained_pages[0]. */
@@ -207,6 +207,13 @@ static void populate_seamldr_params(struct seamldr_params *params,
 				    const u8 *mod, u32 mod_nr_pages)
 {
 	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	= 1;
+
 	params->scenario	= SEAMLDR_SCENARIO_UPDATE;
 	params->module_nr_pages	= mod_nr_pages;
 
-- 
2.52.0


  parent reply	other threads:[~2026-12-04 10:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 10:59 [PATCH v4 0/2] TDX: P-SEAMLDR: Support large TDX modules and sigstructs Chao Gao
2026-12-04 10:59 ` [PATCH v4 1/2] x86/virt/seamldr: Support large TDX module binaries Chao Gao
2026-12-05  0:27   ` Edgecombe, Rick P
2026-12-04 10:59 ` Chao Gao [this message]
2026-12-05  0:38   ` [PATCH v4 2/2] x86/virt/seamldr: Support multiple sigstruct pages Edgecombe, Rick P

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261204105951.1811487-3-chao.gao@intel.com \
    --to=chao.gao@intel.com \
    --cc=arjan.van.de.ven@intel.com \
    --cc=binbin.wu@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kas@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    --cc=yilun.xu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox