irq.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * PCI IRQ failure handing code
  3. *
  4. * Copyright (c) 2008 James Bottomley <James.Bottomley@HansenPartnership.com>
  5. */
  6. #include <linux/acpi.h>
  7. #include <linux/device.h>
  8. #include <linux/kernel.h>
  9. #include <linux/pci.h>
  10. static void pci_note_irq_problem(struct pci_dev *pdev, const char *reason)
  11. {
  12. struct pci_dev *parent = to_pci_dev(pdev->dev.parent);
  13. dev_printk(KERN_ERR, &pdev->dev,
  14. "Potentially misrouted IRQ (Bridge %s %04x:%04x)\n",
  15. dev_name(&parent->dev), parent->vendor, parent->device);
  16. dev_printk(KERN_ERR, &pdev->dev, "%s\n", reason);
  17. dev_printk(KERN_ERR, &pdev->dev, "Please report to linux-kernel@vger.kernel.org\n");
  18. WARN_ON(1);
  19. }
  20. /**
  21. * pci_lost_interrupt - reports a lost PCI interrupt
  22. * @pdev: device whose interrupt is lost
  23. *
  24. * The primary function of this routine is to report a lost interrupt
  25. * in a standard way which users can recognise (instead of blaming the
  26. * driver).
  27. *
  28. * Returns:
  29. * a suggestion for fixing it (although the driver is not required to
  30. * act on this).
  31. */
  32. enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *pdev)
  33. {
  34. if (pdev->msi_enabled || pdev->msix_enabled) {
  35. enum pci_lost_interrupt_reason ret;
  36. if (pdev->msix_enabled) {
  37. pci_note_irq_problem(pdev, "MSIX routing failure");
  38. ret = PCI_LOST_IRQ_DISABLE_MSIX;
  39. } else {
  40. pci_note_irq_problem(pdev, "MSI routing failure");
  41. ret = PCI_LOST_IRQ_DISABLE_MSI;
  42. }
  43. return ret;
  44. }
  45. #ifdef CONFIG_ACPI
  46. if (!(acpi_disabled || acpi_noirq)) {
  47. pci_note_irq_problem(pdev, "Potential ACPI misrouting please reboot with acpi=noirq");
  48. /* currently no way to fix acpi on the fly */
  49. return PCI_LOST_IRQ_DISABLE_ACPI;
  50. }
  51. #endif
  52. pci_note_irq_problem(pdev, "unknown cause (not MSI or ACPI)");
  53. return PCI_LOST_IRQ_NO_INFORMATION;
  54. }
  55. EXPORT_SYMBOL(pci_lost_interrupt);