From nobody Mon Jun 8 06:38: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 11DFA3D3D1D; Fri, 5 Jun 2026 21:25:17 +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=1780694720; cv=none; b=eb7KCf3HTYgRRiIsEOjNc/nepYwfrcrLZsZgu0P7BKN/n/ah8+9UFgBNyutrjMKtjT04WH6hDf55HRo2j7snkxy/Qk66wT1WySY3uAm/OLzJyR/Bqwfqjk2zbqye76PHtOmRKwIckAUYCcfB5vULw6MTaWg6YFNves0NM2zsDOE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780694720; c=relaxed/simple; bh=99B95QAZ9lCLKPJHppWYjVStHSkQq3MnL6SiYh5cY2w=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=myOy/wU8cy1m0bRRsBh1rFbVkjQg213moox/Ox5Qmxjw/AJ7Fg+9svhf7xXdRTySjO5MF/9ABfqSkJtjEB1ei06EML7wY/IikpQyoG24QJFMm+BJh71He/PUxK8j59Gdx4iO3G2qwHAHEFHWZROr0hMRSSs83VJo4EPixY63ha0= 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=LYG3l9ee; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=WPxAFKmr; 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="LYG3l9ee"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="WPxAFKmr" Date: Fri, 05 Jun 2026 21:25:15 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1780694716; 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=SRSHDGrDQQVzNK3bj6opHkd3xPnzYctU4k9NpwnKVDE=; b=LYG3l9eeQW66vDNvaMbRdLYeljBDQf+s9yvINgw5o+qpF4ADFs+p4qJ/rttJ8hkhaLDwoN OtUmD1ZheCscrdzm2lFhvrSpTfpGvuv92+iWq7KHCLwZ+wb/edHXAG3VwWmJ/qUueYa3Tl BscpEWLIcqz1tDCjplBQhkvN3FTKGjD76CvSmQYm3sdc3JdJovTUqfzAIAQLzUosjBIXQZ YXiXVOdCh/Cw97SeolMNFpo/QPfxdeGiHWf4TKpoVN9lr/uv/ZakrTPHXy5F6eOOsJnoGs hJnCXbqNhJuFYyc7QO8FcBIw0oZapMLI3PXgOd2mGury4yp/8kHgY2HeCi9bEw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1780694716; 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=SRSHDGrDQQVzNK3bj6opHkd3xPnzYctU4k9NpwnKVDE=; b=WPxAFKmr6HjSO7oOgQV/3XoOz4LJgqaOPfMhwexLpzzmTEnlMzhoNRKDF0cgMQd0FHkJll 3M4fywjHHE8gm2Bg== 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/tdx: Reset software states during TDX module shutdown Cc: Chao Gao , Dave Hansen , Tony Lindgren , Kai Huang , Rick Edgecombe , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260520133909.409394-18-chao.gao@intel.com> References: <20260520133909.409394-18-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: <178069471518.710.12848679705026515191.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: 65a6542a8144cb88ffccae386e38d61933d575c8 Gitweb: https://git.kernel.org/tip/65a6542a8144cb88ffccae386e38d6193= 3d575c8 Author: Chao Gao AuthorDate: Wed, 20 May 2026 15:29:06 -07:00 Committer: Dave Hansen CommitterDate: Wed, 03 Jun 2026 08:59:43 -07:00 x86/virt/tdx: Reset software states during TDX module shutdown The TDX module requires a one-time global initialization (TDH.SYS.INIT) and per-CPU initialization (TDH.SYS.LP.INIT) before use. These initializations are guarded by software flags to prevent repetition. Reset all software flags guarding the initialization flows to allow the global and per-CPU initializations to be triggered again after updates. [ dhansen: trim down changelog ] Signed-off-by: Chao Gao Signed-off-by: Dave Hansen Reviewed-by: Tony Lindgren Reviewed-by: Kai Huang Reviewed-by: Rick Edgecombe Link: https://patch.msgid.link/20260520133909.409394-18-chao.gao@intel.com --- arch/x86/virt/vmx/tdx/tdx.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c index 3fe01b5..37e52cd 100644 --- a/arch/x86/virt/vmx/tdx/tdx.c +++ b/arch/x86/virt/vmx/tdx/tdx.c @@ -1279,6 +1279,7 @@ int tdx_module_shutdown(void) struct tdx_sys_info_handoff handoff =3D {}; struct tdx_module_args args =3D {}; int ret; + int cpu; =20 ret =3D get_tdx_sys_info_handoff(&handoff); /* @@ -1294,7 +1295,21 @@ int tdx_module_shutdown(void) */ args.rcx =3D handoff.module_hv; =20 - return seamcall_prerr(TDH_SYS_SHUTDOWN, &args); + ret =3D seamcall_prerr(TDH_SYS_SHUTDOWN, &args); + if (ret) + return ret; + + /* + * Clear global and per-CPU initialization flags so the new module + * can be fully re-initialized after a successful update. + * + * No locks needed as no concurrent accesses can occur here. + */ + memset(&tdx_module_state, 0, sizeof(tdx_module_state)); + for_each_possible_cpu(cpu) + per_cpu(tdx_lp_initialized, cpu) =3D false; + + return 0; } =20 static bool is_pamt_page(unsigned long phys)