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

Merge tag 'tsm-fixes-for-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/devsec/tsm

Pull TSM (TEE security Manager) fixes from Dan Williams:
"The largest change is reverting part of an ABI that never shipped in a
released kernel (Documentation/ABI/testing/sysfs-class-tsm). The fix /
replacement for that is too large to squeeze in at this late date.

The rest is a collection of small fixups:

- Fix multiple streams per host bridge for SEV-TIO

- Drop the TSM ABI for reporting IDE streams (to be replaced)

- Fix virtual function enumeration

- Fix reserved stream ID initialization

- Fix unused variable compiler warning"

* tag 'tsm-fixes-for-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/devsec/tsm:
crypto/ccp: Allow multiple streams on the same root bridge
crypto/ccp: Use PCI bridge defaults for IDE
coco/tsm: Remove unused variable tsm_rwsem
PCI/IDE: Fix reading a wrong reg for unused sel stream initialization
PCI/IDE: Fix off by one error calculating VF RID range
Revert "PCI/TSM: Report active IDE streams"

+5 -67
-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.
+1 -14
drivers/crypto/ccp/sev-dev-tsm.c
··· 19 19 20 20 MODULE_IMPORT_NS("PCI_IDE"); 21 21 22 - #define TIO_DEFAULT_NR_IDE_STREAMS 1 23 - 24 - static uint nr_ide_streams = TIO_DEFAULT_NR_IDE_STREAMS; 25 - module_param_named(ide_nr, nr_ide_streams, uint, 0644); 26 - MODULE_PARM_DESC(ide_nr, "Set the maximum number of IDE streams per PHB"); 27 - 28 22 #define dev_to_sp(dev) ((struct sp_device *)dev_get_drvdata(dev)) 29 23 #define dev_to_psp(dev) ((struct psp_device *)(dev_to_sp(dev)->psp_data)) 30 24 #define dev_to_sev(dev) ((struct sev_device *)(dev_to_psp(dev)->sev_data)) ··· 187 193 static int stream_alloc(struct pci_dev *pdev, struct pci_ide **ide, 188 194 unsigned int tc) 189 195 { 190 - struct pci_dev *rp = pcie_find_root_port(pdev); 191 196 struct pci_ide *ide1; 192 197 193 198 if (ide[tc]) { ··· 194 201 return -EBUSY; 195 202 } 196 203 197 - /* FIXME: find a better way */ 198 - if (nr_ide_streams != TIO_DEFAULT_NR_IDE_STREAMS) 199 - pci_notice(pdev, "Enable non-default %d streams", nr_ide_streams); 200 - pci_ide_set_nr_streams(to_pci_host_bridge(rp->bus->bridge), nr_ide_streams); 201 - 202 204 ide1 = pci_ide_stream_alloc(pdev); 203 205 if (!ide1) 204 206 return -EFAULT; 205 207 206 - /* Blindly assign streamid=0 to TC=0, and so on */ 207 - ide1->stream_id = tc; 208 + ide1->stream_id = ide1->host_bridge_stream; 208 209 209 210 ide[tc] = ide1; 210 211
+3 -7
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> 15 14 16 15 #include "pci.h" 17 16 ··· 167 168 for (u16 i = 0; i < nr_streams; i++) { 168 169 int pos = __sel_ide_offset(ide_cap, nr_link_ide, i, nr_ide_mem); 169 170 170 - pci_read_config_dword(pdev, pos + PCI_IDE_SEL_CAP, &val); 171 + pci_read_config_dword(pdev, pos + PCI_IDE_SEL_CTL, &val); 171 172 if (val & PCI_IDE_SEL_CTL_EN) 172 173 continue; 173 174 val &= ~PCI_IDE_SEL_CTL_ID; ··· 282 283 /* for SR-IOV case, cover all VFs */ 283 284 num_vf = pci_num_vf(pdev); 284 285 if (num_vf) 285 - rid_end = PCI_DEVID(pci_iov_virtfn_bus(pdev, num_vf), 286 - pci_iov_virtfn_devfn(pdev, num_vf)); 286 + rid_end = PCI_DEVID(pci_iov_virtfn_bus(pdev, num_vf - 1), 287 + pci_iov_virtfn_devfn(pdev, num_vf - 1)); 287 288 else 288 289 rid_end = pci_dev_id(pdev); 289 290 ··· 371 372 372 373 if (ide->partner[PCI_IDE_EP].enable) 373 374 pci_ide_stream_disable(pdev, ide); 374 - 375 - if (ide->tsm_dev) 376 - tsm_ide_stream_unregister(ide); 377 375 378 376 if (ide->partner[PCI_IDE_RP].setup) 379 377 pci_ide_stream_teardown(rp, ide);
-30
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> 8 - #include <linux/rwsem.h> 9 7 #include <linux/device.h> 10 8 #include <linux/module.h> 11 9 #include <linux/cleanup.h> 12 10 #include <linux/pci-tsm.h> 13 - #include <linux/pci-ide.h> 14 11 15 12 static struct class *tsm_class; 16 - static DECLARE_RWSEM(tsm_rwsem); 17 13 static DEFINE_IDA(tsm_ida); 18 14 19 15 static int match_id(struct device *dev, const void *data) ··· 103 107 device_unregister(&tsm_dev->dev); 104 108 } 105 109 EXPORT_SYMBOL_GPL(tsm_unregister); 106 - 107 - /* must be invoked between tsm_register / tsm_unregister */ 108 - int tsm_ide_stream_register(struct pci_ide *ide) 109 - { 110 - struct pci_dev *pdev = ide->pdev; 111 - struct pci_tsm *tsm = pdev->tsm; 112 - struct tsm_dev *tsm_dev = tsm->tsm_dev; 113 - int rc; 114 - 115 - rc = sysfs_create_link(&tsm_dev->dev.kobj, &pdev->dev.kobj, ide->name); 116 - if (rc) 117 - return rc; 118 - 119 - ide->tsm_dev = tsm_dev; 120 - return 0; 121 - } 122 - EXPORT_SYMBOL_GPL(tsm_ide_stream_register); 123 - 124 - void tsm_ide_stream_unregister(struct pci_ide *ide) 125 - { 126 - struct tsm_dev *tsm_dev = ide->tsm_dev; 127 - 128 - ide->tsm_dev = NULL; 129 - sysfs_remove_link(&tsm_dev->dev.kobj, ide->name); 130 - } 131 - EXPORT_SYMBOL_GPL(tsm_ide_stream_unregister); 132 110 133 111 static void tsm_release(struct device *dev) 134 112 {
+1 -3
include/linux/pci-ide.h
··· 26 26 /** 27 27 * struct pci_ide_partner - Per port pair Selective IDE Stream settings 28 28 * @rid_start: Partner Port Requester ID range start 29 - * @rid_end: Partner Port Requester ID range end 29 + * @rid_end: Partner Port Requester ID range end (inclusive) 30 30 * @stream_index: Selective IDE Stream Register Block selection 31 31 * @mem_assoc: PCI bus memory address association for targeting peer partner 32 32 * @pref_assoc: PCI bus prefetchable memory address association for ··· 82 82 * @host_bridge_stream: allocated from host bridge @ide_stream_ida pool 83 83 * @stream_id: unique Stream ID (within Partner Port pairing) 84 84 * @name: name of the established Selective IDE Stream in sysfs 85 - * @tsm_dev: For TSM established IDE, the TSM device context 86 85 * 87 86 * Negative @stream_id values indicate "uninitialized" on the 88 87 * expectation that with TSM established IDE the TSM owns the stream_id ··· 93 94 u8 host_bridge_stream; 94 95 int stream_id; 95 96 const char *name; 96 - struct tsm_dev *tsm_dev; 97 97 }; 98 98 99 99 /*
-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); 129 126 #endif /* __TSM_H */