Re: [Update PATCH] PCI: Assign resources before drivers claim devices (pci_scan_root_bus())

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 16, 2015 at 11:18:56AM +0800, Yijing Wang wrote:
> Previously, pci_scan_root_bus() created a root PCI bus, enumerated the
> devices on it, and called pci_bus_add_devices(), which made the devices
> available for drivers to claim them.
> 
> Most callers assigned resources to devices after pci_scan_root_bus()
> returns, which may be after drivers have claimed the devices.  This is
> incorrect; the PCI core should not change device resources while a driver
> is managing the device.
> 
> Remove pci_bus_add_devices() from pci_scan_root_bus() and do it after any
> resource assignment in the callers.
> 
> Note that ARM's pci_common_init_dev() already called pci_bus_add_devices()
> after pci_scan_root_bus(), so we only need to remove the first call:
> 
>   pci_common_init_dev
>     pcibios_init_hw
>       pci_scan_root_bus
>         pci_bus_add_devices        # first call
>     pci_bus_assign_resources
>     pci_bus_add_devices            # second call
> 
> [bhelgaas: changelog, drop "root_bus" var in alpha common_init_pci(),
> return failure earlier in mn10300, add "return" in x86 pcibios_scan_root(),
> return early if xtensa platform_pcibios_fixup() fails]
> Signed-off-by: Yijing Wang <wangyijing@xxxxxxxxxx>
> Signed-off-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
> CC: Richard Henderson <rth@xxxxxxxxxxx>
> CC: Ivan Kokshaysky <ink@xxxxxxxxxxxxxxxxxxxx>
> CC: Matt Turner <mattst88@xxxxxxxxx>
> CC: David Howells <dhowells@xxxxxxxxxx>
> CC: Tony Luck <tony.luck@xxxxxxxxx>
> CC: Michal Simek <monstr@xxxxxxxxx>
> CC: Ralf Baechle <ralf@xxxxxxxxxxxxxx>
> CC: Koichi Yasutake <yasutake.koichi@xxxxxxxxxxxxxxxx>
> CC: Sebastian Ott <sebott@xxxxxxxxxxxxxxxxxx>
> CC: "David S. Miller" <davem@xxxxxxxxxxxxx>
> CC: Chris Metcalf <cmetcalf@xxxxxxxxxx>
> CC: Chris Zankel <chris@xxxxxxxxxx>
> CC: Max Filippov <jcmvbkbc@xxxxxxxxx>
> CC: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> ---
>  arch/alpha/kernel/pci.c          |    7 +++++++
>  arch/frv/mb93090-mb00/pci-vdk.c  |    6 +++++-
>  arch/ia64/sn/kernel/io_init.c    |    2 ++
>  arch/microblaze/pci/pci-common.c |    4 ++++
>  arch/mips/pci/pci.c              |    1 +
>  arch/mn10300/unit-asb2305/pci.c  |    6 +++++-
>  arch/s390/pci/pci.c              |    2 +-
>  arch/sh/drivers/pci/pci.c        |    1 +
>  arch/sparc/kernel/leon_pci.c     |    1 +
>  arch/tile/kernel/pci.c           |    2 ++
>  arch/tile/kernel/pci_gx.c        |    2 ++
>  arch/x86/pci/common.c            |    2 ++
>  arch/xtensa/kernel/pci.c         |   15 +++++++++++++--
>  drivers/pci/host/pci-versatile.c |    1 +
>  drivers/pci/probe.c              |    1 -
>  15 files changed, 47 insertions(+), 6 deletions(-)

Applied to pci/enumeration for v4.1.  This adds a fix for versatile.

Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux