Merge branch 'pci/msi'
- Document sysfs "irq" attribute, which contains either the INTx IRQ (the intended behavior) or the first MSI IRQ (historical mistake retained for backwards compatibility) (Barry Song) - Rework "irq" sysfs show function to explicitly fetch first MSI IRQ instead of depending on core to put it in dev->irq, to enable future core cleanup (Barry Song) * pci/msi: PCI/sysfs: Explicitly show first MSI IRQ for 'irq' PCI: Document /sys/bus/pci/devices/.../irq
This commit is contained in:
commit
efe6856390
|
@ -96,6 +96,17 @@ Description:
|
|||
This attribute indicates the mode that the irq vector named by
|
||||
the file is in (msi vs. msix)
|
||||
|
||||
What: /sys/bus/pci/devices/.../irq
|
||||
Date: August 2021
|
||||
Contact: Linux PCI developers <linux-pci@vger.kernel.org>
|
||||
Description:
|
||||
If a driver has enabled MSI (not MSI-X), "irq" contains the
|
||||
IRQ of the first MSI vector. Otherwise "irq" contains the
|
||||
IRQ of the legacy INTx interrupt.
|
||||
|
||||
"irq" being set to 0 indicates that the device isn't
|
||||
capable of generating legacy INTx interrupts.
|
||||
|
||||
What: /sys/bus/pci/devices/.../remove
|
||||
Date: January 2009
|
||||
Contact: Linux PCI developers <linux-pci@vger.kernel.org>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <linux/slab.h>
|
||||
#include <linux/vgaarb.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/msi.h>
|
||||
#include <linux/of.h>
|
||||
#include "pci.h"
|
||||
|
||||
|
@ -49,7 +50,28 @@ pci_config_attr(subsystem_vendor, "0x%04x\n");
|
|||
pci_config_attr(subsystem_device, "0x%04x\n");
|
||||
pci_config_attr(revision, "0x%02x\n");
|
||||
pci_config_attr(class, "0x%06x\n");
|
||||
pci_config_attr(irq, "%u\n");
|
||||
|
||||
static ssize_t irq_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(dev);
|
||||
|
||||
#ifdef CONFIG_PCI_MSI
|
||||
/*
|
||||
* For MSI, show the first MSI IRQ; for all other cases including
|
||||
* MSI-X, show the legacy INTx IRQ.
|
||||
*/
|
||||
if (pdev->msi_enabled) {
|
||||
struct msi_desc *desc = first_pci_msi_entry(pdev);
|
||||
|
||||
return sysfs_emit(buf, "%u\n", desc->irq);
|
||||
}
|
||||
#endif
|
||||
|
||||
return sysfs_emit(buf, "%u\n", pdev->irq);
|
||||
}
|
||||
static DEVICE_ATTR_RO(irq);
|
||||
|
||||
static ssize_t broken_parity_status_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
|
|
Loading…
Reference in New Issue