ARM/PCI: Remove pci_fixup_irqs() call for bios32 host controllers
authorLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Wed, 28 Jun 2017 20:14:04 +0000 (15:14 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Sun, 2 Jul 2017 21:14:29 +0000 (16:14 -0500)
Legacy PCI host controllers (ie host controllers that set-up the PCI bus
through the ARM pci_common_init() API) are currently relying on
pci_fixup_irqs() to assign legacy PCI irqs to devices.  This is not ideal
in that pci_fixup_irqs() assigns IRQs for all PCI devices present in a given
system some of which may well be enabled by the time pci_fixup_irqs() is
called (ie a system with multiple host controllers).  With the introduction
of struct pci_host_bridge.(*map_irq) pointer it is possible to assign IRQs
for all devices originating from a PCI host bridge at probe time; this is
implemented through pci_assign_irq() that relies on the struct
pci_host_bridge.map_irq pointer to map IRQ for a given device.

The benefits this brings are twofold:

  - the IRQ for a device is assigned once at probe time
  - the IRQ assignment works also for hotplugged devices

Remove pci_fixup_irqs() call from bios32 code and rely on pci_assign_irq()
to carry out the IRQ mapping at device probe time.

The map_irq() and swizzle_irq() struct pci_host_bridge callbacks are set-up
in the struct pci_host_bridge created in the bios32 pcibios_init_hw()
function and mach-* code paths (for PCI mach implementations that require a
specific struct hw_pci.(*scan) function callback).

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
[bhelgaas: folded in fixes from Lorenzo:
http://lkml.kernel.org/r/20170701140629.GC8977@red-moon]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Andrew Lunn <andrew@lunn.ch>
arch/arm/kernel/bios32.c

index 4c7621ac389ce55a5d598308283cef596433a422..56dc1a3a33b4347867a05341cbb35cd5ff9c2e99 100644 (file)
@@ -484,6 +484,9 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
                                break;
                        }
 
+                       bridge->map_irq = pcibios_map_irq;
+                       bridge->swizzle_irq = pcibios_swizzle;
+
                        if (hw->scan)
                                ret = hw->scan(nr, bridge);
                        else {
@@ -530,8 +533,6 @@ void pci_common_init_dev(struct device *parent, struct hw_pci *hw)
        if (hw->postinit)
                hw->postinit();
 
-       pci_fixup_irqs(pcibios_swizzle, pcibios_map_irq);
-
        list_for_each_entry(sys, &head, node) {
                struct pci_bus *bus = sys->bus;