From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 277B43D3D05 for ; Thu, 19 Mar 2026 13:24:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773926656; cv=none; b=qUlkhQxVtbusqAUvfLS2gaVeJjAvkpqMoAIl1W+57CM80ApBOJ8e34L7UCxgKU+S+B+nxqGgB94akZE3kAl071VqdDQ7u/2wa4JHnh7WbTrLXYXHxgdxh3XOvxGoCHHA4TffhBPP8LVDlP101L4L0PTC+yOqUBXp2xRhgrN3bu0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773926656; c=relaxed/simple; bh=cbOf0Ns12p/0gJph6pAN50FxRbZWKaf7EOghzAgoMkQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XMYMPKkzD8fuJ9mVXvBX1bXyhlzSvLfoWslBDYbP63Hn+t38AVyMYd1tqU2uSmIcyJo2nVNHxW8QOFjh3mYi11w20vfCxyk+eCbfHJeeIqc7+x2TcSigB4WKEa0lcQ/ZD5kBux9XEimhnomwwBznnvfniECmfULPGMUlFLksTEw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DtLhAldY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DtLhAldY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82033C2BC9E; Thu, 19 Mar 2026 13:24:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773926655; bh=cbOf0Ns12p/0gJph6pAN50FxRbZWKaf7EOghzAgoMkQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DtLhAldYL1NGVzvZFiP6LE8A5J5a5zpBR2usoBWjAK3zu2Dap5L81KQM6a4gdj7M5 ZpjXGcpdYFc8sxDPi/vvdHHv99rv6Tw6jF+B0w6KTUSWagZCbb5Z7HfcUPsgNGya4Q AjosRDPwtfkzLVBKaEx3nkv0NaAcngapHq4ItAX6rZ6WPHCm61u06wMcBfJaxp5qQa Gf1p1ijnjriNxPTzmixFU1FRrSZImLhPNOvSpouijKVzLptbKfwABWxT/7YmC6jFLh ZYb4JGjR+Da3bdNh20+cT4pqZ1neygTcc4p9nt3OxIpnyQ+4ImvNhQXrtih2mzMjX9 IxQLjrIcDDwSg== Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfauth.phl.internal (Postfix) with ESMTP id 48094F40069; Thu, 19 Mar 2026 09:24:13 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Thu, 19 Mar 2026 09:24:13 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdeftdejuddvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggugfgjsehtkeertddttddunecuhfhrohhmpefmihhrhihl ucfuhhhuthhsvghmrghuuceokhgrsheskhgvrhhnvghlrdhorhhgqeenucggtffrrghtth gvrhhnpeeludettdeigfefhffhhfelveeludeuleduvefhgefgueeitedtleffudegfffg gfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehkih hrihhllhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqudeiudduiedvieeh hedqvdekgeeggeejvdekqdhkrghspeepkhgvrhhnvghlrdhorhhgsehshhhuthgvmhhovh drnhgrmhgvpdhnsggprhgtphhtthhopeehtddpmhhouggvpehsmhhtphhouhhtpdhrtghp thhtoheptghhrghordhgrghosehinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugi dqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhu gidqtghotghosehlihhsthhsrdhlihhnuhigrdguvghvpdhrtghpthhtohepkhhvmhesvh hgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegsihhnsghinhdrfihusehlihhn uhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohepuggrnhdrjhdrfihilhhlihgrmhhsse hinhhtvghlrdgtohhmpdhrtghpthhtohepuggrvhgvrdhhrghnshgvnheslhhinhhugidr ihhnthgvlhdrtghomhdprhgtphhtthhopehirhgrrdifvghinhihsehinhhtvghlrdgtoh hmpdhrtghpthhtohepkhgrihdrhhhurghnghesihhnthgvlhdrtghomh X-ME-Proxy: Feedback-ID: i10464835:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 19 Mar 2026 09:24:10 -0400 (EDT) Date: Thu, 19 Mar 2026 13:24:06 +0000 From: Kiryl Shutsemau To: Chao Gao Cc: linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev, kvm@vger.kernel.org, binbin.wu@linux.intel.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, ira.weiny@intel.com, kai.huang@intel.com, nik.borisov@suse.com, paulmck@kernel.org, pbonzini@redhat.com, reinette.chatre@intel.com, rick.p.edgecombe@intel.com, sagis@google.com, seanjc@google.com, tony.lindgren@linux.intel.com, vannapurve@google.com, vishal.l.verma@intel.com, yilun.xu@linux.intel.com, Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" Subject: Re: [PATCH v5 11/22] x86/virt/seamldr: Shut down the current TDX module Message-ID: References: <20260315135920.354657-1-chao.gao@intel.com> <20260315135920.354657-12-chao.gao@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260315135920.354657-12-chao.gao@intel.com> On Sun, Mar 15, 2026 at 06:58:31AM -0700, Chao Gao wrote: > The first step of TDX module updates is shutting down the current TDX > Module. This step also packs state information that needs to be > preserved across updates as handoff data, which will be consumed by the > updated module. The handoff data is stored internally in the SEAM range > and is hidden from the kernel. > > To ensure a successful update, the new module must be able to consume > the handoff data generated by the old module. Since handoff data layout > may change between modules, the handoff data is versioned. Each module > has a native handoff version and provides backward support for several > older versions. > > The complete handoff versioning protocol is complex as it supports both > module upgrades and downgrades. See details in Intel® Trust Domain > Extensions (Intel® TDX) Module Base Architecture Specification, Revision > 348549-007, Chapter 4.5.3 "Handoff Versioning". > > Ideally, the kernel needs to retrieve the handoff versions supported by > the current module and the new module and select a version supported by > both. But, since this implementation chooses to only support module > upgrades, simply request the current module to generate handoff data > using its highest supported version, expecting that the new module will > likely support it. > > Note that only one CPU needs to call the TDX module's shutdown API. > > Signed-off-by: Chao Gao > Reviewed-by: Tony Lindgren > Reviewed-by: Xu Yilun > Reviewed-by: Kai Huang Reviewed-by: Kiryl Shutsemau (Meta) Nit is below. > @@ -100,6 +100,17 @@ static int get_tdx_sys_info_td_conf(struct tdx_sys_info_td_conf *sysinfo_td_conf > return ret; > } > > +static int get_tdx_sys_info_handoff(struct tdx_sys_info_handoff *sysinfo_handoff) > +{ > + int ret = 0; > + u64 val; > + > + if (!ret && !(ret = read_sys_metadata_field(0x8900000100000000, &val))) !ret check is redundant as well as the ret initialization above. > + sysinfo_handoff->module_hv = val; > + > + return ret; > +} > + > static int get_tdx_sys_info(struct tdx_sys_info *sysinfo) > { > int ret = 0; > @@ -116,5 +127,12 @@ static int get_tdx_sys_info(struct tdx_sys_info *sysinfo) -- Kiryl Shutsemau / Kirill A. Shutemov