Skip to content

Commit 1e4d2ff

Browse files
committed
PCI/IDE: Add IDE establishment helpers
There are two components to establishing an encrypted link, provisioning the stream in Partner Port config-space, and programming the keys into the link layer via IDE_KM (IDE Key Management). This new library, drivers/pci/ide.c, enables the former. IDE_KM, via a TSM low-level driver, is saved for later. With the platform TSM implementations of SEV-TIO and TDX Connect in mind this library abstracts small differences in those implementations. For example, TDX Connect handles Root Port register setup while SEV-TIO expects System Software to update the Root Port registers. This is the rationale for fine-grained 'setup' + 'enable' verbs. The other design detail for TSM-coordinated IDE establishment is that the TSM may manage allocation of Stream IDs, this is why the Stream ID value is passed in to pci_ide_stream_setup(). The flow is: pci_ide_stream_alloc(): Allocate a Selective IDE Stream Register Block in each Partner Port (Endpoint + Root Port), and reserve a host bridge / platform stream slot. Gather Partner Port specific stream settings like Requester ID. pci_ide_stream_register(): Publish the stream in sysfs after allocating a Stream ID. In the TSM case the TSM allocates the Stream ID for the Partner Port pair. pci_ide_stream_setup(): Program the stream settings to a Partner Port. Caller is responsible for optionally calling this for the Root Port as well if the TSM implementation requires it. pci_ide_stream_enable(): Enable the stream after IDE_KM. In support of system administrators auditing where platform, Root Port, and Endpoint IDE stream resources are being spent, the allocated stream is reflected as a symlink from the host bridge to the endpoint with the name: stream%d.%d.%d Where the tuple of integers reflects the allocated platform, Root Port, and Endpoint stream index (Selective IDE Stream Register Block) values. Thanks to Wu Hao for a draft implementation of this infrastructure. Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Lukas Wunner <lukas@wunner.de> Cc: Samuel Ortiz <sameo@rivosinc.com> Co-developed-by: Alexey Kardashevskiy <aik@amd.com> Signed-off-by: Alexey Kardashevskiy <aik@amd.com> Co-developed-by: Xu Yilun <yilun.xu@linux.intel.com> Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Link: https://patch.msgid.link/20251031212902.2256310-8-dan.j.williams@intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 290b633 commit 1e4d2ff

6 files changed

Lines changed: 529 additions & 0 deletions

File tree

Documentation/ABI/testing/sysfs-devices-pci-host-bridge

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,17 @@ Description:
1717
PNP0A08 (/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00). See
1818
/sys/devices/pciDDDD:BB entry for details about the DDDD:BB
1919
format.
20+
21+
What: pciDDDD:BB/streamH.R.E
22+
Contact: linux-pci@vger.kernel.org
23+
Description:
24+
(RO) When a platform has established a secure connection, PCIe
25+
IDE, between two Partner Ports, this symlink appears. A stream
26+
consumes a Stream ID slot in each of the Host bridge (H), Root
27+
Port (R) and Endpoint (E). The link points to the Endpoint PCI
28+
device in the Selective IDE Stream pairing. Specifically, "R"
29+
and "E" represent the assigned Selective IDE Stream Register
30+
Block in the Root Port and Endpoint, and "H" represents a
31+
platform specific pool of stream resources shared by the Root
32+
Ports in a host bridge. See /sys/devices/pciDDDD:BB entry for
33+
details about the DDDD:BB format.

0 commit comments

Comments
 (0)