powerpc/pci: fix PCI-e devices rescan issue on powerpc platform
authorYuanquan Chen <Yuanquan.Chen@freescale.com>
Tue, 2 Apr 2013 01:26:54 +0000 (01:26 +0000)
committerMichael Ellerman <michael@ellerman.id.au>
Thu, 18 Apr 2013 05:59:57 +0000 (15:59 +1000)
commit37f02195bee9c25ce44e25204f40b7961a6d7c9d
tree1e89a6a728fa0a1a0ad874b96ae47cb08078ce60
parent55671f3cc29c31681278b7782de4f6a4edb97a7e
powerpc/pci: fix PCI-e devices rescan issue on powerpc platform

Powerpc initializes the DMA and IRQ information in pci_scan_child_bus()->
pcibios_fixup_bus()->pcibios_setup_bus_devices(). But for the devices
which are hotpluged, bus->is added has been set for the first scan of the
PCI-e bus, so the initialization code won't be called. Then the hotpluged
devices' driver will fail to load.

For example :
The PCI-e device 0001:03:00.0 is the Intel PCI-e e1000e network card, remove
it from the system:

    # echo 1 > /sys/bus/pci/devices/0001\:03\:00.0/remove
    # e1000e 0001:03:00.0 eth0: removed PHC

Rescan it from it's bus:

    # echo 1 > /sys/bus/pci/devices/0001\:02\:00.0/rescan
    ...
    e1000e 0001:03:00.0: Disabling ASPM L0s L1
    e1000e 0001:03:00.0: No usable DMA configuration, aborting
    e1000e: probe of 0001:03:00.0 failed with error -5

So we move the DMA & IRQ initialization code from pcibios_setup_devices() and
construct a new function pcibios_enable_device. We call this function in
pcibios_enable_device, which will be called by PCI-e rescan code. At the
meanwhile, we avoid the the impact on cardbus. I also validate this patch with
silicon's PCIe-sata which encounters the IRQ issue.

Signed-off-by: Yuanquan Chen <Yuanquan.Chen@freescale.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Hiroo Matsumoto <matsumoto.hiroo@jp.fujitsu.com>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
arch/powerpc/kernel/pci-common.c