Hello,
Currently when MSI-X mode is enabled for a pci device, there's no sysfs entry
that displays the IRQs. They're listed in /proc/interrupts but when you put two
identical devices in your system there's no way of telling which device is using
which IRQ. The value in the "irq" entry is the non-msix irq so in the patch
below I've created a "msix" entry that lists a MSI-X IRQ per line.
Any comments are welcomed. :)
Signed-off-by: Vincent Rizza <vinnie@xxxxxxx>
Signed-off-by: Brett Grandbois <brettg@xxxxxxx>
Signed-off-by: Greg Banks <gnb@xxxxxxx>
---
drivers/pci/pci-sysfs.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
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