Re: [RFC][PATCH] Add sysfs entry that displays MSI-X IRQs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here are the changes as requested.



Thanks,

-- Vinnie.


Signed-off-by: Vincent Rizza <vinnie@xxxxxxx>
Signed-off-by: Brett Grandbois <brettg@xxxxxxx>
Signed-off-by: Greg Banks <gnb@xxxxxxx>
---
Documentation/ABI/testing/sysfs-bus-pci |    9 +++++++++
drivers/pci/pci-sysfs.c                 |   20 ++++++++++++++++++++
2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci
index ceddcff..06f1b8a 100644
--- a/Documentation/ABI/testing/sysfs-bus-pci
+++ b/Documentation/ABI/testing/sysfs-bus-pci
@@ -9,3 +9,12 @@ Description:
		that some devices may have malformatted data.  If the
		underlying VPD has a writable section then the
		corresponding section of this file will be writable.
+
+What:		/sys/bus/pci/devices/.../msix
+Date:		October 2008
+Contact:	Vincent Rizza <vinnie@xxxxxxx>
+Description:
+		The "msix" file (read only) in the device directory
+		provides a list of MSI-X IRQs for the given device.
+		Each line contains a MSI-X IRQ (represented in decimal).
+		The file is empty if there are no MSI-X IRQs.
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 110022d..2820669 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -18,6 +18,7 @@
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/pci.h>
+#include <linux/msi.h>
#include <linux/stat.h>
#include <linux/topology.h>
#include <linux/mm.h>
@@ -45,6 +46,22 @@ pci_config_attr(subsystem_device, "0x%04x\n");
pci_config_attr(class, "0x%06x\n");
pci_config_attr(irq, "%u\n");

+#ifdef CONFIG_PCI_MSI
+static ssize_t msix_show(struct device *dev,
+			 struct device_attribute *attr, char *buf)
+{
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct msi_desc *entry, *next;
+	u32 total = 0;
+
+	list_for_each_entry_safe(entry, next, &pdev->msi_list, list) {
+		total += sprintf(buf + total, "%u\n", entry->irq);
+	}
+
+	return total;
+}
+#endif
+
static ssize_t broken_parity_status_show(struct device *dev,
					 struct device_attribute *attr,
					 char *buf)
@@ -217,6 +234,9 @@ struct device_attribute pci_dev_attrs[] = {
	__ATTR_RO(subsystem_device),
	__ATTR_RO(class),
	__ATTR_RO(irq),
+#ifdef CONFIG_PCI_MSI
+	__ATTR_RO(msix),
+#endif
	__ATTR_RO(local_cpus),
	__ATTR_RO(local_cpulist),
	__ATTR_RO(modalias),
--
1.5.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux