Skip to content

RFC PCI/TSM: TDX Connect: SPDM Session and IDE Establishment

Dan Williams linux-coco linux-pci 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest27 patches 31 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/27coco/tdx-host: Introduce a "tdx_host" devicedrivers/virt/coco/Kconfig drivers/virt/coco/Makefile drivers/virt/coco/tdx-host/Kconfig +2 more+66 -02 replies
2/27x86/virt/tdx: Move bit definitions of TDX_FEATURES0 to public headerarch/x86/include/asm/tdx.h arch/x86/virt/vmx/tdx/tdx.h+4 -30 replies
3/27coco/tdx-host: Support Link TSM for TDX hostarch/x86/include/asm/tdx.h drivers/virt/coco/tdx-host/Kconfig drivers/virt/coco/tdx-host/tdx-host.c+151 -12 replies
4/27x86/virt/tdx: Move tdx_errno.h from KVM to public placearch/x86/include/asm/tdx.h arch/x86/include/asm/tdx_errno.h arch/x86/kvm/vmx/tdx.h+4 -41 reply
5/27x86/virt/tdx: Add tdx_page_array helpers for new TDX Module objectsarch/x86/include/asm/tdx.h arch/x86/virt/vmx/tdx/tdx.c include/linux/gfp.h+241 -02 replies
6/27x86/virt/tdx: Add SEAMCALL wrappers for TDH.EXT.MEM.ADD and TDH.EXT.INITarch/x86/include/asm/tdx.h arch/x86/virt/vmx/tdx/tdx.c arch/x86/virt/vmx/tdx/tdx.h+53 -00 replies
7/27TODO: x86/virt/tdx: Read TDX global metadata for TDX Module Extensionsarch/x86/include/asm/tdx_global_metadata.h arch/x86/virt/vmx/tdx/tdx_global_metadata.c+20 -00 replies
8/27x86/virt/tdx: Add tdx_enable_ext() to enable of TDX Module Extensionsarch/x86/include/asm/tdx.h arch/x86/virt/vmx/tdx/tdx.c arch/x86/virt/vmx/tdx/tdx.h +1 more+155 -82 replies
9/27ACPICA: Add KEYP table definitionsinclude/acpi/actbl3.h+60 -02 replies
10/27acpi: Add KEYP support to fw_table parsingdrivers/acpi/Kconfig drivers/acpi/tables.c include/linux/acpi.h +2 more+48 -10 replies
11/27acpi: Add KEYP Key Configuration Unit parsingdrivers/acpi/Makefile drivers/acpi/pci_root.c drivers/acpi/x86/keyp.c +2 more+126 -02 replies
12/27iommu/vt-d: Cache max domain ID to avoid redundant calculationdrivers/iommu/intel/dmar.c drivers/iommu/intel/iommu.c drivers/iommu/intel/iommu.h+7 -50 replies
13/27iommu/vt-d: Reserve the MSB domain ID bit for the TDX moduledrivers/iommu/intel/dmar.c+28 -10 replies
14/27TODO: x86/virt/tdx: Read TDX Connect global metadata for TDX Connectarch/x86/include/asm/tdx_global_metadata.h arch/x86/virt/vmx/tdx/tdx_global_metadata.c+26 -00 replies
15/27x86/virt/tdx: Extend tdx_page_array to support IOMMU_MTarch/x86/include/asm/tdx.h arch/x86/virt/vmx/tdx/tdx.c include/linux/mm.h+77 -61 reply
16/27x86/virt/tdx: Add SEAMCALL wrappers for trusted IOMMU setup and cleararch/x86/include/asm/tdx.h arch/x86/virt/vmx/tdx/tdx.c arch/x86/virt/vmx/tdx/tdx.h+32 -00 replies
17/27iommu/vt-d: Export a helper to do function for each dmar_drhd_unitdrivers/iommu/intel/dmar.c include/linux/dmar.h+18 -00 replies
18/27coco/tdx-host: Setup all trusted IOMMUs on TDX Connect initdrivers/virt/coco/tdx-host/tdx-host.c+90 -01 reply
19/27coco/tdx-host: Add a helper to exchange SPDM messages through DOEdrivers/virt/coco/tdx-host/tdx-host.c+61 -01 reply
20/27coco/tdx-host: Add connect()/disconnect() handlers prototypedrivers/virt/coco/tdx-host/tdx-host.c+48 -18 replies
21/27x86/virt/tdx: Add SEAMCALL wrappers for SPDM managementarch/x86/include/asm/tdx.h arch/x86/virt/vmx/tdx/tdx.c arch/x86/virt/vmx/tdx/tdx.h+149 -02 replies
22/27coco/tdx-host: Implement SPDM session setuparch/x86/include/asm/tdx_errno.h drivers/virt/coco/tdx-host/tdx-host.c+276 -12 replies
23/27PCI: iov: Export pci_iov_virtfn_bus()drivers/pci/iov.c+1 -00 replies
24/27PCI/IDE: Add helpers for RID/Addr Association Registers setupinclude/linux/pci-ide.h+14 -00 replies
25/27PCI/IDE: Export pci_ide_domain()drivers/pci/ide.c include/linux/pci-ide.h+3 -10 replies
26/27x86/virt/tdx: Add SEAMCALL wrappers for IDE stream managementarch/x86/include/asm/tdx.h arch/x86/virt/vmx/tdx/tdx.c arch/x86/virt/vmx/tdx/tdx.h+109 -01 reply
27/27coco/tdx-host: Implement IDE stream setup/teardowndrivers/virt/coco/tdx-host/tdx-host.c+270 -12 replies

Reviews trailers per patch

2 of 27 patches have a Reviewed-by or Acked-by.

PatchJonathan CameronDan Williams
1/27
2/27
3/27
4/27
5/27
6/27
7/27
8/27
9/27
10/27
11/27
12/27
13/27
14/27
15/27
16/27
17/27
18/27
19/27R-b
20/27A-b
21/27
22/27
23/27
24/27
25/27
26/27
27/27

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC PATCH 00/27] PCI/TSM: TDX Connect: SPDM Session and IDE Establishment

Add a PCI/TSM low-level driver implemenation for TDX Connect (the TEE I/O architecture for Intel platforms). Recall that PCI/TSM [1] is the Linux PCI core subsystem for interfacing with platform Trusted Execution Environment (TEE) Security Managers (TSMs). TSMs establish secure sessions with PCIe devices (SPDM over Data Object Exchange (DOE) mailboxes) and establish PCIe link Integrity and Data Encryption (IDE).

The motivation for sending this out as an RFC with open TODOs beyond "release early, release often" is:

- Get out of the phase of PCI/TSM core updates being done with only samples/devsec/ testing, i.e. avoid regressions like [2]

- Enable better collaboration on follow on common infrastructure like address association setup

- Take another step closer to the "at least two vendor implementations in #staging" threshold in a potential first intercept of v6.19.

This SPDM and IDE facility is enabled with TDX via a new capability called a TDX Module Extension. An extension, as might be expected, is a family of new seamcalls. Unlike typical base module seamcalls, an extension supports preemptible calls for long running flows like SPDM session establishment. This extension capability was added in response to Intel Linux team feedback and in support of reducing the complexity of the Linux implementation. The result is sequences like the following:

        guard(mutex)(&tdx_ext_lock);
        do {
                r = tdh_spdm_connect(tlink->spdm_id, tlink->spdm_conf,
                                     tlink->in_msg, tlink->out_msg,
                                     dev_info, &out_msg_sz);
                ret = tdx_link_event_handler(tlink, r, out_msg_sz);
        } while (ret == -EAGAIN);

...where tdh_spdm_connect() is a seamcall that may return early if this CPU takes a hardirq or if the module needs a DOE message marshalled to the device. tdx_link_event_handler() marshals the message and the extension is resumed to continue the flow. In this case the TDX Connect extension supports 1 caller at a time, think of it like a queue-depth of one device-firmware command queue, so concurrency is managed with @tdx_ext_lock.

This series and its base commit are available in tsm.git#tdx [3]. The base commit includes devsec-20250911 and two in progress proposals, "always enable VMX", and "refactor TDX CPU enabling into tdx_enable()". I am holding off on putting this series in #staging because that VMX work also includes an untested proposed cleanup to AMD SVM. If someone has cycles to test this commit on AMD it would be greatly appreciated:

9d5a519d61d3 x86/boot, KVM: SVM: Move enabling/disabling SVM to CPU startup/shutdown phase

Not posting those proposals for now to focus on the PCI/TSM aspects of this and save the deeper KVM implications of "TDX Host Services", for a later time.

[1]: PCI/TSM: Core infrastructure for PCI device security (TDISP)

     http://lore.kernel.org/[email protected]

[2]: http://lore.kernel.org/[email protected]
[3]: https://git.kernel.org/pub/scm/linux/kernel/git/devsec/tsm.git/log/?h=tdx

Chao Gao (1):
coco/tdx-host: Introduce a "tdx_host" device

Dave Jiang (3):
ACPICA: Add KEYP table definitions
acpi: Add KEYP support to fw_table parsing
acpi: Add KEYP Key Configuration Unit parsing

Lu Baolu (2):
iommu/vt-d: Cache max domain ID to avoid redundant calculation iommu/vt-d: Reserve the MSB domain ID bit for the TDX module

Xu Yilun (16):
x86/virt/tdx: Move bit definitions of TDX_FEATURES0 to public header coco/tdx-host: Support Link TSM for TDX host
x86/virt/tdx: Move tdx_errno.h from KVM to public place x86/virt/tdx: Add tdx_page_array helpers for new TDX Module objects
TODO: x86/virt/tdx: Read TDX global metadata for TDX Module Extensions x86/virt/tdx: Add tdx_enable_ext() to enable of TDX Module Extensions
TODO: x86/virt/tdx: Read TDX Connect global metadata for TDX Connect x86/virt/tdx: Extend tdx_page_array to support IOMMU_MT iommu/vt-d: Export a helper to do function for each dmar_drhd_unit coco/tdx-host: Setup all trusted IOMMUs on TDX Connect init coco/tdx-host: Add connect()/disconnect() handlers prototype
PCI: iov: Export pci_iov_virtfn_bus()
PCI/IDE: Add helpers for RID/Addr Association Registers setup PCI/IDE: Export pci_ide_domain()
x86/virt/tdx: Add SEAMCALL wrappers for IDE stream management coco/tdx-host: Implement IDE stream setup/teardown

Zhenzhong Duan (5):
x86/virt/tdx: Add SEAMCALL wrappers for TDH.EXT.MEM.ADD and
TDH.EXT.INIT
x86/virt/tdx: Add SEAMCALL wrappers for trusted IOMMU setup and clear coco/tdx-host: Add a helper to exchange SPDM messages through DOE x86/virt/tdx: Add SEAMCALL wrappers for SPDM management coco/tdx-host: Implement SPDM session setup

 arch/x86/include/asm/tdx.h                    |  58 ++
 arch/x86/{kvm/vmx => include/asm}/tdx_errno.h |   8 +-
 arch/x86/include/asm/tdx_global_metadata.h    |  14 +
 arch/x86/kvm/vmx/tdx.h                        |   1 -
 arch/x86/virt/vmx/tdx/tdx.c                   | 731 +++++++++++++-
 arch/x86/virt/vmx/tdx/tdx.h                   |  17 +-
 arch/x86/virt/vmx/tdx/tdx_global_metadata.c   |  32 +
 drivers/acpi/Kconfig                          |  12 +
 drivers/acpi/Makefile                         |   2 +
 drivers/acpi/pci_root.c                       |   2 +
 drivers/acpi/tables.c                         |  14 +-
 drivers/acpi/x86/keyp.c                       | 118 +++
 drivers/iommu/intel/dmar.c                    |  44 +
 drivers/iommu/intel/iommu.c                   |  10 +-
 drivers/iommu/intel/iommu.h                   |   1 +
 drivers/pci/ide.c                             |   3 +-
 drivers/pci/iov.c                             |   1 +
 drivers/virt/coco/Kconfig                     |   2 +
 drivers/virt/coco/Makefile                    |   1 +
 drivers/virt/coco/tdx-host/Kconfig            |  17 +
 drivers/virt/coco/tdx-host/Makefile           |   1 +
 drivers/virt/coco/tdx-host/tdx-host.c         | 942 ++++++++++++++++++
 include/acpi/actbl3.h                         |  60 ++
 include/linux/acpi.h                          |  16 +
 include/linux/dmar.h                          |   2 +
 include/linux/fw_table.h                      |   1 +
 include/linux/gfp.h                           |   2 +
 include/linux/mm.h                            |   2 +
 include/linux/pci-ide.h                       |  15 +
 lib/fw_table.c                                |   9 +
 30 files changed, 2121 insertions(+), 17 deletions(-)
 rename arch/x86/{kvm/vmx => include/asm}/tdx_errno.h (87%)
 create mode 100644 drivers/acpi/x86/keyp.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: 0d1fbc1f1b7a3c8b14a643303dd89bcc82d3fbd0

Signature · 1 line
2.51.0