From nobody Mon Jun 8 06:36:51 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 531053D88FA; Fri, 5 Jun 2026 21:25:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780694719; cv=none; b=Ct1puLUByOGqM4bF6Chh0K2FwWgUs/euhoM5Dc+XjrH5yH0TRESpWeuEHocaqbyesVqOqB7ob+zKvzIeiFMhA/L1xG7bqqFsskW92ldUOWKso0Sq9W1ztsQJK18k+qq0cWJCyyfeAKu0Y0YRwjZFuOR6izBQCS7R3qDxwagR0uA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780694719; c=relaxed/simple; bh=eBjcTpKSWEmnmU+Y2uhVRVbu8i1RFgRbGxM3Izpz+ME=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=K2E1xC+Fx5/T2AolQs8owWVeaE1brHaKoBfgIL/GIkV7pJSgu2x0VMlmalc4THu1lZ+sUx8Rlal9aU3+VM6VL6rAfPipDq0KqlPjsDnDVbAIOZxomBqelGXdsJkeaC1UHhBDNcMZagJEsSTKJ3d96X0SuCuHv4wPRpCTAWKE9lw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=PeDV+9/B; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=gGD1s7Ho; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="PeDV+9/B"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="gGD1s7Ho" Date: Fri, 05 Jun 2026 21:25:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1780694714; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vlR9Bw0qsCRedAKjV7HxClptX+5X+Ll971BXHbRfVpg=; b=PeDV+9/B5RJ4nqlyPJSb/6RCVDXy7dXAH0+r74S0K6XywWkf75ShpTCeLSdvAi7xMAwKdo Pp1tUP/in6sfG3xD7FvesoD65Zicj5v3k2OhcrO9k6t9GXkQGdQ8RJAxBnE61yB8lvlPcf KpUHdclqwUdimLLdolA8BoTsJoIJx1nBrlFQP3sth8Uc/R7W2rLE/kcoTEeWpSaSpypuW1 SS4FWFIVA3yxhPGsTa1nAD4+lCfPjs5frTVnqWPQqx+JEP9bcbwNICEs3jbKuKv3RxdUFH McrCak0YKLOCe1BOL/6dHJCQN2lzlz5f34BHjqb+lcolcRfePd964i+6JKHcgA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1780694714; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vlR9Bw0qsCRedAKjV7HxClptX+5X+Ll971BXHbRfVpg=; b=gGD1s7Hodlu3qMGMkvO1NBCC9dDOHg8i695jlGNDMbxPBnz4t1yZ1QnVqod+nMecDMsHtQ JW2fkI3dV/T1bZAg== From: "tip-bot2 for Chao Gao" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/tdx] x86/virt/seamldr: Initialize the newly-installed TDX module Cc: Chao Gao , Dave Hansen , Xu Yilun , Tony Lindgren , Kai Huang , "Kiryl Shutsemau (Meta)" , Rick Edgecombe , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260520133909.409394-20-chao.gao@intel.com> References: <20260520133909.409394-20-chao.gao@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178069471250.710.1240420120355200097.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/tdx branch of tip: Commit-ID: bf7c0ed2c3621f4f0bf56efcd95e5a5372bf0ca6 Gitweb: https://git.kernel.org/tip/bf7c0ed2c3621f4f0bf56efcd95e5a537= 2bf0ca6 Author: Chao Gao AuthorDate: Wed, 20 May 2026 15:29:09 -07:00 Committer: Dave Hansen CommitterDate: Wed, 03 Jun 2026 08:59:43 -07:00 x86/virt/seamldr: Initialize the newly-installed TDX module Continue fleshing out the update process. At this point the new module is sitting in memory but has never been called and is not usable. It is in a similar state to the when the system first boots. Leave the P-SEAMLDR behind. Stop making calls to it. Transition to calling the new TDX module itself to set up both global and per-cpu state. Share tdx_cpu_enable() with the fresh-boot module initialization code. Export it and invoke it on all CPUs. Note: "TDX global initialization" needs to be done once before "TDX per-CPU initialization". It would be a great fit for the new runtime update "is_lead_cpu" logic. But tdx_cpu_enable() already has some logic to do the global initialization properly. Just use it directly to maximize fresh-boot and runtime update code sharing. =3D=3D Background =3D=3D The boot-time and post-update initialization flows share the same first steps: - TDX global initialization - TDX per-CPU initialization After that, they diverge: - Fresh boot: Prepare TDMRs/PAMTs Configure the TDX module Configure the global KeyID Initialize TDMRs - Runtime update: Restore TDX module state from handoff data Future changes will consume the handoff data. [ dhansen: major changelog munging ] Signed-off-by: Chao Gao Signed-off-by: Dave Hansen Reviewed-by: Xu Yilun Reviewed-by: Tony Lindgren Reviewed-by: Kai Huang Reviewed-by: Kiryl Shutsemau (Meta) Reviewed-by: Rick Edgecombe Link: https://patch.msgid.link/20260520133909.409394-20-chao.gao@intel.com --- arch/x86/include/asm/tdx.h | 1 + arch/x86/virt/vmx/tdx/seamldr.c | 4 ++++ arch/x86/virt/vmx/tdx/tdx.c | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/tdx.h b/arch/x86/include/asm/tdx.h index 27376db..5d750fe 100644 --- a/arch/x86/include/asm/tdx.h +++ b/arch/x86/include/asm/tdx.h @@ -107,6 +107,7 @@ static inline long tdx_kvm_hypercall(unsigned int nr, u= nsigned long p1, =20 #ifdef CONFIG_INTEL_TDX_HOST void tdx_init(void); +int tdx_cpu_enable(void); const char *tdx_dump_mce_info(struct mce *m); const struct tdx_sys_info *tdx_get_sysinfo(void); =20 diff --git a/arch/x86/virt/vmx/tdx/seamldr.c b/arch/x86/virt/vmx/tdx/seamld= r.c index 54fa797..5fdb36b 100644 --- a/arch/x86/virt/vmx/tdx/seamldr.c +++ b/arch/x86/virt/vmx/tdx/seamldr.c @@ -209,6 +209,7 @@ enum module_update_state { MODULE_UPDATE_START, MODULE_UPDATE_SHUTDOWN, MODULE_UPDATE_CPU_INSTALL, + MODULE_UPDATE_CPU_INIT, MODULE_UPDATE_DONE, }; =20 @@ -287,6 +288,9 @@ static int do_seamldr_install_module(void *seamldr_para= ms) case MODULE_UPDATE_CPU_INSTALL: ret =3D seamldr_install(seamldr_params); break; + case MODULE_UPDATE_CPU_INIT: + ret =3D tdx_cpu_enable(); + break; default: break; } diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c index 37e52cd..080a2bc 100644 --- a/arch/x86/virt/vmx/tdx/tdx.c +++ b/arch/x86/virt/vmx/tdx/tdx.c @@ -113,7 +113,7 @@ out: * (and TDX module global initialization SEAMCALL if not done) on local cp= u to * make this cpu be ready to run any other SEAMCALLs. */ -static int tdx_cpu_enable(void) +int tdx_cpu_enable(void) { struct tdx_module_args args =3D {}; int ret;