Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

PCI/TSM: Report active IDE streams

Given that the platform TSM owns IDE Stream ID allocation, report the
active streams via the TSM class device. Establish a symlink from the
class device to the PCI endpoint device consuming the stream, named by
the Stream ID.

Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Alexey Kardashevskiy <aik@amd.com>
Link: https://patch.msgid.link/20251031212902.2256310-10-dan.j.williams@intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>

+47
+10
Documentation/ABI/testing/sysfs-class-tsm
··· 7 7 signals when the PCI layer is able to support establishment of 8 8 link encryption and other device-security features coordinated 9 9 through a platform tsm. 10 + 11 + What: /sys/class/tsm/tsmN/streamH.R.E 12 + Contact: linux-pci@vger.kernel.org 13 + Description: 14 + (RO) When a host bridge has established a secure connection via 15 + the platform TSM, symlink appears. The primary function of this 16 + is have a system global review of TSM resource consumption 17 + across host bridges. The link points to the endpoint PCI device 18 + and matches the same link published by the host bridge. See 19 + Documentation/ABI/testing/sysfs-devices-pci-host-bridge.
+4
drivers/pci/ide.c
··· 11 11 #include <linux/pci_regs.h> 12 12 #include <linux/slab.h> 13 13 #include <linux/sysfs.h> 14 + #include <linux/tsm.h> 14 15 15 16 #include "pci.h" 16 17 ··· 261 260 262 261 if (ide->partner[PCI_IDE_EP].enable) 263 262 pci_ide_stream_disable(pdev, ide); 263 + 264 + if (ide->tsm_dev) 265 + tsm_ide_stream_unregister(ide); 264 266 265 267 if (ide->partner[PCI_IDE_RP].setup) 266 268 pci_ide_stream_teardown(rp, ide);
+28
drivers/virt/coco/tsm-core.c
··· 4 4 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 5 5 6 6 #include <linux/tsm.h> 7 + #include <linux/pci.h> 7 8 #include <linux/rwsem.h> 8 9 #include <linux/device.h> 9 10 #include <linux/module.h> 10 11 #include <linux/cleanup.h> 11 12 #include <linux/pci-tsm.h> 13 + #include <linux/pci-ide.h> 12 14 13 15 static struct class *tsm_class; 14 16 static DECLARE_RWSEM(tsm_rwsem); ··· 107 105 device_unregister(&tsm_dev->dev); 108 106 } 109 107 EXPORT_SYMBOL_GPL(tsm_unregister); 108 + 109 + /* must be invoked between tsm_register / tsm_unregister */ 110 + int tsm_ide_stream_register(struct pci_ide *ide) 111 + { 112 + struct pci_dev *pdev = ide->pdev; 113 + struct pci_tsm *tsm = pdev->tsm; 114 + struct tsm_dev *tsm_dev = tsm->tsm_dev; 115 + int rc; 116 + 117 + rc = sysfs_create_link(&tsm_dev->dev.kobj, &pdev->dev.kobj, ide->name); 118 + if (rc) 119 + return rc; 120 + 121 + ide->tsm_dev = tsm_dev; 122 + return 0; 123 + } 124 + EXPORT_SYMBOL_GPL(tsm_ide_stream_register); 125 + 126 + void tsm_ide_stream_unregister(struct pci_ide *ide) 127 + { 128 + struct tsm_dev *tsm_dev = ide->tsm_dev; 129 + 130 + ide->tsm_dev = NULL; 131 + sysfs_remove_link(&tsm_dev->dev.kobj, ide->name); 132 + } 133 + EXPORT_SYMBOL_GPL(tsm_ide_stream_unregister); 110 134 111 135 static void tsm_release(struct device *dev) 112 136 {
+2
include/linux/pci-ide.h
··· 50 50 * @host_bridge_stream: allocated from host bridge @ide_stream_ida pool 51 51 * @stream_id: unique Stream ID (within Partner Port pairing) 52 52 * @name: name of the established Selective IDE Stream in sysfs 53 + * @tsm_dev: For TSM established IDE, the TSM device context 53 54 * 54 55 * Negative @stream_id values indicate "uninitialized" on the 55 56 * expectation that with TSM established IDE the TSM owns the stream_id ··· 62 61 u8 host_bridge_stream; 63 62 int stream_id; 64 63 const char *name; 64 + struct tsm_dev *tsm_dev; 65 65 }; 66 66 67 67 void pci_ide_set_nr_streams(struct pci_host_bridge *hb, u16 nr);
+3
include/linux/tsm.h
··· 123 123 struct tsm_dev *tsm_register(struct device *parent, struct pci_tsm_ops *ops); 124 124 void tsm_unregister(struct tsm_dev *tsm_dev); 125 125 struct tsm_dev *find_tsm_dev(int id); 126 + struct pci_ide; 127 + int tsm_ide_stream_register(struct pci_ide *ide); 128 + void tsm_ide_stream_unregister(struct pci_ide *ide); 126 129 #endif /* __TSM_H */