public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: linux-pci@vger.kernel.org
Cc: linux-arch@vger.kernel.org
Subject: [PATCH v3 00/34] Create PCI root buses with correct resources
Date: Fri, 28 Oct 2011 16:25:29 -0600	[thread overview]
Message-ID: <20111028222432.30729.8431.stgit@bhelgaas.mtv.corp.google.com> (raw)

The most generic way to create a PCI root bus is with pci_scan_bus(), but that
doesn't allow you to specify what resources are available on the bus, i.e.,
what the host bridge apertures are.  This series fixes the problem by adding
a new pci_scan_root_bus() interface that takes a list of bus resources.

pci_scan_bus() uses pci_create_bus(), which uses default resources of
ioport_resource and iomem_resource.  The architecture has to fix them later in
pcibios_fixup_bus().  Between creation and fixup, we run quirks, and they see
the wrong bus resources:

  pci_scan_bus or pci_scan_bus_parented
    pci_create_bus                     <-- A create with default resources
    pci_scan_child_bus
      pci_scan_slot
        pci_scan_single_device
          pci_scan_device
            pci_setup_device
              pci_fixup_device(early)  <-- B
          pci_device_add
            pci_fixup_device(header)   <-- C
      pcibios_fixup_bus                <-- D fill in correct resources

Early and header quirks at B and C use the default (incorrect) root
bus resources rather than those filled in at D.  If they request any
regions, they get the wrong parent.  quirk_piix4_acpi() tripped over
this on MIPS and caused a driver to fail with unexpected conflicts
(http://www.spinics.net/lists/mips/msg41654.html).

A few architectures avoid this problem by using pci_create_bus()
directly and fixing the root bus resources before scanning the bus.
But that's ugly and is normally done because the arch needs a different
bus scanner, such as pci_of_scan_bus().  This series converts those to
a new pci_create_root_bus(), so they can at least specify the root bus
resources up front.


Changes since V2:
    - use LIST_HEAD() initializers
    - callers of pci_create_root_bus() MUST supply resource list (no defaults)
    - export pci_add_resource(), pci_free_resource_list()
    - export pci_scan_root_bus() (to replace exported pci_scan_bus_parented())
    - deprecate & schedule removal of pci_scan_bus_parented()
    - FRV: leave peer root buses with default resources
    - sh: pcibios_fixup_bus: remove unused "dev" initialization
    - x86: move broadcom_bus.c from PCI early quirk to postcore_initcall
    - x86: fall back to default root bus resources (from amd_bus.c or just
      ioport_resource and iomem_resource) if _CRS fails
    - xtensa: fix io_offset application in pci_controller_apertures()
    - remove pci_create_bus()

Changes since V1:
    - left existing interfaces unchanged, but deprecated
    - added pci_create_root_bus() and pci_scan_root_bus()
    - fixed many more architectures

---

Bjorn Helgaas (34):
      PCI: add helpers for building PCI bus resource lists
      PCI: show host bridges and root bus resources
      PCI: add pci_create_root_bus() that accepts resource list
      PCI: add pci_scan_root_bus() that accepts resource list
      PCI: convert pci_scan_bus() to use pci_create_root_bus()
      PCI: convert pci_scan_bus_parented() to use pci_create_root_bus()
      PCI: deprecate pci_scan_bus_parented()
      alpha/PCI: convert to pci_scan_root_bus() for correct root bus resources
      arm/PCI: convert to pci_scan_root_bus() for correct root bus resources
      frv/PCI: convert to pci_scan_root_bus() for correct root bus resources
      ia64/PCI: use pci_create_bus() instead of pci_scan_bus_parented()
      ia64/PCI: convert to pci_create_root_bus() for correct root bus resources
      microblaze/PCI: fix pci_bus_for_each_resource() usage
      microblaze/PCI: make pcibios_setup_phb_resources() static
      microblaze/PCI: convert to pci_create_root_bus() for correct root bus resources
      microblaze/PCI: use pci_scan_root_bus()
      mips/PCI: convert to pci_scan_root_bus() for correct root bus resources
      mn10300/PCI: convert to pci_scan_root_bus() for correct root bus resources
      parisc/PCI: dino: use pci_create_bus() instead of pci_scan_bus_parented()
      parisc/PCI: dino: convert to pci_create_root_bus() for correct root bus resources
      parisc/PCI: lba: deal with LMMIO/PAT overlaps before creating PCI root bus
      parisc/PCI: lba: use pci_create_bus() instead of pci_scan_bus_parented()
      parisc/PCI: lba: convert to pci_create_root_bus() for correct root bus resources
      powerpc/PCI: make pcibios_setup_phb_resources() static
      powerpc/PCI: split PHB part out of pcibios_map_io_space()
      powerpc/PCI: convert to pci_create_root_bus()
      sh/PCI: convert to pci_scan_root_bus() for correct root bus resources
      sparc/PCI: convert to pci_create_root_bus()
      sparc32,leon/PCI: convert to pci_scan_root_bus() for correct root bus resources
      x86/PCI: read Broadcom CNB20LE host bridge info before PCI scan
      x86/PCI: use pci_scan_bus() instead of pci_scan_bus_parented()
      x86/PCI: convert to pci_create_root_bus() and pci_scan_root_bus()
      xtensa/PCI: convert to pci_scan_root_bus() for correct root bus resources
      PCI: remove pci_create_bus()


 Documentation/feature-removal-schedule.txt |   12 ++++
 arch/alpha/kernel/pci.c                    |   37 +++++++-----
 arch/arm/common/it8152.c                   |    6 +-
 arch/arm/common/via82c505.c                |    3 +
 arch/arm/include/asm/mach/pci.h            |    2 -
 arch/arm/kernel/bios32.c                   |   27 +++------
 arch/arm/mach-cns3xxx/pcie.c               |    8 +--
 arch/arm/mach-dove/pcie.c                  |    9 +--
 arch/arm/mach-footbridge/dc21285.c         |    8 +--
 arch/arm/mach-integrator/pci_v3.c          |   19 +++---
 arch/arm/mach-iop13xx/pci.c                |   17 +++---
 arch/arm/mach-ixp2000/enp2611.c            |    3 +
 arch/arm/mach-ixp2000/pci.c                |    8 +--
 arch/arm/mach-ixp23xx/pci.c                |    8 +--
 arch/arm/mach-ixp4xx/common-pci.c          |    8 +--
 arch/arm/mach-kirkwood/pcie.c              |    8 +--
 arch/arm/mach-ks8695/pci.c                 |    8 +--
 arch/arm/mach-mv78xx0/pcie.c               |    8 +--
 arch/arm/mach-orion5x/pci.c                |   16 +++--
 arch/arm/mach-sa1100/pci-nanoengine.c      |    9 ++-
 arch/arm/mach-tegra/pcie.c                 |    9 ++-
 arch/arm/mach-versatile/pci.c              |   19 +++---
 arch/arm/plat-iop/pci.c                    |    8 +--
 arch/frv/mb93090-mb00/pci-vdk.c            |   11 ++--
 arch/ia64/pci/pci.c                        |   40 +++++--------
 arch/microblaze/include/asm/pci-bridge.h   |    1 
 arch/microblaze/pci/pci-common.c           |   38 +++++--------
 arch/mips/pci/pci.c                        |   17 +++---
 arch/mn10300/unit-asb2305/pci.c            |   12 ++--
 arch/powerpc/include/asm/pci-bridge.h      |    1 
 arch/powerpc/kernel/pci-common.c           |   25 +++++---
 arch/powerpc/kernel/pci_64.c               |   40 +++++++------
 arch/sh/drivers/pci/pci.c                  |   20 +++----
 arch/sparc/kernel/leon_pci.c               |   25 +++-----
 arch/sparc/kernel/pci.c                    |   17 ++----
 arch/x86/include/asm/topology.h            |    2 -
 arch/x86/pci/acpi.c                        |   28 +++++----
 arch/x86/pci/broadcom_bus.c                |   62 +++++++++++++-------
 arch/x86/pci/bus_numa.c                    |   31 ++++++----
 arch/x86/pci/common.c                      |   19 ++++--
 arch/x86/pci/legacy.c                      |    3 -
 arch/x86/pci/numaq_32.c                    |    2 -
 arch/xtensa/kernel/pci.c                   |   85 ++++++++++++++--------------
 drivers/parisc/dino.c                      |   47 ++++++++-------
 drivers/parisc/lba_pci.c                   |   72 +++++++++++++-----------
 drivers/pci/bus.c                          |   32 +++++++++--
 drivers/pci/probe.c                        |   65 +++++++++++++++++++--
 include/linux/pci.h                        |   20 +++----
 48 files changed, 530 insertions(+), 445 deletions(-)

-- 
Bjorn

             reply	other threads:[~2011-10-28 22:25 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-28 22:25 Bjorn Helgaas [this message]
2011-10-28 22:25 ` [PATCH v3 01/34] PCI: add helpers for building PCI bus resource lists Bjorn Helgaas
2011-12-05 19:54   ` Jesse Barnes
2011-10-28 22:25 ` [PATCH v3 02/34] PCI: show host bridges and root bus resources Bjorn Helgaas
2011-10-28 22:25   ` Bjorn Helgaas
2011-10-28 22:25 ` [PATCH v3 03/34] PCI: add pci_create_root_bus() that accepts resource list Bjorn Helgaas
2011-10-28 22:25 ` [PATCH v3 04/34] PCI: add pci_scan_root_bus() " Bjorn Helgaas
2011-10-28 22:25 ` [PATCH v3 05/34] PCI: convert pci_scan_bus() to use pci_create_root_bus() Bjorn Helgaas
2011-10-28 22:26 ` [PATCH v3 06/34] PCI: convert pci_scan_bus_parented() " Bjorn Helgaas
2011-10-28 22:26 ` [PATCH v3 07/34] PCI: deprecate pci_scan_bus_parented() Bjorn Helgaas
2011-10-28 22:26   ` Bjorn Helgaas
2011-10-28 22:26 ` [PATCH v3 08/34] alpha/PCI: convert to pci_scan_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-28 22:26   ` Bjorn Helgaas
2011-12-16 21:24   ` Bjorn Helgaas
2012-01-04 17:38     ` Jesse Barnes
2012-01-04 17:38       ` Jesse Barnes
2011-10-28 22:26 ` [PATCH v3 09/34] arm/PCI: " Bjorn Helgaas
2011-10-28 22:26   ` Bjorn Helgaas
2011-12-23  1:10   ` Bjorn Helgaas
2012-01-04 17:28     ` Jesse Barnes
2012-01-04 17:28       ` Jesse Barnes
2011-10-28 22:26 ` [PATCH v3 10/34] frv/PCI: " Bjorn Helgaas
2011-10-28 22:26   ` Bjorn Helgaas
2011-10-28 22:26 ` [PATCH v3 11/34] ia64/PCI: use pci_create_bus() instead of pci_scan_bus_parented() Bjorn Helgaas
2011-10-28 22:26   ` Bjorn Helgaas
2011-10-28 22:26 ` [PATCH v3 12/34] ia64/PCI: convert to pci_create_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-28 22:26 ` [PATCH v3 13/34] microblaze/PCI: fix pci_bus_for_each_resource() usage Bjorn Helgaas
2011-10-28 22:26 ` [PATCH v3 14/34] microblaze/PCI: make pcibios_setup_phb_resources() static Bjorn Helgaas
2011-10-28 22:26   ` Bjorn Helgaas
2011-10-28 22:26 ` [PATCH v3 15/34] microblaze/PCI: convert to pci_create_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-28 22:26   ` Bjorn Helgaas
2011-10-28 22:26 ` [PATCH v3 16/34] microblaze/PCI: use pci_scan_root_bus() Bjorn Helgaas
2011-10-28 22:26   ` Bjorn Helgaas
2011-10-28 22:26 ` [PATCH v3 17/34] mips/PCI: convert to pci_scan_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-28 22:26   ` Bjorn Helgaas
2011-10-28 22:27 ` [PATCH v3 18/34] mn10300/PCI: " Bjorn Helgaas
2011-10-28 22:27 ` [PATCH v3 19/34] parisc/PCI: dino: use pci_create_bus() instead of pci_scan_bus_parented() Bjorn Helgaas
2011-10-28 22:27   ` Bjorn Helgaas
2011-10-28 22:27 ` [PATCH v3 20/34] parisc/PCI: dino: convert to pci_create_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-28 22:27   ` Bjorn Helgaas
2011-10-28 22:27 ` [PATCH v3 21/34] parisc/PCI: lba: deal with LMMIO/PAT overlaps before creating PCI root bus Bjorn Helgaas
2011-10-28 22:27   ` Bjorn Helgaas
2011-10-28 22:27 ` [PATCH v3 22/34] parisc/PCI: lba: use pci_create_bus() instead of pci_scan_bus_parented() Bjorn Helgaas
2011-10-28 22:27   ` Bjorn Helgaas
2011-10-28 22:27 ` [PATCH v3 23/34] parisc/PCI: lba: convert to pci_create_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-28 22:27 ` [PATCH v3 24/34] powerpc/PCI: make pcibios_setup_phb_resources() static Bjorn Helgaas
2011-10-28 22:27   ` Bjorn Helgaas
2011-10-28 22:27 ` [PATCH v3 25/34] powerpc/PCI: split PHB part out of pcibios_map_io_space() Bjorn Helgaas
2011-10-28 22:27   ` Bjorn Helgaas
2011-12-06 18:07   ` Bjorn Helgaas
2011-10-28 22:27 ` [PATCH v3 26/34] powerpc/PCI: convert to pci_create_root_bus() Bjorn Helgaas
2011-10-28 22:27   ` Bjorn Helgaas
2011-12-06 18:09   ` Bjorn Helgaas
2011-12-06 18:09     ` Bjorn Helgaas
2011-10-28 22:27 ` [PATCH v3 27/34] sh/PCI: convert to pci_scan_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-28 22:27   ` Bjorn Helgaas
2011-10-28 22:27 ` [PATCH v3 28/34] sparc/PCI: convert to pci_create_root_bus() Bjorn Helgaas
2011-10-28 22:27   ` Bjorn Helgaas
2011-10-28 22:27 ` [PATCH v3 29/34] sparc32, leon/PCI: convert to pci_scan_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-28 22:27   ` Bjorn Helgaas
2011-10-28 22:28 ` [PATCH v3 30/34] x86/PCI: read Broadcom CNB20LE host bridge info before PCI scan Bjorn Helgaas
2011-10-28 22:28 ` [PATCH v3 31/34] x86/PCI: use pci_scan_bus() instead of pci_scan_bus_parented() Bjorn Helgaas
2011-10-28 22:28   ` Bjorn Helgaas
2011-10-28 22:28 ` [PATCH v3 32/34] x86/PCI: convert to pci_create_root_bus() and pci_scan_root_bus() Bjorn Helgaas
2011-10-28 22:28   ` Bjorn Helgaas
2011-10-28 22:28 ` [PATCH v3 33/34] xtensa/PCI: convert to pci_scan_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-28 22:28 ` [PATCH v3 34/34] PCI: remove pci_create_bus() Bjorn Helgaas
2011-10-29 16:25 ` [PATCH v3 00/34] Create PCI root buses with correct resources Bjorn Helgaas
2011-11-11 16:40   ` Bjorn Helgaas
2011-11-11 16:40     ` Bjorn Helgaas
2011-11-28 18:58     ` Bjorn Helgaas
2011-11-28 18:58       ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111028222432.30729.8431.stgit@bhelgaas.mtv.corp.google.com \
    --to=bhelgaas@google.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox