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

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

 



Hi again,
Here's take two of the patch with updated documentation.


Thanks,


--Vinnie.

---
 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..ef7e617 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..6c5c8eb 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;
+	u32 total = 0;
+
+	list_for_each_entry(entry, &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),
--
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