• Maciej W. Rozycki's avatar
    x86/PCI: Handle IRQ swizzling with PIRQ routers · d88a8b1c
    Maciej W. Rozycki authored
    Similarly to MP-tables PIRQ routing tables may not list devices behind 
    PCI-to-PCI bridges, leading to interrupt routing failures, e.g.:
    
    pci 0000:00:07.0: PIIX/ICH IRQ router [8086:7000]
    pci 0000:02:00.0: ignoring bogus IRQ 255
    pci 0000:02:01.0: ignoring bogus IRQ 255
    pci 0000:02:02.0: ignoring bogus IRQ 255
    pci 0000:04:00.0: ignoring bogus IRQ 255
    pci 0000:04:00.3: ignoring bogus IRQ 255
    pci 0000:00:11.0: PCI INT A -> PIRQ 63, mask deb8, excl 0c20
    pci 0000:00:11.0: PCI INT A -> newirq 0
    PCI: setting IRQ 11 as level-triggered
    pci 0000:00:11.0: found PCI INT A -> IRQ 11
    pci 0000:00:11.0: sharing IRQ 11 with 0000:00:07.2
    pci 0000:02:00.0: PCI INT A not found in routing table
    pci 0000:02:01.0: PCI INT A not found in routing table
    pci 0000:02:02.0: PCI INT A not found in routing table
    pci 0000:04:00.0: PCI INT A not found in routing table
    pci 0000:04:00.3: PCI INT D not found in routing table
    pci 0000:06:05.0: PCI INT A not found in routing table
    pci 0000:06:08.0: PCI INT A not found in routing table
    pci 0000:06:08.1: PCI INT B not found in routing table
    pci 0000:06:08.2: PCI INT C not found in routing table
    
    and consequently non-working devices.  Since PCI-to-PCI bridges have a 
    standardised way of routing interrupts by the means of swizzling do it 
    for configurations that use a PIRQ router as well, like with APIC-based 
    setups, and use the determined corresponding topmost bridge's interrupt 
    pin assignment to route a given device's interrupt:
    
    pci 0000:00:07.0: PIIX/ICH IRQ router [8086:7000]
    pci 0000:02:00.0: ignoring bogus IRQ 255
    pci 0000:02:01.0: ignoring bogus IRQ 255
    pci 0000:02:02.0: ignoring bogus IRQ 255
    pci 0000:04:00.0: ignoring bogus IRQ 255
    pci 0000:04:00.3: ignoring bogus IRQ 255
    pci 0000:00:11.0: PCI INT A -> PIRQ 63, mask deb8, excl 0c20
    pci 0000:00:11.0: PCI INT A -> newirq 0
    PCI: setting IRQ 11 as level-triggered
    pci 0000:00:11.0: found PCI INT A -> IRQ 11
    pci 0000:00:11.0: sharing IRQ 11 with 0000:00:07.2
    pci 0000:02:00.0: using bridge 0000:00:11.0 INT A to get INT A
    pci 0000:00:11.0: sharing IRQ 11 with 0000:02:00.0
    pci 0000:02:01.0: using bridge 0000:00:11.0 INT B to get INT A
    pci 0000:02:02.0: using bridge 0000:00:11.0 INT C to get INT A
    pci 0000:04:00.0: using bridge 0000:00:11.0 INT B to get INT A
    pci 0000:04:00.3: using bridge 0000:00:11.0 INT A to get INT D
    pci 0000:00:11.0: sharing IRQ 11 with 0000:04:00.3
    pci 0000:06:05.0: using bridge 0000:00:11.0 INT D to get INT A
    pci 0000:06:08.0: using bridge 0000:00:11.0 INT C to get INT A
    pci 0000:06:08.1: using bridge 0000:00:11.0 INT D to get INT B
    pci 0000:06:08.2: using bridge 0000:00:11.0 INT A to get INT C
    pci 0000:00:11.0: sharing IRQ 11 with 0000:06:08.2
    pci 0000:02:01.0: using bridge 0000:00:11.0 INT B to get INT A
    pci 0000:02:01.0: PCI INT A -> PIRQ 60, mask deb8, excl 0c20
    pci 0000:02:01.0: PCI INT A -> newirq 0
    PCI: setting IRQ 10 as level-triggered
    pci 0000:02:01.0: found PCI INT A -> IRQ 10
    pci 0000:02:01.0: sharing IRQ 10 with 0000:00:14.0
    pci 0000:02:00.0: using bridge 0000:00:11.0 INT A to get INT A
    pci 0000:02:01.0: using bridge 0000:00:11.0 INT B to get INT A
    pci 0000:02:02.0: using bridge 0000:00:11.0 INT C to get INT A
    pci 0000:04:00.0: using bridge 0000:00:11.0 INT B to get INT A
    pci 0000:02:01.0: sharing IRQ 10 with 0000:04:00.0
    pci 0000:04:00.3: using bridge 0000:00:11.0 INT A to get INT D
    pci 0000:06:05.0: using bridge 0000:00:11.0 INT D to get INT A
    pci 0000:06:08.0: using bridge 0000:00:11.0 INT C to get INT A
    pci 0000:06:08.1: using bridge 0000:00:11.0 INT D to get INT B
    pci 0000:06:08.2: using bridge 0000:00:11.0 INT A to get INT C
    pci 0000:02:02.0: using bridge 0000:00:11.0 INT C to get INT A
    pci 0000:02:02.0: PCI INT A -> PIRQ 61, mask deb8, excl 0c20
    pci 0000:02:02.0: PCI INT A -> newirq 0
    PCI: setting IRQ 5 as level-triggered
    pci 0000:02:02.0: found PCI INT A -> IRQ 5
    pci 0000:02:02.0: sharing IRQ 5 with 0000:00:13.0
    pci 0000:02:00.0: using bridge 0000:00:11.0 INT A to get INT A
    pci 0000:02:01.0: using bridge 0000:00:11.0 INT B to get INT A
    pci 0000:02:02.0: using bridge 0000:00:11.0 INT C to get INT A
    pci 0000:04:00.0: using bridge 0000:00:11.0 INT B to get INT A
    pci 0000:04:00.3: using bridge 0000:00:11.0 INT A to get INT D
    pci 0000:06:05.0: using bridge 0000:00:11.0 INT D to get INT A
    pci 0000:06:08.0: using bridge 0000:00:11.0 INT C to get INT A
    pci 0000:02:02.0: sharing IRQ 5 with 0000:06:08.0
    pci 0000:06:08.1: using bridge 0000:00:11.0 INT D to get INT B
    pci 0000:06:08.2: using bridge 0000:00:11.0 INT A to get INT C
    pci 0000:06:05.0: using bridge 0000:00:11.0 INT D to get INT A
    pci 0000:06:05.0: PCI INT A -> PIRQ 62, mask deb8, excl 0c20
    pci 0000:06:05.0: PCI INT A -> newirq 0
    pci 0000:06:05.0: found PCI INT A -> IRQ 5
    pci 0000:06:05.0: sharing IRQ 5 with 0000:00:12.0
    pci 0000:02:00.0: using bridge 0000:00:11.0 INT A to get INT A
    pci 0000:02:01.0: using bridge 0000:00:11.0 INT B to get INT A
    pci 0000:02:02.0: using bridge 0000:00:11.0 INT C to get INT A
    pci 0000:04:00.0: using bridge 0000:00:11.0 INT B to get INT A
    pci 0000:04:00.3: using bridge 0000:00:11.0 INT A to get INT D
    pci 0000:06:05.0: using bridge 0000:00:11.0 INT D to get INT A
    pci 0000:06:08.0: using bridge 0000:00:11.0 INT C to get INT A
    pci 0000:06:08.1: using bridge 0000:00:11.0 INT D to get INT B
    pci 0000:06:05.0: sharing IRQ 5 with 0000:06:08.1
    pci 0000:06:08.2: using bridge 0000:00:11.0 INT A to get INT C
    
    Adjust log messages accordingly.
    Signed-off-by: default avatarMaciej W. Rozycki <macro@orcam.me.uk>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/r/alpine.DEB.2.21.2203301538440.22465@angie.orcam.me.uk
    d88a8b1c
irq.c 42.2 KB