• Lorenzo Pieralisi's avatar
    alpha/PCI: Fix noname IRQ level detection · 86be8993
    Lorenzo Pieralisi authored
    The conversion of the alpha architecture PCI host bridge legacy IRQ
    mapping/swizzling to the new PCI host bridge map/swizzle hooks carried
    out through:
    
    commit 0e4c2eeb ("alpha/PCI: Replace pci_fixup_irqs() call with
    host bridge IRQ mapping hooks")
    
    implies that IRQ for devices are now allocated through pci_assign_irq()
    function in pci_device_probe() that is called when a driver matching a
    device is found in order to probe the device through the device driver.
    
    Alpha noname platforms required IRQ level programming to be executed
    in sio_fixup_irq_levels(), that is called in noname_init_pci(), a
    platform hook called within a subsys_initcall.
    
    In noname_init_pci(), present IRQs are detected through
    sio_collect_irq_levels() that check the struct pci_dev->irq number
    to detect if an IRQ has been allocated for the device.
    
    By the time sio_collect_irq_levels() is called, some devices may still
    have not a matching driver loaded to match them (eg loadable module)
    therefore their IRQ allocation is still pending - which means that
    sio_collect_irq_levels() does not programme the correct IRQ level for
    those devices, causing their IRQ handling to be broken when the device
    driver is actually loaded and the device is probed.
    
    Fix the issue by adding code in the noname map_irq() function
    (noname_map_irq()) that, whilst mapping/swizzling the IRQ line, it also
    ensures that the correct IRQ level programming is executed at platform
    level, fixing the issue.
    
    Fixes: 0e4c2eeb ("alpha/PCI: Replace pci_fixup_irqs() call with
    host bridge IRQ mapping hooks")
    Reported-by: default avatarMikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Cc: stable@vger.kernel.org # 4.14
    Cc: Bjorn Helgaas <bhelgaas@google.com>
    Cc: Richard Henderson <rth@twiddle.net>
    Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
    Cc: Mikulas Patocka <mpatocka@redhat.com>
    Cc: Meelis Roos <mroos@linux.ee>
    Signed-off-by: default avatarMatt Turner <mattst88@gmail.com>
    86be8993
sys_sio.c 12.8 KB