forked from mirrors/linux
		
	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>
This commit is contained in:
		
							parent
							
								
									18b341b76c
								
							
						
					
					
						commit
						388c8c16ab
					
				
					 3 changed files with 69 additions and 1 deletions
				
			
		| 
						 | 
					@ -3,7 +3,8 @@
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
obj-y		+= access.o bus.o probe.o remove.o pci.o quirks.o slot.o \
 | 
					obj-y		+= access.o bus.o probe.o remove.o pci.o quirks.o slot.o \
 | 
				
			||||||
			pci-driver.o search.o pci-sysfs.o rom.o setup-res.o
 | 
								pci-driver.o search.o pci-sysfs.o rom.o setup-res.o \
 | 
				
			||||||
 | 
								irq.o
 | 
				
			||||||
obj-$(CONFIG_PROC_FS) += proc.o
 | 
					obj-$(CONFIG_PROC_FS) += proc.o
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Build PCI Express stuff if needed
 | 
					# Build PCI Express stuff if needed
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										60
									
								
								drivers/pci/irq.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								drivers/pci/irq.c
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,60 @@
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * PCI IRQ failure handing code
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Copyright (c) 2008 James Bottomley <James.Bottomley@HansenPartnership.com>
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <linux/acpi.h>
 | 
				
			||||||
 | 
					#include <linux/device.h>
 | 
				
			||||||
 | 
					#include <linux/kernel.h>
 | 
				
			||||||
 | 
					#include <linux/pci.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void pci_note_irq_problem(struct pci_dev *pdev, const char *reason)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct pci_dev *parent = to_pci_dev(pdev->dev.parent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						dev_printk(KERN_ERR, &pdev->dev,
 | 
				
			||||||
 | 
							   "Potentially misrouted IRQ (Bridge %s %04x:%04x)\n",
 | 
				
			||||||
 | 
							   parent->dev.bus_id, parent->vendor, parent->device);
 | 
				
			||||||
 | 
						dev_printk(KERN_ERR, &pdev->dev, "%s\n", reason);
 | 
				
			||||||
 | 
						dev_printk(KERN_ERR, &pdev->dev, "Please report to linux-kernel@vger.kernel.org\n");
 | 
				
			||||||
 | 
						WARN_ON(1);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * pci_lost_interrupt - reports a lost PCI interrupt
 | 
				
			||||||
 | 
					 * @pdev:	device whose interrupt is lost
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * The primary function of this routine is to report a lost interrupt
 | 
				
			||||||
 | 
					 * in a standard way which users can recognise (instead of blaming the
 | 
				
			||||||
 | 
					 * driver).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Returns:
 | 
				
			||||||
 | 
					 *  a suggestion for fixing it (although the driver is not required to
 | 
				
			||||||
 | 
					 * act on this).
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *pdev)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (pdev->msi_enabled || pdev->msix_enabled) {
 | 
				
			||||||
 | 
							enum pci_lost_interrupt_reason ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (pdev->msix_enabled) {
 | 
				
			||||||
 | 
								pci_note_irq_problem(pdev, "MSIX routing failure");
 | 
				
			||||||
 | 
								ret = PCI_LOST_IRQ_DISABLE_MSIX;
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								pci_note_irq_problem(pdev, "MSI routing failure");
 | 
				
			||||||
 | 
								ret = PCI_LOST_IRQ_DISABLE_MSI;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return ret;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					#ifdef CONFIG_ACPI
 | 
				
			||||||
 | 
						if (!(acpi_disabled || acpi_noirq)) {
 | 
				
			||||||
 | 
							pci_note_irq_problem(pdev, "Potential ACPI misrouting please reboot with acpi=noirq");
 | 
				
			||||||
 | 
							/* currently no way to fix acpi on the fly */
 | 
				
			||||||
 | 
							return PCI_LOST_IRQ_DISABLE_ACPI;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
						pci_note_irq_problem(pdev, "unknown cause (not MSI or ACPI)");
 | 
				
			||||||
 | 
						return PCI_LOST_IRQ_NO_INFORMATION;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(pci_lost_interrupt);
 | 
				
			||||||
| 
						 | 
					@ -546,6 +546,13 @@ struct pci_dev __deprecated *pci_find_slot(unsigned int bus,
 | 
				
			||||||
					   unsigned int devfn);
 | 
										   unsigned int devfn);
 | 
				
			||||||
#endif /* CONFIG_PCI_LEGACY */
 | 
					#endif /* CONFIG_PCI_LEGACY */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum pci_lost_interrupt_reason {
 | 
				
			||||||
 | 
						PCI_LOST_IRQ_NO_INFORMATION = 0,
 | 
				
			||||||
 | 
						PCI_LOST_IRQ_DISABLE_MSI,
 | 
				
			||||||
 | 
						PCI_LOST_IRQ_DISABLE_MSIX,
 | 
				
			||||||
 | 
						PCI_LOST_IRQ_DISABLE_ACPI,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev);
 | 
				
			||||||
int pci_find_capability(struct pci_dev *dev, int cap);
 | 
					int pci_find_capability(struct pci_dev *dev, int cap);
 | 
				
			||||||
int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap);
 | 
					int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap);
 | 
				
			||||||
int pci_find_ext_capability(struct pci_dev *dev, int cap);
 | 
					int pci_find_ext_capability(struct pci_dev *dev, int cap);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue