aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2008-08-03 14:02:12 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2008-10-23 17:54:18 -0400
commit388c8c16abafc2e74dff173b5de9ee519ea8d32f (patch)
treeed1197dcbff33881b7e285c066f1e4260be6c7a4
parent18b341b76cd99ce949806ccf5565900465ec2e7f (diff)
PCI: add routines for debugging and handling lost interrupts
We're getting a lot of storage drivers blamed for interrupt misrouting issues. This patch provides a standard way of reporting the problem ... and, if possible, correcting it. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
-rw-r--r--drivers/pci/Makefile3
-rw-r--r--drivers/pci/irq.c60
-rw-r--r--include/linux/pci.h7
3 files changed, 69 insertions, 1 deletions
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index 4b47f4ece5b7..af3bfe22847b 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -3,7 +3,8 @@
3# 3#
4 4
5obj-y += access.o bus.o probe.o remove.o pci.o quirks.o slot.o \ 5obj-y += access.o bus.o probe.o remove.o pci.o quirks.o slot.o \
6 pci-driver.o search.o pci-sysfs.o rom.o setup-res.o 6 pci-driver.o search.o pci-sysfs.o rom.o setup-res.o \
7 irq.o
7obj-$(CONFIG_PROC_FS) += proc.o 8obj-$(CONFIG_PROC_FS) += proc.o
8 9
9# Build PCI Express stuff if needed 10# Build PCI Express stuff if needed
diff --git a/drivers/pci/irq.c b/drivers/pci/irq.c
new file mode 100644
index 000000000000..6441dfa969a3
--- /dev/null
+++ b/drivers/pci/irq.c
@@ -0,0 +1,60 @@
1/*
2 * PCI IRQ failure handing code
3 *
4 * Copyright (c) 2008 James Bottomley <James.Bottomley@HansenPartnership.com>
5 */
6
7#include <linux/acpi.h>
8#include <linux/device.h>
9#include <linux/kernel.h>
10#include <linux/pci.h>
11
12static void pci_note_irq_problem(struct pci_dev *pdev, const char *reason)
13{
14 struct pci_dev *parent = to_pci_dev(pdev->dev.parent);
15
16 dev_printk(KERN_ERR, &pdev->dev,
17 "Potentially misrouted IRQ (Bridge %s %04x:%04x)\n",
18 parent->dev.bus_id, parent->vendor, parent->device);
19 dev_printk(KERN_ERR, &pdev->dev, "%s\n", reason);
20 dev_printk(KERN_ERR, &pdev->dev, "Please report to linux-kernel@vger.kernel.org\n");
21 WARN_ON(1);
22}
23
24/**
25 * pci_lost_interrupt - reports a lost PCI interrupt
26 * @pdev: device whose interrupt is lost
27 *
28 * The primary function of this routine is to report a lost interrupt
29 * in a standard way which users can recognise (instead of blaming the
30 * driver).
31 *
32 * Returns:
33 * a suggestion for fixing it (although the driver is not required to
34 * act on this).
35 */
36enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *pdev)
37{
38 if (pdev->msi_enabled || pdev->msix_enabled) {
39 enum pci_lost_interrupt_reason ret;
40
41 if (pdev->msix_enabled) {
42 pci_note_irq_problem(pdev, "MSIX routing failure");
43 ret = PCI_LOST_IRQ_DISABLE_MSIX;
44 } else {
45 pci_note_irq_problem(pdev, "MSI routing failure");
46 ret = PCI_LOST_IRQ_DISABLE_MSI;
47 }
48 return ret;
49 }
50#ifdef CONFIG_ACPI
51 if (!(acpi_disabled || acpi_noirq)) {
52 pci_note_irq_problem(pdev, "Potential ACPI misrouting please reboot with acpi=noirq");
53 /* currently no way to fix acpi on the fly */
54 return PCI_LOST_IRQ_DISABLE_ACPI;
55 }
56#endif
57 pci_note_irq_problem(pdev, "unknown cause (not MSI or ACPI)");
58 return PCI_LOST_IRQ_NO_INFORMATION;
59}
60EXPORT_SYMBOL(pci_lost_interrupt);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 752def8a2ef4..c75b82bda327 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -546,6 +546,13 @@ struct pci_dev __deprecated *pci_find_slot(unsigned int bus,
546 unsigned int devfn); 546 unsigned int devfn);
547#endif /* CONFIG_PCI_LEGACY */ 547#endif /* CONFIG_PCI_LEGACY */
548 548
549enum pci_lost_interrupt_reason {
550 PCI_LOST_IRQ_NO_INFORMATION = 0,
551 PCI_LOST_IRQ_DISABLE_MSI,
552 PCI_LOST_IRQ_DISABLE_MSIX,
553 PCI_LOST_IRQ_DISABLE_ACPI,
554};
555enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev);
549int pci_find_capability(struct pci_dev *dev, int cap); 556int pci_find_capability(struct pci_dev *dev, int cap);
550int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); 557int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap);
551int pci_find_ext_capability(struct pci_dev *dev, int cap); 558int pci_find_ext_capability(struct pci_dev *dev, int cap);