Commit f14faaf3 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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"
parents 3c7b4d19 c2012263
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -7,13 +7,3 @@ Description:
		signals when the PCI layer is able to support establishment of
		link encryption and other device-security features coordinated
		through a platform tsm.

What:		/sys/class/tsm/tsmN/streamH.R.E
Contact:	linux-pci@vger.kernel.org
Description:
		(RO) When a host bridge has established a secure connection via
		the platform TSM, symlink appears. The primary function of this
		is have a system global review of TSM resource consumption
		across host bridges. The link points to the endpoint PCI device
		and matches the same link published by the host bridge. See
		Documentation/ABI/testing/sysfs-devices-pci-host-bridge.
+1 −14
Original line number Diff line number Diff line
@@ -19,12 +19,6 @@

MODULE_IMPORT_NS("PCI_IDE");

#define TIO_DEFAULT_NR_IDE_STREAMS	1

static uint nr_ide_streams = TIO_DEFAULT_NR_IDE_STREAMS;
module_param_named(ide_nr, nr_ide_streams, uint, 0644);
MODULE_PARM_DESC(ide_nr, "Set the maximum number of IDE streams per PHB");

#define dev_to_sp(dev)		((struct sp_device *)dev_get_drvdata(dev))
#define dev_to_psp(dev)		((struct psp_device *)(dev_to_sp(dev)->psp_data))
#define dev_to_sev(dev)		((struct sev_device *)(dev_to_psp(dev)->sev_data))
@@ -193,7 +187,6 @@ static void streams_teardown(struct pci_ide **ide)
static int stream_alloc(struct pci_dev *pdev, struct pci_ide **ide,
			unsigned int tc)
{
	struct pci_dev *rp = pcie_find_root_port(pdev);
	struct pci_ide *ide1;

	if (ide[tc]) {
@@ -201,17 +194,11 @@ static int stream_alloc(struct pci_dev *pdev, struct pci_ide **ide,
		return -EBUSY;
	}

	/* FIXME: find a better way */
	if (nr_ide_streams != TIO_DEFAULT_NR_IDE_STREAMS)
		pci_notice(pdev, "Enable non-default %d streams", nr_ide_streams);
	pci_ide_set_nr_streams(to_pci_host_bridge(rp->bus->bridge), nr_ide_streams);

	ide1 = pci_ide_stream_alloc(pdev);
	if (!ide1)
		return -EFAULT;

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

	ide[tc] = ide1;

+3 −7
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@
#include <linux/pci_regs.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/tsm.h>

#include "pci.h"

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

		pci_read_config_dword(pdev, pos + PCI_IDE_SEL_CAP, &val);
		pci_read_config_dword(pdev, pos + PCI_IDE_SEL_CTL, &val);
		if (val & PCI_IDE_SEL_CTL_EN)
			continue;
		val &= ~PCI_IDE_SEL_CTL_ID;
@@ -283,8 +282,8 @@ struct pci_ide *pci_ide_stream_alloc(struct pci_dev *pdev)
	/* for SR-IOV case, cover all VFs */
	num_vf = pci_num_vf(pdev);
	if (num_vf)
		rid_end = PCI_DEVID(pci_iov_virtfn_bus(pdev, num_vf),
				    pci_iov_virtfn_devfn(pdev, num_vf));
		rid_end = PCI_DEVID(pci_iov_virtfn_bus(pdev, num_vf - 1),
				    pci_iov_virtfn_devfn(pdev, num_vf - 1));
	else
		rid_end = pci_dev_id(pdev);

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

	if (ide->tsm_dev)
		tsm_ide_stream_unregister(ide);

	if (ide->partner[PCI_IDE_RP].setup)
		pci_ide_stream_teardown(rp, ide);

+0 −30
Original line number Diff line number Diff line
@@ -4,16 +4,12 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/tsm.h>
#include <linux/pci.h>
#include <linux/rwsem.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/cleanup.h>
#include <linux/pci-tsm.h>
#include <linux/pci-ide.h>

static struct class *tsm_class;
static DECLARE_RWSEM(tsm_rwsem);
static DEFINE_IDA(tsm_ida);

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

/* must be invoked between tsm_register / tsm_unregister */
int tsm_ide_stream_register(struct pci_ide *ide)
{
	struct pci_dev *pdev = ide->pdev;
	struct pci_tsm *tsm = pdev->tsm;
	struct tsm_dev *tsm_dev = tsm->tsm_dev;
	int rc;

	rc = sysfs_create_link(&tsm_dev->dev.kobj, &pdev->dev.kobj, ide->name);
	if (rc)
		return rc;

	ide->tsm_dev = tsm_dev;
	return 0;
}
EXPORT_SYMBOL_GPL(tsm_ide_stream_register);

void tsm_ide_stream_unregister(struct pci_ide *ide)
{
	struct tsm_dev *tsm_dev = ide->tsm_dev;

	ide->tsm_dev = NULL;
	sysfs_remove_link(&tsm_dev->dev.kobj, ide->name);
}
EXPORT_SYMBOL_GPL(tsm_ide_stream_unregister);

static void tsm_release(struct device *dev)
{
	struct tsm_dev *tsm_dev = container_of(dev, typeof(*tsm_dev), dev);
+1 −3
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ enum pci_ide_partner_select {
/**
 * struct pci_ide_partner - Per port pair Selective IDE Stream settings
 * @rid_start: Partner Port Requester ID range start
 * @rid_end: Partner Port Requester ID range end
 * @rid_end: Partner Port Requester ID range end (inclusive)
 * @stream_index: Selective IDE Stream Register Block selection
 * @mem_assoc: PCI bus memory address association for targeting peer partner
 * @pref_assoc: PCI bus prefetchable memory address association for
@@ -82,7 +82,6 @@ struct pci_ide_regs {
 * @host_bridge_stream: allocated from host bridge @ide_stream_ida pool
 * @stream_id: unique Stream ID (within Partner Port pairing)
 * @name: name of the established Selective IDE Stream in sysfs
 * @tsm_dev: For TSM established IDE, the TSM device context
 *
 * Negative @stream_id values indicate "uninitialized" on the
 * expectation that with TSM established IDE the TSM owns the stream_id
@@ -94,7 +93,6 @@ struct pci_ide {
	u8 host_bridge_stream;
	int stream_id;
	const char *name;
	struct tsm_dev *tsm_dev;
};

/*
Loading