mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-18 06:33:43 -04:00
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>
This commit is contained in:
@@ -4,11 +4,13 @@
|
||||
#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);
|
||||
@@ -106,6 +108,32 @@ 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);
|
||||
|
||||
Reference in New Issue
Block a user