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