07 Jan, 2012

40 commits

  • DEVICE_COUNT_RESOURCE will be bigger than 16 when SRIOV supported is enabled.

    Let them pass with int just like pci_enable_resources().

    Signed-off-by: Yinghai Lu
    Signed-off-by: Jesse Barnes

    Yinghai Lu
     
  • Save some bytes for device resource array.

    Signed-off-by: Yinghai Lu
    Signed-off-by: Jesse Barnes

    Yinghai Lu
     
  • The chip is an I/O hub used by some Atom boards. Most of those
    symbols are used in arch/x86/platform/sta2x11/sta2x11.c (to be
    introduced) and in the specific drivers as well.

    Signed-off-by: Alessandro Rubini
    Acked-by: Giancarlo Asnaghi
    Cc: Alan Cox
    Signed-off-by: Jesse Barnes

    Alessandro Rubini
     
  • Some Dell BIOSes have MCFG tables that don't report the entire
    MMCONFIG area claimed by the chipset. If we move PCI devices into
    that claimed-but-unreported area, they don't work.

    This quirk reads the AMD MMCONFIG MSRs and adds PNP0C01 resources as
    needed to cover the entire area.

    Example problem scenario:

    BIOS-e820: 00000000cfec5400 - 00000000d4000000 (reserved)
    Fam 10h mmconf [d0000000, dfffffff]
    PCI: MMCONFIG for domain 0000 [bus 00-3f] at [mem 0xd0000000-0xd3ffffff] (base 0xd0000000)
    pnp 00:0c: [mem 0xd0000000-0xd3ffffff]
    pci 0000:00:12.0: reg 10: [mem 0xffb00000-0xffb00fff]
    pci 0000:00:12.0: no compatible bridge window for [mem 0xffb00000-0xffb00fff]
    pci 0000:00:12.0: BAR 0: assigned [mem 0xd4000000-0xd40000ff]

    Reported-by: Lisa Salimbas
    Reported-by:
    Tested-by: dann frazier
    References: https://bugzilla.kernel.org/show_bug.cgi?id=31602
    References: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/647043
    References: https://bugzilla.redhat.com/show_bug.cgi?id=770308
    Cc: stable@kernel.org # 2.6.34+
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • This factors out the AMD native MMCONFIG discovery so we can use it
    outside amd_bus.c.

    amd_bus.c reads AMD MSRs so it can remove the MMCONFIG area from the
    PCI resources. We may also need the MMCONFIG information to work
    around BIOS defects in the ACPI MCFG table.

    Cc: Borislav Petkov
    Cc: Yinghai Lu
    Cc: stable@kernel.org # 2.6.34+
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • During S3 or S4 resume or PCI reset, ATS regs aren't restored correctly.
    This patch enables ATS at the device state restore if PCI device has ATS
    capability.

    Signed-off-by: Xudong Hao
    Signed-off-by: Xiantao Zhang
    Signed-off-by: Jesse Barnes

    Hao, Xudong
     
  • This warning was recently reported to me:

    ------------[ cut here ]------------
    WARNING: at lib/kobject.c:595 kobject_put+0x50/0x60()
    Hardware name: VMware Virtual Platform
    kobject: '(null)' (ffff880027b0df40): is not initialized, yet kobject_put() is
    being called.
    Modules linked in: vmxnet3(+) vmw_balloon i2c_piix4 i2c_core shpchp raid10
    vmw_pvscsi
    Pid: 630, comm: modprobe Tainted: G W 3.1.6-1.fc16.x86_64 #1
    Call Trace:
    [] warn_slowpath_common+0x7f/0xc0
    [] warn_slowpath_fmt+0x46/0x50
    [] ? free_desc+0x63/0x70
    [] kobject_put+0x50/0x60
    [] free_msi_irqs+0xd5/0x120
    [] pci_enable_msi_block+0x24c/0x2c0
    [] vmxnet3_alloc_intr_resources+0x173/0x240 [vmxnet3]
    [] vmxnet3_probe_device+0x615/0x834 [vmxnet3]
    [] local_pci_probe+0x5c/0xd0
    [] pci_device_probe+0x109/0x130
    [] driver_probe_device+0x9c/0x2b0
    [] __driver_attach+0xab/0xb0
    [] ? driver_probe_device+0x2b0/0x2b0
    [] ? driver_probe_device+0x2b0/0x2b0
    [] bus_for_each_dev+0x5c/0x90
    [] driver_attach+0x1e/0x20
    [] bus_add_driver+0x1b0/0x2a0
    [] ? 0xffffffffa0187fff
    [] driver_register+0x76/0x140
    [] ? printk+0x51/0x53
    [] ? 0xffffffffa0187fff
    [] __pci_register_driver+0x56/0xd0
    [] vmxnet3_init_module+0x3a/0x3c [vmxnet3]
    [] do_one_initcall+0x42/0x180
    [] sys_init_module+0x91/0x200
    [] system_call_fastpath+0x16/0x1b
    ---[ end trace 44593438a59a9558 ]---
    Using INTx interrupt, #Rx queues: 1.

    It occurs when populate_msi_sysfs fails, which in turn causes free_msi_irqs to
    be called. Because populate_msi_sysfs fails, we never registered any of the
    msi irq sysfs objects, but free_msi_irqs still calls kobject_del and kobject_put
    on each of them, which gets flagged in the above stack trace.

    The fix is pretty straightforward. We can key of the parent pointer in the
    kobject. It is only set if the kobject_init_and_add succededs in
    populate_msi_sysfs. If anything fails there, each kobject has its parent reset
    to NULL

    Signed-off-by: Neil Horman
    CC: Bjorn Helgaas
    CC: Greg Kroah-Hartman
    CC: linux-pci@vger.kernel.org
    Signed-off-by: Jesse Barnes

    Neil Horman
     
  • Just fix this help text.

    Signed-off-by: P. Christeas
    Signed-off-by: Jesse Barnes

    P. Christeas
     
  • When the runtime PM is activated on PCI, if a device switches state
    frequently (e.g. an EHCI controller with autosuspending USB devices
    connected) the PCI configuration traces might be very verbose in the
    kernel log. Let's guard those traces with DEBUG condition.

    Acked-by: "Rafael J. Wysocki"
    Signed-off-by: Vincent Palatin
    Signed-off-by: Jesse Barnes

    Vincent Palatin
     
  • All users of pci_create_bus() have been converted to pci_create_root_bus(),
    so remove it.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • Convert from pci_scan_bus() to pci_scan_root_bus() and remove root bus
    fixups. This fixes the problem of "early" and "header" quirks
    seeing incorrect root bus resources.

    This arch was unusual because it filled in bus->resource[0..3] in
    pcibios_init(), then overwrote them, applied io_space.offset and
    checked for unset resources in pcibios_fixup_bus(). I moved all of
    that to a new pci_controller_apertures() that we can use before
    scanning the root bus.

    CC: Chris Zankel
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • x86 has two kinds of PCI root bus scanning:

    (1) ACPI-based, using _CRS resources. This used pci_create_bus(), not
    pci_scan_bus(), because ACPI hotplug needed to split the
    pci_bus_add_devices() into a separate host bridge .start() method.

    This patch parses the _CRS resources earlier, so we can build a list of
    resources and pass it to pci_create_root_bus().

    Note that as before, we parse the _CRS even if we aren't going to use
    it so we can print it for debugging purposes.

    (2) All other, which used either default resources (ioport_resource and
    iomem_resource) or information read from the hardware via amd_bus.c or
    similar. This used pci_scan_bus().

    This patch converts x86_pci_root_bus_res_quirks() (previously called
    from pcibios_fixup_bus()) to x86_pci_root_bus_resources(), which builds
    a list of resources before we call pci_scan_root_bus().

    We also use x86_pci_root_bus_resources() if we have ACPI but are
    ignoring _CRS.

    CC: Yinghai Lu
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • This doesn't change any functionality, but it makes a subsequent patch
    slightly simpler.

    pci_scan_bus(NULL, ...) and pci_scan_bus_parented() are identical except
    that pci_scan_bus() also calls pci_bus_add_devices():

    pci_scan_bus_parented
    pci_create_bus
    pci_scan_child_bus

    pci_scan_bus
    pci_create_bus
    pci_scan_child_bus
    pci_bus_add_devices

    All callers of pcibios_scan_root() call pci_bus_add_devices() explicitly,
    and we don't pass a parent device, so we might as well use pci_scan_bus().

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • We currently read the CNB20LE aperture information in a PCI quirk,
    which happens after we've already created the root bus. This patch
    changes it to read the apertures earlier so we can create the root
    bus with the correct resources.

    I believe the CNB20LE lives at "pci 0000:00:00" based on
    https://lkml.org/lkml/2010/8/13/220

    CC: Ira W. Snyder
    CC: Yinghai Lu
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • Convert from pci_scan_bus_parented() to pci_scan_root_bus() and remove root
    bus resource fixups. This fixes the problem of "early" and "header" quirks
    seeing incorrect root bus resources.

    pci_scan_root_bus() also includes the pci_bus_add_devices() so we don't
    need to do that separately.

    Signed-off-by: Bjorn Helgaas
    Acked-by: David S. Miller
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • Convert from pci_create_bus() to pci_create_root_bus(). This way the root
    bus resources are correct immediately. This patch doesn't fix a problem
    because sparc fixed the resources before scanning the bus, but it makes
    sparc more consistent with other architectures.

    v2: fix build error (from sfr)

    Signed-off-by: Bjorn Helgaas
    Acked-by: David S. Miller
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • Convert from pci_scan_bus() to pci_scan_root_bus() and remove root bus
    resource fixups. This fixes the problem of "early" and "header" quirks
    seeing incorrect root bus resources.

    CC: Paul Mundt
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • Convert from pci_create_bus() to pci_create_root_bus(). This way the root
    bus resources are correct immediately. This patch doesn't fix a problem
    because powerpc fixed the resources before scanning the bus, but it makes
    powerpc more consistent with other architectures.

    v2: fix build error with resource pointer passing

    CC: Benjamin Herrenschmidt
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • No functional change. This is so we can use pcibios_phb_map_io_space()
    before we have a struct pci_bus.

    v2: fix map io phb typo

    CC: Benjamin Herrenschmidt
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • CC: Benjamin Herrenschmidt
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • Supply root bus resources to pci_create_root_bus() so they're correct
    immediately. This fixes the problem of "early" and "header" quirks seeing
    incorrect root bus resources.

    CC: linux-parisc@vger.kernel.org
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • No functional change here; just converting from pci_scan_bus_parented()
    to pci_create_bus() to make a future patch simpler.

    CC: linux-parisc@vger.kernel.org
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • This moves the truncate_pat_collision() call out of the pcibios_fixup_bus()
    path so that when a future patch builds a list of root bus resources for
    pci_create_bus(), it can use the truncated LMMIO range.

    truncate_pat_collision() used to be called in this path:

    pci_scan_bus_parented
    pci_create_bus
    pci_scan_child_bus
    pcibios_fixup_bus
    lba_fixup_bus
    truncate_pat_collision

    All of the PAT and lba_dev resource setup must be done before we call
    pci_scan_bus_parented(), so it should be safe to move the
    truncate_pat_collision() to just before pci_scan_bus_parented().

    CC: linux-parisc@vger.kernel.org
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • Supply root bus resources to pci_create_root_bus() so they're correct
    immediately. This fixes the problem of "early" and "header" quirks seeing
    incorrect root bus resources.

    CC: linux-parisc@vger.kernel.org
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • No functional change here; just converting from pci_scan_bus_parented()
    to pci_create_bus() to make a future patch simpler.

    CC: linux-parisc@vger.kernel.org
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • Convert from pci_scan_bus() to pci_scan_root_bus() and remove root bus
    resource fixups. This fixes the problem of "early" and "header" quirks
    seeing incorrect root bus resources.

    CC: David Howells
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • Convert from pci_scan_bus() to pci_scan_root_bus() and remove root bus
    resource fixups. This fixes the problem of "early" and "header" quirks
    seeing incorrect root bus resources.

    Based on original patch by Deng-Cheng Zhu.

    Reference: https://lkml.org/lkml/2011/8/26/89
    CC: Ralf Baechle
    Signed-off-by: Deng-Cheng Zhu
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • Microblaze doesn't need to replace pci_scan_child_bus() or do anything
    special before pci_bus_add_devices(), so we can use the more generic PCI
    path in pci_scan_root_bus().

    CC: Michal Simek
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • Convert from pci_create_bus() to pci_create_root_bus(). This way the root
    bus resources are correct immediately. This patch doesn't fix a problem
    because microblaze fixed the resources before scanning the bus, but it makes
    microblaze more consistent with other architectures. It also allows us to
    use the pci_scan_root_bus() path safely.

    CC: Michal Simek
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • CC: Michal Simek
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • The pci_bus_for_each_resource() iterator sets "res" itself, so there's
    no need to look it up in the bus->resource[] table.

    Logically part of 89a74ecccd and 8a66da71fa.

    CC: Michal Simek
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • Convert from pci_create_bus() to pci_create_root_bus(). This way the root
    bus resources are correct immediately. This fixes the problem of "early"
    and "header" quirks seeing incorrect root bus resources.

    We can't use pci_scan_root_bus() because, like x86, ACPI hotplug currently
    requires pci_bus_add_devices() in a separate host bridge .start() method.

    v2: fix compile error by using window resource pointer instead

    CC: Tony Luck
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • This doesn't change any functionality, but it makes a subsequent patch
    slightly simpler.

    CC: Tony Luck
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • Convert from pci_scan_bus() to pci_scan_root_bus() and remove root bus
    resource fixups. This fixes the problem of "early" and "header" quirks
    seeing incorrect root bus resources.

    Note that peer root buses are scanned with pci_scan_bus() (which is now
    deprecated), so they have the default ioport_resource and iomem_resource
    resources. This is unchanged from before, but these resources are
    incorrect, and I don't know how to discover the correct ones.

    CC: David Howells
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • Convert from pci_scan_bus() to pci_scan_root_bus() and remove root bus
    resource fixups. This fixes the problem of "early" and "header" quirks
    seeing incorrect root bus resources.

    CC: Russell King
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • Convert from pci_scan_bus() to pci_scan_root_bus() and remove root bus
    resource fixups. This fixes the problem of "early" and "header" quirks
    seeing incorrect root bus resources.

    v2: fix up conversion

    CC: linux-alpha@vger.kernel.org
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • Users of pci_scan_bus_parented() should be converted to use either
    pci_scan_root_bus() (preferred, but also calls pci_bus_add_devices)
    or
    pci_create_root_bus()
    pci_scan_child_bus()

    Since pci_scan_bus_parented(), I'm marking it deprecated now and will
    actually remove it later.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • This converts pci_scan_bus_parented() to use pci_create_root_bus()
    instead of pci_create_bus(). The new bus still has the default (incorrect)
    resources, so this patch doesn't help fix that problem, but it does remove
    one more use of pci_create_bus().

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • I plan to deprecate pci_scan_bus_parented(), so use pci_create_root_bus()
    directly instead. pci_scan_bus() itself will be removed as soon as all
    callers are gone, so this is just an interim step.

    v2: export pci_scan_bus

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     
  • "Early" and "header" quirks often use incorrect bus resources because they
    see the default resources assigned by pci_create_bus(), before the
    architecture fixes them up (typically in pcibios_fixup_bus()). Regions
    reserved by these quirks end up with the wrong parents.

    Here's the standard path for scanning a PCI root bus:

    pci_scan_bus or pci_scan_bus_parented
    pci_create_bus
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas