Skip to content

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

Xu Yilun kvm linux-coco linux-mm linux-pci 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest26 patches 46 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/26coco/tdx-host: Introduce a "tdx_host" devicedrivers/virt/coco/Kconfig drivers/virt/coco/Makefile drivers/virt/coco/tdx-host/Kconfig +2 more+55 -01 reply
2/26x86/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/26coco/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+160 -11 reply
4/26x86/tdx: Move all TDX error defines into <asm/shared/tdx_errno.h>arch/x86/include/asm/shared/tdx.h arch/x86/include/asm/shared/tdx_errno.h arch/x86/include/asm/tdx.h +1 more+22 -270 replies
5/26mm: Add __free() support for __free_page()include/linux/gfp.h+1 -02 replies
6/26x86/virt/tdx: Add tdx_page_array helpers for new TDX Module objectsarch/x86/include/asm/tdx.h arch/x86/virt/vmx/tdx/tdx.c+269 -012 replies
7/26x86/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 -02 replies
8/26x86/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+181 -1312 replies
9/26ACPICA: Add KEYP table definitioninclude/acpi/actbl2.h+59 -00 replies
10/26acpi: Add KEYP support to fw_table parsingdrivers/acpi/tables.c include/linux/acpi.h include/linux/fw_table.h +1 more+24 -11 reply
11/26iommu/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 -52 replies
12/26iommu/vt-d: Reserve the MSB domain ID bit for the TDX moduledrivers/iommu/intel/dmar.c drivers/iommu/intel/iommu.h+52 -12 replies
13/26x86/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
14/26mm: Add __free() support for folio_put()include/linux/mm.h+2 -02 replies
15/26x86/virt/tdx: Extend tdx_page_array to support IOMMU_MTarch/x86/include/asm/tdx.h arch/x86/virt/vmx/tdx/tdx.c+70 -31 reply
16/26x86/virt/tdx: Add a helper to loop on TDX_INTERRUPTED_RESUMABLEarch/x86/virt/vmx/tdx/tdx.c+23 -00 replies
17/26x86/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+34 -20 replies
18/26iommu/vt-d: Export a helper to do function for each dmar_drhd_unitdrivers/iommu/intel/dmar.c include/linux/dmar.h+18 -00 replies
19/26coco/tdx-host: Setup all trusted IOMMUs on TDX Connect initdrivers/virt/coco/tdx-host/tdx-host.c+85 -00 replies
20/26coco/tdx-host: Add a helper to exchange SPDM messages through DOEdrivers/virt/coco/tdx-host/tdx-host.c+61 -00 replies
21/26x86/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+130 -20 replies
22/26coco/tdx-host: Implement SPDM session setuparch/x86/include/asm/shared/tdx_errno.h drivers/virt/coco/tdx-host/tdx-host.c+299 -40 replies
23/26coco/tdx-host: Parse ACPI KEYP table to init IDE for PCI host bridgesdrivers/virt/coco/tdx-host/Kconfig drivers/virt/coco/tdx-host/tdx-host.c+112 -01 reply
24/26x86/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+104 -00 replies
25/26coco/tdx-host: Implement IDE stream setup/teardowndrivers/pci/ide.c drivers/virt/coco/tdx-host/tdx-host.c include/linux/pci-ide.h+230 -20 replies
26/26coco/tdx-host: Finally enable SPDM session and IDE Establishmentdrivers/virt/coco/tdx-host/tdx-host.c+3 -72 replies

Reviews trailers per patch

8 of 26 patches have a Reviewed-by or Acked-by.

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

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

Read the v1 thread

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

This is a new version of the RFC [1]. It is based on Dan's "Link" TSM Core infrastructure [2][3] + Sean's VMXON RFC [4]. All together they enable the SPDM Session and IDE Establishment for TDX Connect. This series and its base commits are available in Dan's tsm.git#staging [5].

Changes since public RFC:
- No tdx_enable() needed in tdx-host
- Simplify tdx_page_array kAPI, no singleton mode input
- Refactor the handling of TDX_INTERRUPTED_RESUMABLE
- Refine the usage of scope-based cleanup in tdx-host
- Set nr_stream_id in tdx-host, not in PCI ACPI initialization
- Use KEYP table + ECAP bit50 to decide Domain ID reservation
- Refactor IDE Address Association Register setup
- Remove prototype patches
- Refactor tdx_enable_ext() locking because of Sean's change
- Pick ACPICA KEYP patch from ACPICA repo
- Select TDX Connect feature for TDH.SYS.CONFIG, remove temporary solution for TDH.SYS.INIT
- Use Rick's tdx_errno.h movement patch [6]
- Factor out scope-based cleanup patches in mm
- Remove redunant header files, add header files only when first used
- Use dev_err_probe() when possible
- keyp_info_match() refactor
- Use bitfield.h macros for PAGE_LIST_INFO & HPA_ARRAY_T raw value
- Remove reserved fields for spdm_config_info_t
- Simplify return for tdh_ide_stream_block()
- Other small fixes for Jonathan's comments

[1]: https://lore.kernel.org/linux-coco/[email protected]/
[2]: https://lore.kernel.org/linux-coco/[email protected]/
[3]: https://lore.kernel.org/linux-coco/[email protected]/
[4]: https://lore.kernel.org/all/[email protected]/
[5]: https://git.kernel.org/pub/scm/linux/kernel/git/devsec/tsm.git/log/?h=staging
[6]: https://lore.kernel.org/all/[email protected]/

Trimmed Original Cover letter:
-------------------------------

Add a PCI/TSM low-level driver implemenation for TDX Connect (the TEE I/O architecture for Intel platforms). Recall that PCI/TSM 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).

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.

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

Dave Jiang (2):
ACPICA: Add KEYP table definition
acpi: Add KEYP support to fw_table parsing

Kirill A. Shutemov (1):
x86/tdx: Move all TDX error defines into <asm/shared/tdx_errno.h>

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 (15):
x86/virt/tdx: Move bit definitions of TDX_FEATURES0 to public header coco/tdx-host: Support Link TSM for TDX host
mm: Add __free() support for __free_page()
x86/virt/tdx: Add tdx_page_array helpers for new TDX Module objects x86/virt/tdx: Read TDX global metadata for TDX Module Extensions x86/virt/tdx: Read TDX Connect global metadata for TDX Connect
mm: Add __free() support for folio_put()
x86/virt/tdx: Extend tdx_page_array to support IOMMU_MT x86/virt/tdx: Add a helper to loop on TDX_INTERRUPTED_RESUMABLE 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: Parse ACPI KEYP table to init IDE for PCI host bridges x86/virt/tdx: Add SEAMCALL wrappers for IDE stream management coco/tdx-host: Implement IDE stream setup/teardown coco/tdx-host: Finally enable SPDM session and IDE Establishment

Zhenzhong Duan (5):
x86/virt/tdx: Add tdx_enable_ext() to enable of TDX Module Extensions 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

 drivers/virt/coco/Kconfig                     |   2 +
 drivers/virt/coco/tdx-host/Kconfig            |  17 +
 drivers/virt/coco/Makefile                    |   1 +
 drivers/virt/coco/tdx-host/Makefile           |   1 +
 arch/x86/include/asm/shared/tdx.h             |   1 +
 .../vmx => include/asm/shared}/tdx_errno.h    |  29 +-
 arch/x86/include/asm/tdx.h                    |  76 +-
 arch/x86/include/asm/tdx_global_metadata.h    |  14 +
 arch/x86/kvm/vmx/tdx.h                        |   1 -
 arch/x86/virt/vmx/tdx/tdx.h                   |  16 +-
 drivers/iommu/intel/iommu.h                   |   2 +
 include/acpi/actbl2.h                         |  59 ++
 include/linux/acpi.h                          |   3 +
 include/linux/dmar.h                          |   2 +
 include/linux/fw_table.h                      |   1 +
 include/linux/gfp.h                           |   1 +
 include/linux/mm.h                            |   2 +
 include/linux/pci-ide.h                       |   2 +
 arch/x86/virt/vmx/tdx/tdx.c                   | 740 ++++++++++++-
 arch/x86/virt/vmx/tdx/tdx_global_metadata.c   |  32 +
 drivers/acpi/tables.c                         |  12 +-
 drivers/iommu/intel/dmar.c                    |  67 ++
 drivers/iommu/intel/iommu.c                   |  10 +-
 drivers/pci/ide.c                             |   5 +-
 drivers/virt/coco/tdx-host/tdx-host.c         | 969 ++++++++++++++++++
 lib/fw_table.c                                |   9 +
 26 files changed, 2027 insertions(+), 47 deletions(-)
 create mode 100644 drivers/virt/coco/tdx-host/Kconfig
 create mode 100644 drivers/virt/coco/tdx-host/Makefile
 rename arch/x86/{kvm/vmx => include/asm/shared}/tdx_errno.h (62%)
 create mode 100644 drivers/virt/coco/tdx-host/tdx-host.c
Signature · 1 line
2.25.1