Skip to content

Commit f14faaf

Browse files
committed
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"
2 parents 3c7b4d1 + c201226 commit f14faaf

File tree

6 files changed

+5
-67
lines changed

6 files changed

+5
-67
lines changed

Documentation/ABI/testing/sysfs-class-tsm

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,3 @@ Description:
77
signals when the PCI layer is able to support establishment of
88
link encryption and other device-security features coordinated
99
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.

drivers/crypto/ccp/sev-dev-tsm.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@
1919

2020
MODULE_IMPORT_NS("PCI_IDE");
2121

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-
2822
#define dev_to_sp(dev) ((struct sp_device *)dev_get_drvdata(dev))
2923
#define dev_to_psp(dev) ((struct psp_device *)(dev_to_sp(dev)->psp_data))
3024
#define dev_to_sev(dev) ((struct sev_device *)(dev_to_psp(dev)->sev_data))
@@ -193,25 +187,18 @@ static void streams_teardown(struct pci_ide **ide)
193187
static int stream_alloc(struct pci_dev *pdev, struct pci_ide **ide,
194188
unsigned int tc)
195189
{
196-
struct pci_dev *rp = pcie_find_root_port(pdev);
197190
struct pci_ide *ide1;
198191

199192
if (ide[tc]) {
200193
pci_err(pdev, "Stream for class=%d already registered", tc);
201194
return -EBUSY;
202195
}
203196

204-
/* FIXME: find a better way */
205-
if (nr_ide_streams != TIO_DEFAULT_NR_IDE_STREAMS)
206-
pci_notice(pdev, "Enable non-default %d streams", nr_ide_streams);
207-
pci_ide_set_nr_streams(to_pci_host_bridge(rp->bus->bridge), nr_ide_streams);
208-
209197
ide1 = pci_ide_stream_alloc(pdev);
210198
if (!ide1)
211199
return -EFAULT;
212200

213-
/* Blindly assign streamid=0 to TC=0, and so on */
214-
ide1->stream_id = tc;
201+
ide1->stream_id = ide1->host_bridge_stream;
215202

216203
ide[tc] = ide1;
217204

drivers/pci/ide.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <linux/pci_regs.h>
1212
#include <linux/slab.h>
1313
#include <linux/sysfs.h>
14-
#include <linux/tsm.h>
1514

1615
#include "pci.h"
1716

@@ -168,7 +167,7 @@ void pci_ide_init(struct pci_dev *pdev)
168167
for (u16 i = 0; i < nr_streams; i++) {
169168
int pos = __sel_ide_offset(ide_cap, nr_link_ide, i, nr_ide_mem);
170169

171-
pci_read_config_dword(pdev, pos + PCI_IDE_SEL_CAP, &val);
170+
pci_read_config_dword(pdev, pos + PCI_IDE_SEL_CTL, &val);
172171
if (val & PCI_IDE_SEL_CTL_EN)
173172
continue;
174173
val &= ~PCI_IDE_SEL_CTL_ID;
@@ -283,8 +282,8 @@ struct pci_ide *pci_ide_stream_alloc(struct pci_dev *pdev)
283282
/* for SR-IOV case, cover all VFs */
284283
num_vf = pci_num_vf(pdev);
285284
if (num_vf)
286-
rid_end = PCI_DEVID(pci_iov_virtfn_bus(pdev, num_vf),
287-
pci_iov_virtfn_devfn(pdev, num_vf));
285+
rid_end = PCI_DEVID(pci_iov_virtfn_bus(pdev, num_vf - 1),
286+
pci_iov_virtfn_devfn(pdev, num_vf - 1));
288287
else
289288
rid_end = pci_dev_id(pdev);
290289

@@ -373,9 +372,6 @@ void pci_ide_stream_release(struct pci_ide *ide)
373372
if (ide->partner[PCI_IDE_EP].enable)
374373
pci_ide_stream_disable(pdev, ide);
375374

376-
if (ide->tsm_dev)
377-
tsm_ide_stream_unregister(ide);
378-
379375
if (ide->partner[PCI_IDE_RP].setup)
380376
pci_ide_stream_teardown(rp, ide);
381377

drivers/virt/coco/tsm-core.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@
44
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
55

66
#include <linux/tsm.h>
7-
#include <linux/pci.h>
8-
#include <linux/rwsem.h>
97
#include <linux/device.h>
108
#include <linux/module.h>
119
#include <linux/cleanup.h>
1210
#include <linux/pci-tsm.h>
13-
#include <linux/pci-ide.h>
1411

1512
static struct class *tsm_class;
16-
static DECLARE_RWSEM(tsm_rwsem);
1713
static DEFINE_IDA(tsm_ida);
1814

1915
static int match_id(struct device *dev, const void *data)
@@ -108,32 +104,6 @@ void tsm_unregister(struct tsm_dev *tsm_dev)
108104
}
109105
EXPORT_SYMBOL_GPL(tsm_unregister);
110106

111-
/* must be invoked between tsm_register / tsm_unregister */
112-
int tsm_ide_stream_register(struct pci_ide *ide)
113-
{
114-
struct pci_dev *pdev = ide->pdev;
115-
struct pci_tsm *tsm = pdev->tsm;
116-
struct tsm_dev *tsm_dev = tsm->tsm_dev;
117-
int rc;
118-
119-
rc = sysfs_create_link(&tsm_dev->dev.kobj, &pdev->dev.kobj, ide->name);
120-
if (rc)
121-
return rc;
122-
123-
ide->tsm_dev = tsm_dev;
124-
return 0;
125-
}
126-
EXPORT_SYMBOL_GPL(tsm_ide_stream_register);
127-
128-
void tsm_ide_stream_unregister(struct pci_ide *ide)
129-
{
130-
struct tsm_dev *tsm_dev = ide->tsm_dev;
131-
132-
ide->tsm_dev = NULL;
133-
sysfs_remove_link(&tsm_dev->dev.kobj, ide->name);
134-
}
135-
EXPORT_SYMBOL_GPL(tsm_ide_stream_unregister);
136-
137107
static void tsm_release(struct device *dev)
138108
{
139109
struct tsm_dev *tsm_dev = container_of(dev, typeof(*tsm_dev), dev);

include/linux/pci-ide.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ enum pci_ide_partner_select {
2626
/**
2727
* struct pci_ide_partner - Per port pair Selective IDE Stream settings
2828
* @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)
3030
* @stream_index: Selective IDE Stream Register Block selection
3131
* @mem_assoc: PCI bus memory address association for targeting peer partner
3232
* @pref_assoc: PCI bus prefetchable memory address association for
@@ -82,7 +82,6 @@ struct pci_ide_regs {
8282
* @host_bridge_stream: allocated from host bridge @ide_stream_ida pool
8383
* @stream_id: unique Stream ID (within Partner Port pairing)
8484
* @name: name of the established Selective IDE Stream in sysfs
85-
* @tsm_dev: For TSM established IDE, the TSM device context
8685
*
8786
* Negative @stream_id values indicate "uninitialized" on the
8887
* expectation that with TSM established IDE the TSM owns the stream_id
@@ -94,7 +93,6 @@ struct pci_ide {
9493
u8 host_bridge_stream;
9594
int stream_id;
9695
const char *name;
97-
struct tsm_dev *tsm_dev;
9896
};
9997

10098
/*

include/linux/tsm.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,4 @@ int tsm_report_unregister(const struct tsm_report_ops *ops);
123123
struct tsm_dev *tsm_register(struct device *parent, struct pci_tsm_ops *ops);
124124
void tsm_unregister(struct tsm_dev *tsm_dev);
125125
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);
129126
#endif /* __TSM_H */

0 commit comments

Comments
 (0)