From nobody Wed Apr 1 09:45:13 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (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 CB2191A6806; Tue, 31 Mar 2026 12:43:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774961007; cv=none; b=L37uChWPkD9OvmvcSPSoCEhEKwG6W7S5UZeH9MTVhEdskrRACPs+rxt85gdayJpSbQ4m584ZYjTefQH6ZnKNrBK1eWzqiKH0iMVEUnYh07UX7jl0vxXxA+OCETII3x8brU6jWdXVzCHXKYQS0gQDvS4+etY5VJevWatm1MEWWS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774961007; c=relaxed/simple; bh=dYuo0JHU26XNwZMXq7fw/G7Hf02Vz1E1GQFgQKKjCqc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=BMRKRLRSfLnD1YFrLy4hXCpiQJBsSTVPRb3RDWKE07CCGXhV4aHMQTHc/MLD2f1fJ1PB0IN7g0XEDpI/J2Tth37E0cVZJopVlybJSiEeiirHQpk33aYqNpWCtwdyHWO8f9A0o/CLX0OKp6hz+ZadePNrfDtxHv85HG4IWtkGdfg= 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=N7RxQl2j; arc=none smtp.client-ip=192.198.163.15 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="N7RxQl2j" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1774961005; x=1806497005; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=dYuo0JHU26XNwZMXq7fw/G7Hf02Vz1E1GQFgQKKjCqc=; b=N7RxQl2jVFCaW1lA+TkpA/Kfx9wppaMst5EKR0feBfev1M1sPnqd/mEH H5MVFEez3SGtQWbShL6mIJNw6079kK4RKb52yQr2KGWDdVWZnotvLQMcE ShJpab9jWFnqL5rtaTD5XG+jXFO5ejbpyWTLzmwuWGfpvPn5JUo7eOV39 8kX1o4oPnNp9dyey1DMtp04Qz2k0ED4ljSkd7pLjOcUB36MsZBnaLnmDa UKPAdX9NiVVZbV3veH6UAznh+P2PMhw+R80vs+kbtEAszQFsuAsr+29EO iYY5Onn9fHqQfgG/yI8LtacbBYvQI9xD0B7fpPx4s1cg/yJRdVW3Npefy g==; X-CSE-ConnectionGUID: Lh9XLj5vR12Eh4iY0AlGPg== X-CSE-MsgGUID: PcuqlvG4TU6fViL57X5jkQ== X-IronPort-AV: E=McAfee;i="6800,10657,11745"; a="76084404" X-IronPort-AV: E=Sophos;i="6.23,151,1770624000"; d="scan'208";a="76084404" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2026 05:43:15 -0700 X-CSE-ConnectionGUID: Ogm76+p+Tp6j9DA+Jz8giQ== X-CSE-MsgGUID: iOQSja9jSWOyDcZKUPGqAw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,151,1770624000"; d="scan'208";a="221492076" Received: from 984fee019967.jf.intel.com ([10.23.153.244]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2026 05:43:14 -0700 From: Chao Gao To: kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, x86@kernel.org Cc: binbin.wu@linux.intel.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, 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 , Borislav Petkov , Clark Williams , "H. Peter Anvin" , Ingo Molnar , Jonathan Corbet , Sebastian Andrzej Siewior , Shuah Khan , Steven Rostedt , Thomas Gleixner Subject: [PATCH v7 00/22] Runtime TDX module update support Date: Tue, 31 Mar 2026 05:41:13 -0700 Message-ID: <20260331124214.117808-1-chao.gao@intel.com> X-Mailer: git-send-email 2.47.3 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="utf-8" Content-Transfer-Encoding: quoted-printable Hi Reviewers, This v7 is mainly to fix a few valid issues identified by Sashiko (https://sashiko.dev/#/patchset/20260326084448.29947-1-chao.gao%40intel.com) Patch 06/12/17 need a second review. All other patches have a few RBs. I believe this series is quite mature and self-contained =E2=80=94 it has n= o impact on the rest of the kernel unless an update is triggered through the dedicat= ed sysfs ABIs. I'm hoping it can be merged for 7.1. Changelog: v6->v7: - rebase onto the latest tip/x86/tdx branch - move TDX_VERSION_FMT to and use it in all version prints - only refresh update_version post-update since major/minor don't change across updates - use TDX_MODULE_ERROR instead of TDX_MODULE_UNINITIALIZED after shutdown to prevent re-initialization - add error logging for TDH_SYS_SHUTDOWN failure - hold cpus_read_lock() before updates to prevent CPU hotplug race - validate blob signature, reserved fields, and 4KB alignment - fix documentation typos - other minor comment and changelog improvements - collect review tags from Kiryl/Xiaoyao - v6: https://lore.kernel.org/kvm/20260326084448.29947-1-chao.gao@intel.co= m/ (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-v7/ =3D=3D Background =3D=3D 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. =3D=3D Problems =3D=3D 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. =3D=3D Solution =3D=3D 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. Implement a TDX module update facility via the fw_upload mechanism. Given that there is variability in which module update to load based on features, fix levels, and potentially reloading the same version for error recovery scenarios, the explicit userspace chosen payload flexibility of fw_upload is attractive. This design allows the kernel to accept a bitstream instead of loading a named file from the filesystem, as the module selection and policy enforcement for TDX modules are quite complex (see patch "coco/tdx-host: Implement firmware upload sysfs ABI for TDX module updates"). By doing so, much of this complexity is shifted out of the kernel. The kernel needs to expose information, such as the TDX module version, to userspace. Userspace must understand the TDX module versioning scheme and update policy to select the appropriate TDX module (see "TDX module Versioning" below). 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. =3D=3D How to test this series =3D=3D First, load kvm-intel.ko and tdx-host.ko if they haven't been loaded: # modprobe -r kvm_intel # modprobe kvm_intel tdx=3D1 # modprobe tdx-host Then, use the userspace tool below to select the appropriate TDX module and install it via the interfaces exposed by this series: # git clone https://github.com/intel/tdx-module-binaries # cd tdx-module-binaries # python version_select_and_load.py --update this version changes the firmware directory name from seamldr_upload to tdx_module, so, below change should be applied to version_select_and_load.p= y: diff --git a/version_select_and_load.py b/version_select_and_load.py index 2193bd8..6a3b604 100644 --- a/version_select_and_load.py +++ b/version_select_and_load.py @@ -38,7 +38,7 @@ except ImportError: print("Error: cpuid module is not installed. Please install it using '= pip install cpuid'") sys.exit(1) -FIRMWARE_PATH =3D "/sys/class/firmware/seamldr_upload" +FIRMWARE_PATH =3D "/sys/class/firmware/tdx_module" MODULE_PATH =3D "/sys/devices/faux/tdx_host" SEAMLDR_PATH =3D "/sys/devices/faux/tdx_host/seamldr" allow_debug =3D False =3D=3D Other information relevant to Runtime TDX module updates =3D=3D =3D=3D=3D TDX module versioning =3D=3D=3D 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 th= is, 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. =3D=3D=3D TCB Stability =3D=3D=3D 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]. =3D=3D=3D TDX module Distribution Model =3D=3D=3D 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@amazo= n.com/ [4]: https://lore.kernel.org/all/5d1da767-491b-4077-b472-2cc3d73246d6@amazo= n.com/ [5]: https://lore.kernel.org/all/94d6047e-3b7c-4bc1-819c-85c16ff85abf@intel= .com/ Chao Gao (21): 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: 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 if errors occurred midway 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 updates x86/virt/tdx: Restore TDX module state x86/virt/tdx: Update tdx_sysinfo and check features post-update x86/virt/tdx: Avoid updates during update-sensitive operations coco/tdx-host: Don't expose P-SEAMLDR features on CPUs with erratum x86/virt/tdx: Enable TDX module runtime updates coco/tdx-host: Document TDX module update compatibility criteria x86/virt/tdx: Document TDX module update x86/virt/seamldr: Log TDX module update failures Kai Huang (1): x86/virt/tdx: Move low level SEAMCALL helpers out of .../ABI/testing/sysfs-devices-faux-tdx-host | 75 ++++ Documentation/arch/x86/tdx.rst | 36 ++ arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/include/asm/seamldr.h | 37 ++ arch/x86/include/asm/tdx.h | 70 +--- arch/x86/include/asm/tdx_global_metadata.h | 5 + arch/x86/include/asm/vmx.h | 1 + arch/x86/kvm/vmx/tdx_errno.h | 2 - arch/x86/virt/vmx/tdx/Makefile | 2 +- arch/x86/virt/vmx/tdx/seamcall_internal.h | 109 ++++++ arch/x86/virt/vmx/tdx/seamldr.c | 359 ++++++++++++++++++ arch/x86/virt/vmx/tdx/tdx.c | 173 ++++++--- arch/x86/virt/vmx/tdx/tdx.h | 11 +- arch/x86/virt/vmx/tdx/tdx_global_metadata.c | 22 +- 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 | 244 ++++++++++++ 19 files changed, 1059 insertions(+), 104 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: 87d034b5b9f36c66bf02af587fb6935af88ffbf1 --=20 2.47.3