From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (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 2612A47A0A1; Wed, 13 May 2026 15:11:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778685099; cv=none; b=KLLFqZiJR7qcDpAmONyD6Q4LqtgERQkGicbURu/T8Yga68qYwOurrQ3gpsOt9XY6FUwo0eWwxlO1ll88pnirET8exBe0YJ7zCQCsoS9FeX8rlu7v8GbUnh2V/Uiy7dDjOR8gAlg5CegLLA5irfDP4zg5Mj9uBGT9YPX4sdT7KX0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778685099; c=relaxed/simple; bh=OktXFrilQcSyM/3dJFecEfFCo2wguMlxW/VesP2zZR0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=NRf8nMjWRxtK5YdA/pOSQqUtDUwscVlQYYj39grjJNs4dOah+6Wdtlq36N7GRHMvJg/IQ564MyEcYjvlWzBp/GDnDn0Dpm84b+Hty0dJNr8tIJrwGIPJ8joQJA7lNNnqeV7Ol6RQV96Zx02Qt5QQ/g6UwVfJUzkm/330c4marEs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mSNTNlUo; arc=none smtp.client-ip=198.175.65.11 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.b="mSNTNlUo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778685097; x=1810221097; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=OktXFrilQcSyM/3dJFecEfFCo2wguMlxW/VesP2zZR0=; b=mSNTNlUovb1QkaiH0G03iwxJOcTP8nvoh0HAfGRS8U+zF/bLs/ac1LUI eUGvXHeIZBm/n66VccFCCE/MIjJys7tt9icVtHFYu19kl223Qik5DSUhs 1m8xP5ioD2d18S4O9H4z8AwpvLe1wkz07VhUxjbsSMWY8IhPdtjUTjeCr uJwW5pdcza/tJalMIdVBraenZumZ9zjsCbajcMIRkonlHFRNvFZVUvpuD D/vTLcPZyuxKlrM7Yk9edA1sOoi2et2lsyRs8eJbC4Tky1A/TZwL89eF8 nfAm1lZdnCLRwdlXkJzllzjHNUx/g76/9ct6r/rKR7pcxk6EOYWhK8NsW Q==; X-CSE-ConnectionGUID: niDBpFPhTb+iYlX2xTEuEA== X-CSE-MsgGUID: kcgL31NJT+GsueM/lLKqZQ== X-IronPort-AV: E=McAfee;i="6800,10657,11785"; a="89921570" X-IronPort-AV: E=Sophos;i="6.23,232,1770624000"; d="scan'208";a="89921570" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2026 08:11:36 -0700 X-CSE-ConnectionGUID: l2VAFLFoQIGIYfuUawyFUw== X-CSE-MsgGUID: BM6wTOIMSeu/D0ouAMO68g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,232,1770624000"; d="scan'208";a="231716737" Received: from 984fee019967.jf.intel.com ([10.23.153.244]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2026 08:11:35 -0700 From: Chao Gao To: kvm@vger.kernel.org, linux-coco@lists.linux.dev, x86@kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, linux-doc@vger.kernel.org Cc: binbin.wu@linux.intel.com, dave.hansen@linux.intel.com, djbw@kernel.org, ira.weiny@intel.com, kai.huang@intel.com, kas@kernel.org, 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, xiaoyao.li@intel.com, yan.y.zhao@intel.com, Chao Gao , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt , Jonathan Corbet , Shuah Khan Subject: [PATCH v9 00/23] Runtime TDX module update support Date: Wed, 13 May 2026 08:09:43 -0700 Message-ID: <20260513151045.1420990-1-chao.gao@intel.com> X-Mailer: git-send-email 2.52.0 Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Dave, Thanks for your thorough review of v8. This v9 addresses the issues you pointed out. In particular, it adopts the new tdx_blob format you suggested, removes module version printing during updates, and reworks the do-while loop in the update flow to improve readability. It also adds the two cleanup patches you suggested as patches 1 and 2. Please take a look at this new version. I hope it can still be merged for 7.2. --- (For transparency, note that I used AI tools to help proofread this cover-letter and commit messages) This series adds support for runtime TDX module updates that preserve running TDX guests. It is also available at: https://github.com/gaochaointel/linux-dev/commits/tdx-module-updates-v9/ == Background == Intel TDX isolates Trusted Domains (TDs), or confidential guests, from the host. A key component of Intel TDX is the TDX module, which enforces security policies to protect the memory and CPU states of TDs from the host. However, the TDX module is software that requires updates. == Problems == Currently, the TDX module is loaded by the BIOS at boot time, and the only way to update it is through a reboot, which results in significant system downtime. Users expect the TDX module to be updatable at runtime without disrupting TDX guests. == Solution == On TDX platforms, P-SEAMLDR[1] is a component within the protected SEAM range. It is loaded by the BIOS and provides the host with functions to install a TDX module at runtime. This series implements runtime TDX module updates through the fw_upload mechanism. That interface is a good fit because TDX module selection is not a simple "load a known file from disk" problem. The update image to load depends on module versioning, compatibility rules. fw_upload lets userspace choose the module explicitly while the kernel provides the update mechanism. This design intentionally keeps most update validation/policy in userspace. The kernel exposes the information userspace needs, such as TDX module version and P-SEAMLDR information, but userspace is responsible for understanding TDX module's versioning and compatibility rules and for choosing an appropriate update image (see "TDX module versioning" below). The kernel still enforces the pieces that must be handled in-kernel: 1. Validate the tdx_blob header fields that are not passed through tothe TDX module. Just the standard overflow and reserved bits defensive ABI stuff. 2. Make sure no non-update SEAMCALLs are called during the update. 3. Make sure SEAMCALLs are on the right CPU, for any the user has made available to the kernel. 4. Handle the race between updates and concurrent TD builds by returning -EBUSY to userspace. Everything else remains a userspace responsibility. In the unlikely event the update fails, for example userspace picks an incompatible update image, or the image is otherwise corrupted, all TDs will experience SEAMCALL failures and be killed. The recovery of TD operation from that event requires a reboot. Given there is no mechanism to quiesce SEAMCALLs, the TDs themselves must pause execution over an update. The most straightforward way to meet the 'pause TDs while update executes' constraint is to run the update in stop_machine() context. All other evaluated solutions export more complexity to KVM, or exports more fragility to userspace. == How to test this series == NOTE: This v9 uses a new tdx_blob format. The scripts and module blobs in https://github.com/intel/tdx-module-binaries have not yet been updated to match this version. Those updates will be done separately later. == Other information relevant to Runtime TDX module updates == === TDX module versioning === Each TDX module is assigned a version number x.y.z, where x represents the "major" version, y the "minor" version, and z the "update" version. Runtime TDX module updates are restricted to Z-stream releases. Note that Z-stream releases do not necessarily guarantee compatibility. A new release may not be compatible with all previous versions. To address this, Intel provides a separate file containing compatibility information, which specifies the minimum module version required for a particular update. This information is referenced by the tool to determine if two modules are compatible. === TCB Stability === Updates change the TCB as viewed by attestation reports. In TDX there is a distinction between launch-time version and current version where runtime TDX module updates cause that latter version number to change, subject to Z-stream constraints. The concern that a malicious host may attack confidential VMs by loading insecure updates was addressed by Alex in [3]. Similarly, the scenario where some "theoretical paranoid tenant" in the cloud wants to audit updates and stop trusting the host after updates until audit completion was also addressed in [4]. Users not in the cloud control the host machine and can manage updates themselves, so they don't have these concerns. See more about the implications of current TCB version changes in attestation as summarized by Dave in [5]. === TDX module Distribution Model === At a high level, Intel publishes all TDX modules on the github [2], along with a mapping_file.json which documents the compatibility information about each TDX module and a userspace tool to install the TDX module. OS vendors can package these modules and distribute them. Administrators install the package and use the tool to select the appropriate TDX module and install it via the interfaces exposed by this series. [1]: https://cdrdv2.intel.com/v1/dl/getContent/733584 [2]: https://github.com/intel/tdx-module-binaries [3]: https://lore.kernel.org/all/665c5ae0-4b7c-4852-8995-255adf7b3a2f@amazon.com/ [4]: https://lore.kernel.org/all/5d1da767-491b-4077-b472-2cc3d73246d6@amazon.com/ [5]: https://lore.kernel.org/all/94d6047e-3b7c-4bc1-819c-85c16ff85abf@intel.com/ Chao Gao (22): x86/virt/tdx: Consolidate TDX global initialization states x86/virt/tdx: Move TDX_FEATURES0 bits to asm/tdx.h coco/tdx-host: Introduce a "tdx_host" device coco/tdx-host: Expose TDX module version x86/virt/seamldr: Introduce a wrapper for P-SEAMLDR SEAMCALLs x86/virt/seamldr: Add a helper to retrieve P-SEAMLDR information coco/tdx-host: Expose P-SEAMLDR information via sysfs coco/tdx-host: Don't expose P-SEAMLDR information on CPUs with erratum coco/tdx-host: Implement firmware upload sysfs ABI for TDX module updates x86/virt/seamldr: Allocate and populate a module update request x86/virt/seamldr: Introduce skeleton for TDX module updates x86/virt/seamldr: Abort updates after a failed step x86/virt/seamldr: Shut down the current TDX module x86/virt/tdx: Reset software states during TDX module shutdown x86/virt/seamldr: Install a new TDX module x86/virt/seamldr: Do TDX per-CPU initialization after module installation x86/virt/tdx: Restore TDX module state x86/virt/tdx: Refresh TDX module version after update x86/virt/tdx: Reject updates during compatibility-sensitive operations x86/virt/tdx: Enable TDX module runtime updates coco/tdx-host: Document TDX module update compatibility criteria x86/virt/tdx: Document TDX module update Kai Huang (1): x86/virt/tdx: Move low level SEAMCALL helpers out of .../ABI/testing/sysfs-devices-faux-tdx-host | 68 ++++ Documentation/arch/x86/tdx.rst | 34 ++ arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/include/asm/seamldr.h | 37 +++ arch/x86/include/asm/tdx.h | 67 ++-- arch/x86/include/asm/tdx_global_metadata.h | 4 + arch/x86/include/asm/vmx.h | 1 + arch/x86/virt/vmx/tdx/Makefile | 2 +- arch/x86/virt/vmx/tdx/seamcall_internal.h | 109 +++++++ arch/x86/virt/vmx/tdx/seamldr.c | 306 ++++++++++++++++++ arch/x86/virt/vmx/tdx/tdx.c | 162 ++++++---- arch/x86/virt/vmx/tdx/tdx.h | 8 +- arch/x86/virt/vmx/tdx/tdx_global_metadata.c | 17 +- drivers/virt/coco/Kconfig | 2 + drivers/virt/coco/Makefile | 1 + drivers/virt/coco/tdx-host/Kconfig | 12 + drivers/virt/coco/tdx-host/Makefile | 1 + drivers/virt/coco/tdx-host/tdx-host.c | 221 +++++++++++++ 18 files changed, 940 insertions(+), 113 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-devices-faux-tdx-host create mode 100644 arch/x86/include/asm/seamldr.h create mode 100644 arch/x86/virt/vmx/tdx/seamcall_internal.h create mode 100644 arch/x86/virt/vmx/tdx/seamldr.c create mode 100644 drivers/virt/coco/tdx-host/Kconfig create mode 100644 drivers/virt/coco/tdx-host/Makefile create mode 100644 drivers/virt/coco/tdx-host/tdx-host.c base-commit: 5209e5bfe5cab593476c3e7754e42c5e47ce36de -- 2.52.0