From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.8 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796381834; b=2b1peENEpZmUKG4HzDwOFwiAwqYvXdBHKe17F2/3367WoszzXtEPVGxuMM9+5/mTgm/n HP5EnyPyjaEihnWpqU0os7sNKfrK7EkIkf+X268wPpiO4meukz9i7+y1xv8bHXxLtfE5i KcBYy69RYg8Waoon2zQt5FWiJq5Dqv1SLwxOE8BpHt/LShPGW5loscJ5xuLpJowHrK4e5 uW/B/fQAJuembeHEygQg2UtZU+pLh+DAVRo/2xVbZG4e/VEowTU232wL4QQh6yj/Aue/G 5oqhm6H6ArevgPGxR+h/9YjWzbHxkUL3tXfvN17exfjUs/XvKV9m1RWi9A9D0IaJ4dw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381834; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=pUjCHc0L/85u2zL8LLqMgzIGFwarfoh1LjTla5onZV8=; b=u3QpMEYS6x90jND/bGEevEgLxiIMHPvFoO+RyRulXNpm9o4yqfwf+WC9LlNnEZGgLDjx 0KLtTRykDaT7Lp+AD0KPu5w+jbTeNbfGuEVBSHrxQzjzApdLpoCSb2yT7LpzifCcYODKD gGst91ea/5jRO5Czy1bxXEDSn5cAILzqgxT8vDFYn4eH25oJw2QpsZ4kfvlNJf81BFxaU A4UvdAN3RM0VSMvvlQzFHzv55gbN1sGVlii9HhTJ+5cx8vHe3Xa1d+yoykxcL5C4hr7jE hsVbhsLYUpM1AzfU3Svx1qU4oViGvgnn1kKH0DOaYoIM38K9l6J4KMjshNY5giTeyJg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=WLyOrrES; arc=none smtp.remote-ip=192.198.163.8 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90FAD606A33D for ; Fri, 4 Dec 2026 10:57:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 90FAD606A33D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=WLyOrrES DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796381834; x=1827917834; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pUjCHc0L/85u2zL8LLqMgzIGFwarfoh1LjTla5onZV8=; b=WLyOrrESiiQjMbcHyL66U8GNTYhnWOohf3kdeGs11kAZMNaYBptZBofY ZkW3j6durejut8XRIX1KV4jW85J3TY7DsN6rhimpOJITcDN0vklD9oRMr sgGkhUARWxXWOSHIC7+od5h8IRTWDqqnukFjLf0LVbsP7mgbD2d5RlJy1 6XPyrcLml3Ks/HGsImC2Y3fItZPlNC5sm4LYsBzZoaJyRqV0T5dPCNJcj LTs2RexnBgHOvm7D5/7ff/CtevuIlEnxYuYBq522zTu4SYLy9cur3htBM Rg6HK3UY4C0M7ybphs9QEoMiX/uUmFfIJ7ZonPB49xtviwIvqdNXDcyI0 g==; X-CSE-ConnectionGUID: YwYP3Yy0QBy1IFy8dfSR/Q== X-CSE-MsgGUID: GqELTRi4StmOPB1jGjaDpQ== X-IronPort-AV: E=McAfee;i="6800,10657,11985"; a="5244600" X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="5244600" Received: from fmviesa012.fm.intel.com ([10.60.135.152]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 02:57:13 -0800 X-CSE-ConnectionGUID: OYGp3NVPTuKZB9ZpV7iXYg== X-CSE-MsgGUID: AJC4QI05QdG1DK9DHDvj1g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="15701109" Received: from 984fee019967.jf.intel.com ([10.23.153.244]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 02:57:13 -0800 From: Chao Gao 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 , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Kiryl Shutsemau , Rick Edgecombe Subject: [PATCH v4 2/2] x86/virt/seamldr: Support multiple sigstruct pages Date: Fri, 4 Dec 2026 02:59:48 -0800 Message-ID: <20261204105951.1811487-3-chao.gao@intel.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20261204105951.1811487-1-chao.gao@intel.com> References: <20261204105951.1811487-1-chao.gao@intel.com> X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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