From nobody Wed Jun 17 05:14:12 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 03DBC346AFD; Mon, 27 Apr 2026 22:26:39 +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=1777328801; cv=none; b=bbxH3EEKgoYPTKc3qPnKY6iaI7uumbmfRvNnD07nd2mb1Crf/85rpXVwntyTbLtXHew4afhUiAaFOI7PcxbBKk3kUbHetYl3vg7A9rM7R4/J+fNtjgHFxWcfIc1lLjgQtS36zTdu+1FuvAgCnaDkIec/ldMb7qvEkv6VCIwLU4I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777328801; c=relaxed/simple; bh=GyGQpLYk1LPqtVa0Oe3h3SMzzQx2NBbc0eC9P1qFilQ=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=g/0MKcLU+YVPlZQrYZ2BIyrRUF6ssSudnkkV/8xqcUCAeQkE16T57aZbMQH4zQ2bAXkvvP+C9cnU6Q11Zho/sKZvq0Q25xv3Odw8Oe2oR7tmQ3h7EOhxl3GcTfX2Eu4FoyqJqpuyXLUgzwt1KheEbFwci655LJ7kT7/r2+cngOY= 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=vvW3oIsU; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=cxPPIDv6; 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="vvW3oIsU"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="cxPPIDv6" Date: Mon, 27 Apr 2026 22:26:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1777328797; 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=1K4YZv2giZoYTrI9bfDSmg4pPTmBmayefEQHqoAyu6E=; b=vvW3oIsUhDA+/zqJVB2KDC1BrDJrbPV0laamwKm2+c3h7Pd7vdrt27ZTkKUEdz1zFj3YyJ EOUKF6WE3HWD9JuGnpr/vfglmGKx3ZOb2sXRzI2E2SStr1wP7p9/dlwGSE4IyS7fvxPfve 7oDNfFWdCd+uS+7+bCjnxiGjAMrnNEpFSbKG1lMMb4YIF7gqz62ivKSS9sZ9znO8+6qGmq iMeR/CU3o3tqv/KzV2m/C+8EfrgR6i9gNCUySETLKPb4Lb6MJOqhSCdSMbOOxmKTp5JgXl c7gwERYrDwW3jBdtKjZaQQ95viIk6C1PDisykHvPFi+H436Wb8dF2B98tE9ADQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1777328797; 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=1K4YZv2giZoYTrI9bfDSmg4pPTmBmayefEQHqoAyu6E=; b=cxPPIDv6FgMWJi1j//KTBK20phdp+eHeQvvuxDkGr4/Wx8uNb38B9p4e4yJrU105Tt9rw7 YUekpeaPEpMyd5Bg== From: "tip-bot2 for Vishal Verma" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/tdx] x86/tdx: Disable the TDX module during kexec and kdump Cc: Rick Edgecombe , Vishal Verma , Dave Hansen , "Kiryl Shutsemau (Meta)" , Kai Huang , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260402-fuller_tdx_kexec_support-v3-4-34438d7094bf@intel.com> References: <20260402-fuller_tdx_kexec_support-v3-4-34438d7094bf@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177732879631.3521451.10728186562744084577.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: 5b25f249be32c3f43ac1895e6560a1c8aa6f6110 Gitweb: https://git.kernel.org/tip/5b25f249be32c3f43ac1895e6560a1c8a= a6f6110 Author: Vishal Verma AuthorDate: Thu, 02 Apr 2026 00:32:04 -06:00 Committer: Dave Hansen CommitterDate: Mon, 27 Apr 2026 15:13:39 -07:00 x86/tdx: Disable the TDX module during kexec and kdump Use the TDH.SYS.DISABLE SEAMCALL, which disables the TDX module, reclaims all memory resources assigned to TDX, and clears any partial-write induced poison, to allow kexec and kdump on platforms with the partial write errata. On TDX-capable platforms with the partial write erratum, kexec has been disabled because the new kernel could hit a machine check reading a previously poisoned memory location. Later TDX modules support TDH.SYS.DISABLE, which disables the module and reclaims all TDX memory resources, allowing the new kernel to re-initialize TDX from scratch. This operation also clears the old memory, cleaning up any poison. Add tdx_sys_disable() to tdx_shutdown(), which is called in the syscore_shutdown path for kexec. This is done just before tdx_shutdown() disables VMX on all CPUs. For kdump, call tdx_sys_disable() in the crash path before x86_virt_emergency_disable_virtualization_cpu() does VMXOFF. Since this clears any poison on TDX-managed memory, remove the X86_BUG_TDX_PW_MCE check in machine_kexec() that blocked kexec on partial write errata platforms. Co-developed-by: Rick Edgecombe Signed-off-by: Rick Edgecombe Signed-off-by: Vishal Verma Signed-off-by: Dave Hansen Reviewed-by: Kiryl Shutsemau (Meta) Acked-by: Kai Huang Link: https://patch.msgid.link/20260402-fuller_tdx_kexec_support-v3-4-34438= d7094bf@intel.com --- arch/x86/kernel/crash.c | 2 ++ arch/x86/kernel/machine_kexec_64.c | 16 ---------------- arch/x86/virt/vmx/tdx/tdx.c | 1 + 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index cd79681..623d447 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -112,6 +113,7 @@ void native_machine_crash_shutdown(struct pt_regs *regs) =20 crash_smp_send_stop(); =20 + tdx_sys_disable(); x86_virt_emergency_disable_virtualization_cpu(); =20 /* diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_k= exec_64.c index 0590d39..c3f4a38 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c @@ -347,22 +347,6 @@ int machine_kexec_prepare(struct kimage *image) unsigned long reloc_end =3D (unsigned long)__relocate_kernel_end; int result; =20 - /* - * Some early TDX-capable platforms have an erratum. A kernel - * partial write (a write transaction of less than cacheline - * lands at memory controller) to TDX private memory poisons that - * memory, and a subsequent read triggers a machine check. - * - * On those platforms the old kernel must reset TDX private - * memory before jumping to the new kernel otherwise the new - * kernel may see unexpected machine check. For simplicity - * just fail kexec/kdump on those platforms. - */ - if (boot_cpu_has_bug(X86_BUG_TDX_PW_MCE)) { - pr_info_once("Not allowed on platform with tdx_pw_mce bug\n"); - return -EOPNOTSUPP; - } - /* Setup the identity mapped 64bit page table */ result =3D init_pgtable(image, __pa(control_page)); if (result) diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c index 1ae558b..c0c6281 100644 --- a/arch/x86/virt/vmx/tdx/tdx.c +++ b/arch/x86/virt/vmx/tdx/tdx.c @@ -259,6 +259,7 @@ static void tdx_shutdown_cpu(void *ign) =20 static void tdx_shutdown(void *ign) { + tdx_sys_disable(); on_each_cpu(tdx_shutdown_cpu, NULL, 1); } =20