pci: fix unavailable irq number 255 reported by BIOS
Subsystems (4)
v3 cover pci: fix unavailable irq number 255 reported by BIOS
see each patch comments.
Chen Fan (2):
pci: add an irq_invalid flag to specify the IRQ is not connected
i801_smbus: fix unavailable irq number 255 reported by BIOS
drivers/acpi/pci_irq.c | 10 ++++++++++ drivers/i2c/busses/i2c-i801.c | 5 +++++ include/linux/pci.h | 1 + 3 files changed, 16 insertions(+)
Signature · 1 line
1.9.3
PATCH v3 1/2 pci: add an irq_invalid flag to specify the IRQ is not connected
Quoting the PCI3.0 SPEC on page 223:
"For x86 based PCs, the values in this register correspond to IRQ numbers (0-15) of the standard dual 8259 configuration. The value 255 is defined as meaning "unknown" or "no connection" to the interrupt controller. Values between 15 and 254 are reserved."
So we add an irq_invalid flag to tell driver that the device wire is not connected. then the driver could know whether it should call request_irq().
--- drivers/acpi/pci_irq.c | 10 ++++++++++ include/linux/pci.h | 1 + 2 files changed, 11 insertions(+)
drivers/acpi/pci_irq.c +10 -0
@@ -436,6 +436,16 @@ int acpi_pci_irq_enable(struct pci_dev *dev)* driver reported one, then use it. Exit in any case. */ if (gsi <0 ) { +#ifdef CONFIG_X86 +/* +* For X86 architecture, The Interrupt Line value of 0xff is +* defined to mean "unknown" or "no connection" (PCI 3.0, +* Section 6.2.4, footnote on page 223). we flag the IRQ +* as INVALID. +*/ +if (dev->irq ==0xff ) + dev->irq_invalid =1 ; +#endif if (acpi_isa_register_gsi (dev))dev_warn (&dev->dev,"PCI INT %c: no GSI\n" ,pin_name (pin));
include/linux/pci.h +1 -0
@@ -359,6 +359,7 @@ struct pci_dev { unsigned int io_window_1k:1; /* Intel P2P bridge 1K I/O windows */ unsigned int irq_managed:1; unsigned int has_secondary_link:1; + unsigned int irq_invalid:1;pci_dev_flags_t dev_flags;atomic_t enable_cnt;/* pci_enable_device has been called */
Signature · 1 line
1.9.3
PATCH v3 2/2 i801_smbus: fix unavailable irq number 255 reported by BIOS
In reply to Chen FanIn our environment, when enable Secure boot, we found an abnormal phenomenon as following call trace shows. after investigation, we found the firmware assigned an irq number 255 which means unknown or no connection in PCI local spec for i801_smbus, meanwhile the ACPI didn't configure the pci irq routing. and the 255 irq number was assigned for megasa msix without IRQF_SHARED. then in this case during i801_smbus probe, the i801_smbus driver would request irq with bad irq number 255. but the 255 irq number was assigned for memgasa with MSIX enable. which will cause request_irq fails and result in the call trace below, here we add check the irq_invalid flag to identify the smbus whether support IRQ-driven.
i801_smbus 0000:00:1f.3: enabling device (0140 -> 0143) i801_smbus 0000:00:1f.3: can't derive routing for PCI INT C i801_smbus 0000:00:1f.3: PCI INT C: no GSI
genirq: Flags mismatch irq 255. 00000080 (i801_smbus) vs. 00000000 (megasa)
CPU: 0 PID: 2487 Comm: kworker/0:1 Not tainted 3.10.0-229.el7.x86_64 #1 Hardware name: FUJITSU PRIMEQUEST 2800E2/D3736, BIOS PRIMEQUEST 2000 Serie5 Call Trace: dump_stack+0x19/0x1b __setup_irq+0x54a/0x570 request_threaded_irq+0xcc/0x170 i801_probe+0x32f/0x508 [i2c_i801] local_pci_probe+0x45/0xa0
i801_smbus 0000:00:1f.3: Failed to allocate irq 255: -16i801_smbus: probe of 0000:00:1f.3 failed with error -16
--- drivers/i2c/busses/i2c-i801.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/i2c/busses/i2c-i801.c +5 -0
@@ -1380,6 +1380,11 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) } } +if ((priv->features &FEATURE_IRQ ) && dev->irq_invalid) { +dev_warn (&dev->dev,"Interrupt line is invalid!\n" ); + priv->features &= ~FEATURE_IRQ ; + } +if (priv->features &FEATURE_IRQ ) {init_waitqueue_head (&priv->waitq);
Signature · 1 line
1.9.3