03 Oct, 2018

1 commit

  • Currently, a hotplug bridge will be given hpmemsize additional memory
    and hpiosize additional io if available, in order to satisfy any future
    hotplug allocation requirements.

    These calculations don't consider the current memory/io size of the
    hotplug bridge/slot, so hotplug bridges/slots which have downstream
    devices will be allocated their current allocation in addition to the
    hpmemsize value.

    This makes for possibly undesirable results with a mix of unoccupied and
    occupied slots (ex, with hpmemsize=2M):

    02:03.0 PCI bridge:
    Signed-off-by: Bjorn Helgaas

    Jon Derrick
     

05 Jun, 2018

1 commit

  • If there is only a single bridge on the bus, we assign all resources to it.
    Currently this is done as a part of the resource distribution loop but it
    does not have to be there, and moving it outside actually improves
    readability because we can then save one indent level in the loop.

    While there we can add hotplug_bridges == 1 && normal_bridges == 0 to
    the same block because they are dealt the same way.

    Suggested-by: Bjorn Helgaas
    Signed-off-by: Mika Westerberg
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Rafael J. Wysocki
    Reviewed-by: Andy Shevchenko

    Mika Westerberg
     

20 Mar, 2018

1 commit

  • Remove pointless comments that tell us the file name, remove blank line
    comments, follow multi-line comment conventions. No functional change
    intended.

    Signed-off-by: Bjorn Helgaas

    Bjorn Helgaas
     

02 Feb, 2018

1 commit

  • * pci/spdx:
    PCI: Add SPDX GPL-2.0+ to replace implicit GPL v2 or later statement
    PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate
    PCI: Add SPDX GPL-2.0 to replace COPYING boilerplate
    PCI: Add SPDX GPL-2.0 to replace GPL v2 boilerplate
    PCI: Add SPDX GPL-2.0 when no license was specified

    Bjorn Helgaas
     

27 Jan, 2018

1 commit

  • b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier to
    files with no license") added SPDX GPL-2.0 to several PCI files that
    previously contained no license information.

    Add SPDX GPL-2.0 to all other PCI files that did not contain any license
    information and hence were under the default GPL version 2 license of the
    kernel.

    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Greg Kroah-Hartman

    Bjorn Helgaas
     

19 Jan, 2018

1 commit


17 Jan, 2018

1 commit

  • Per ebfdc40969f2 ("checkpatch: attempt to find unnecessary 'out of memory'
    messages"), when a memory allocation fails, the memory subsystem emits
    generic "out of memory" messages (see slab_out_of_memory() for some of this
    logging). Therefore, additional error messages in the caller don't add
    much value.

    Remove messages that merely report "out of memory".

    This preserves some messages that report additional information, e.g.,
    allocation failures that mean we drop hotplug events.

    This issue was detected by using the Coccinelle software.

    Signed-off-by: Markus Elfring
    [bhelgaas: changelog, squash patches, make similar changes to acpiphp,
    cpqphp, ibmphp, keep warning when dropping hotplug event]
    Signed-off-by: Bjorn Helgaas

    Markus Elfring
     

15 Nov, 2017

1 commit

  • * pci/resource:
    PCI: Fail pci_map_rom() if the option ROM is invalid
    PCI: Move pci_map_rom() error path
    x86/PCI: Enable a 64bit BAR on AMD Family 15h (Models 00-1f, 30-3f, 60-7f)
    PCI: Add pci_resize_resource() for resizing BARs
    PCI: Add resizable BAR infrastructure
    PCI: Add PCI resource type mask #define

    Bjorn Helgaas
     

07 Nov, 2017

2 commits

  • The same problem that we have with bus space applies to other resources
    as well. Linux only allocates the minimal amount of resources so that
    the devices currently present barely fit there. This prevents extending
    the chain later on because the resource windows allocated for hotplug
    downstream ports are too small.

    Follow what we already did for bus number and assign all available extra
    resources to hotplug-capable bridges. This makes it possible to extend the
    hierarchy later.

    Signed-off-by: Mika Westerberg
    Signed-off-by: Bjorn Helgaas

    Mika Westerberg
     
  • The following pattern is often used:

    list_for_each_entry(dev, &bus->devices, bus_list) {
    if (pci_is_bridge(dev)) {
    ...
    }
    }

    Add a for_each_pci_bridge() helper to make that code easier to write and
    read by reducing indentation level. It also saves one or few lines of code
    in each occurrence.

    Convert PCI core parts here at the same time.

    Signed-off-by: Andy Shevchenko
    [bhelgaas: fold in http://lkml.kernel.org/r/20171013165352.25550-1-andriy.shevchenko@linux.intel.com]
    Signed-off-by: Bjorn Helgaas

    Andy Shevchenko
     

26 Oct, 2017

1 commit

  • Add a pci_resize_resource() interface to allow device drivers to resize
    BARs of their devices.

    This is useful for devices with large local storage, e.g., graphics
    devices. These devices often only expose 256MB BARs initially to be
    compatible with 32-bit systems.

    This function only tries to reprogram the windows of the bridge directly
    above the requesting device and only the BAR of the same type (usually mem,
    64bit, prefetchable). This is done to avoid disturbing other drivers by
    changing the BARs of their devices.

    Drivers should use the following sequence to resize their BARs:
    1. Disable memory decoding of the device using the PCI cfg dword.
    2. Use pci_release_resource() to release all BARs which can move during the
    resize, including the one you want to resize.
    3. Call pci_resize_resource() for each BAR you want to resize.
    4. Call pci_assign_unassigned_bus_resources() to reassign new locations
    for all BARs which are not resized, but could move.
    5. If everything worked as expected, enable memory decoding in the device
    again using the PCI cfg dword.

    Signed-off-by: Christian König
    Signed-off-by: Bjorn Helgaas

    Christian König
     

25 Oct, 2017

1 commit


19 Apr, 2017

1 commit


30 Dec, 2016

1 commit


11 Sep, 2016

1 commit

  • Some PCI root bridges don't have a corresponding ACPI device.
    This can be the case on some old platforms. Don't call acpi_ioapic_add()
    on these bridges because they can't support ioapic hotplug.

    Reported-and-tested-by: Borislav Petkov
    Signed-off-by: Rui Wang
    Reviewed-by: Borislav Petkov
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: bhelgaas@google.com
    Cc: helgaas@kernel.org
    Cc: linux-acpi@vger.kernel.org
    Cc: linux-pci@vger.kernel.org
    Cc: rjw@rjwysocki.net
    Cc: tony.luck@intel.com
    Link: http://lkml.kernel.org/r/1473522046-31329-1-git-send-email-rui.y.wang@intel.com
    Signed-off-by: Ingo Molnar

    Rui Wang
     

18 Aug, 2016

1 commit

  • IOAPICs present during system boot aren't added to ioapic_list,
    thus are unable to be hot-removed. Fix it by calling
    acpi_ioapic_add() during root bus enumeration.

    Signed-off-by: Rui Wang
    Acked-by: Bjorn Helgaas
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: helgaas@kernel.org
    Cc: linux-acpi@vger.kernel.org
    Cc: linux-pci@vger.kernel.org
    Cc: rjw@rjwysocki.net
    Cc: tony.luck@intel.com
    Link: http://lkml.kernel.org/r/1471420837-31003-3-git-send-email-rui.y.wang@intel.com
    Signed-off-by: Ingo Molnar

    Rui Wang
     

03 Aug, 2016

1 commit

  • Pull PCI updates from Bjorn Helgaas:
    "Highlights:

    - ARM64 support for ACPI host bridges

    - new drivers for Axis ARTPEC-6 and Marvell Aardvark

    - new pci_alloc_irq_vectors() interface for MSI-X, MSI, legacy INTx

    - pci_resource_to_user() cleanup (more to come)

    Detailed summary:

    Enumeration:
    - Move ecam.h to linux/include/pci-ecam.h (Jayachandran C)
    - Add parent device field to ECAM struct pci_config_window (Jayachandran C)
    - Add generic MCFG table handling (Tomasz Nowicki)
    - Refactor pci_bus_assign_domain_nr() for CONFIG_PCI_DOMAINS_GENERIC (Tomasz Nowicki)
    - Factor DT-specific pci_bus_find_domain_nr() code out (Tomasz Nowicki)

    Resource management:
    - Add devm_request_pci_bus_resources() (Bjorn Helgaas)
    - Unify pci_resource_to_user() declarations (Bjorn Helgaas)
    - Implement pci_resource_to_user() with pcibios_resource_to_bus() (microblaze, powerpc, sparc) (Bjorn Helgaas)
    - Request host bridge window resources (designware, iproc, rcar, xgene, xilinx, xilinx-nwl) (Bjorn Helgaas)
    - Make PCI I/O space optional on ARM32 (Bjorn Helgaas)
    - Ignore write combining when mapping I/O port space (Bjorn Helgaas)
    - Claim bus resources on MIPS PCI_PROBE_ONLY set-ups (Bjorn Helgaas)
    - Remove unicore32 pci=firmware command line parameter handling (Bjorn Helgaas)
    - Support I/O resources when parsing host bridge resources (Jayachandran C)
    - Add helpers to request/release memory and I/O regions (Johannes Thumshirn)
    - Use pci_(request|release)_mem_regions (NVMe, lpfc, GenWQE, ethernet/intel, alx) (Johannes Thumshirn)
    - Extend pci=resource_alignment to specify device/vendor IDs (Koehrer Mathias (ETAS/ESW5))
    - Add generic pci_bus_claim_resources() (Lorenzo Pieralisi)
    - Claim bus resources on ARM32 PCI_PROBE_ONLY set-ups (Lorenzo Pieralisi)
    - Remove ARM32 and ARM64 arch-specific pcibios_enable_device() (Lorenzo Pieralisi)
    - Add pci_unmap_iospace() to unmap I/O resources (Sinan Kaya)
    - Remove powerpc __pci_mmap_set_pgprot() (Yinghai Lu)

    PCI device hotplug:
    - Allow additional bus numbers for hotplug bridges (Keith Busch)
    - Ignore interrupts during D3cold (Lukas Wunner)

    Power management:
    - Enforce type casting for pci_power_t (Andy Shevchenko)
    - Don't clear d3cold_allowed for PCIe ports (Mika Westerberg)
    - Put PCIe ports into D3 during suspend (Mika Westerberg)
    - Power on bridges before scanning new devices (Mika Westerberg)
    - Runtime resume bridge before rescan (Mika Westerberg)
    - Add runtime PM support for PCIe ports (Mika Westerberg)
    - Remove redundant check of pcie_set_clkpm (Shawn Lin)

    Virtualization:
    - Add function 1 DMA alias quirk for Marvell 88SE9182 (Aaron Sierra)
    - Add DMA alias quirk for Adaptec 3805 (Alex Williamson)
    - Mark Atheros AR9485 and QCA9882 to avoid bus reset (Chris Blake)
    - Add ACS quirk for Solarflare SFC9220 (Edward Cree)

    MSI:
    - Fix PCI_MSI dependencies (Arnd Bergmann)
    - Add pci_msix_desc_addr() helper (Christoph Hellwig)
    - Switch msix_program_entries() to use pci_msix_desc_addr() (Christoph Hellwig)
    - Make the "entries" argument to pci_enable_msix() optional (Christoph Hellwig)
    - Provide sensible IRQ vector alloc/free routines (Christoph Hellwig)
    - Spread interrupt vectors in pci_alloc_irq_vectors() (Christoph Hellwig)

    Error Handling:
    - Bind DPC to Root Ports as well as Downstream Ports (Keith Busch)
    - Remove DPC tristate module option (Keith Busch)
    - Convert Downstream Port Containment driver to use devm_* functions (Mika Westerberg)

    Generic host bridge driver:
    - Select IRQ_DOMAIN (Arnd Bergmann)
    - Claim bus resources on PCI_PROBE_ONLY set-ups (Lorenzo Pieralisi)

    ACPI host bridge driver:
    - Add ARM64 acpi_pci_bus_find_domain_nr() (Tomasz Nowicki)
    - Add ARM64 ACPI support for legacy IRQs parsing and consolidation with DT code (Tomasz Nowicki)
    - Implement ARM64 AML accessors for PCI_Config region (Tomasz Nowicki)
    - Support ARM64 ACPI-based PCI host controller (Tomasz Nowicki)

    Altera host bridge driver:
    - Check link status before retrain link (Ley Foon Tan)
    - Poll for link up status after retraining the link (Ley Foon Tan)

    Axis ARTPEC-6 host bridge driver:
    - Add PCI_MSI_IRQ_DOMAIN dependency (Arnd Bergmann)
    - Add DT binding for Axis ARTPEC-6 PCIe controller (Niklas Cassel)
    - Add Axis ARTPEC-6 PCIe controller driver (Niklas Cassel)

    Intel VMD host bridge driver:
    - Use lock save/restore in interrupt enable path (Jon Derrick)
    - Select device dma ops to override (Keith Busch)
    - Initialize list item in IRQ disable (Keith Busch)
    - Use x86_vector_domain as parent domain (Keith Busch)
    - Separate MSI and MSI-X vector sharing (Keith Busch)

    Marvell Aardvark host bridge driver:
    - Add DT binding for the Aardvark PCIe controller (Thomas Petazzoni)
    - Add Aardvark PCI host controller driver (Thomas Petazzoni)
    - Add Aardvark PCIe support for Armada 3700 (Thomas Petazzoni)

    Microsoft Hyper-V host bridge driver:
    - Fix interrupt cleanup path (Cathy Avery)
    - Don't leak buffer in hv_pci_onchannelcallback() (Vitaly Kuznetsov)
    - Handle all pending messages in hv_pci_onchannelcallback() (Vitaly Kuznetsov)

    NVIDIA Tegra host bridge driver:
    - Program PADS_REFCLK_CFG* always, not just on legacy SoCs (Stephen Warren)
    - Program PADS_REFCLK_CFG* registers with per-SoC values (Stephen Warren)
    - Use lower-case hex consistently for register definitions (Thierry Reding)
    - Use generic pci_remap_iospace() rather than ARM32-specific one (Thierry Reding)
    - Stop setting pcibios_min_mem (Thierry Reding)

    Renesas R-Car host bridge driver:
    - Drop gen2 dummy I/O port region (Bjorn Helgaas)

    TI DRA7xx host bridge driver:
    - Fix return value in case of error (Christophe JAILLET)

    Xilinx AXI host bridge driver:
    - Fix return value in case of error (Christophe JAILLET)

    Miscellaneous:
    - Make bus_attr_resource_alignment static (Ben Dooks)
    - Include for isa_dma_bridge_buggy (Ben Dooks)
    - MAINTAINERS: Add file patterns for PCI device tree bindings (Geert Uytterhoeven)
    - Make host bridge drivers explicitly non-modular (Paul Gortmaker)"

    * tag 'pci-v4.8-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (125 commits)
    PCI: xgene: Make explicitly non-modular
    PCI: thunder-pem: Make explicitly non-modular
    PCI: thunder-ecam: Make explicitly non-modular
    PCI: tegra: Make explicitly non-modular
    PCI: rcar-gen2: Make explicitly non-modular
    PCI: rcar: Make explicitly non-modular
    PCI: mvebu: Make explicitly non-modular
    PCI: layerscape: Make explicitly non-modular
    PCI: keystone: Make explicitly non-modular
    PCI: hisi: Make explicitly non-modular
    PCI: generic: Make explicitly non-modular
    PCI: designware-plat: Make it explicitly non-modular
    PCI: artpec6: Make explicitly non-modular
    PCI: armada8k: Make explicitly non-modular
    PCI: artpec: Add PCI_MSI_IRQ_DOMAIN dependency
    PCI: Add ACS quirk for Solarflare SFC9220
    arm64: dts: marvell: Add Aardvark PCIe support for Armada 3700
    PCI: aardvark: Add Aardvark PCI host controller driver
    dt-bindings: add DT binding for the Aardvark PCIe controller
    PCI: tegra: Program PADS_REFCLK_CFG* registers with per-SoC values
    ...

    Linus Torvalds
     

24 Jun, 2016

1 commit

  • All PCI resources (bridge windows and BARs) should be inserted in the
    iomem_resource and ioport_resource trees so we know what space is occupied
    and what is available for other devices. There's nothing arch-specific
    about this, but it is currently done by arch-specific code.

    Add a generic pci_bus_claim_resources() interface so we can migrate away
    from the arch-specific code.

    [bhelgaas: changelog]
    Signed-off-by: Lorenzo Pieralisi
    Signed-off-by: Bjorn Helgaas
    CC: Arnd Bergmann
    CC: Yinghai Lu

    Lorenzo Pieralisi
     

21 Jun, 2016

1 commit

  • Currently, PowerPC PowerNV platform utilizes ppc_md.pcibios_fixup(),
    which is called for once after PCI probing and resource assignment
    are completed, to allocate platform required resources for PCI devices:
    PE#, IO and MMIO mapping, DMA address translation (TCE) table etc.
    Obviously, it's not hotplug friendly.

    This adds weak function pcibios_setup_bridge(), which is called by
    pci_setup_bridge(). PowerPC PowerNV platform will reuse the function
    to assign above platform required resources to newly plugged PCI devices
    during PCI hotplug in subsequent patches.

    Signed-off-by: Gavin Shan
    Acked-by: Bjorn Helgaas
    Signed-off-by: Michael Ellerman

    Gavin Shan
     

06 Feb, 2016

1 commit


09 Jan, 2016

1 commit

  • Fix all whitespace issues (missing or needed whitespace) in all files in
    drivers/pci. Code is compiled with allyesconfig before and after code
    changes and objects are recorded and checked with objdiff and they are not
    changed after this commit.

    Signed-off-by: Bogicevic Sasa
    Signed-off-by: Bjorn Helgaas

    Bogicevic Sasa
     

30 Oct, 2015

2 commits

  • The new Enhanced Allocation (EA) capability support (patches to follow)
    creates resources with the IORESOURCE_PCI_FIXED set. During resource
    assignment in pci_bus_assign_resources(), IORESOURCE_PCI_FIXED resources
    are not given a parent. This, in turn, causes pci_enable_resources() to
    fail with a "not claimed" error.

    So, in __pci_bus_assign_resources(), for IORESOURCE_PCI_FIXED resources,
    try to request the resource from a parent bus.

    Signed-off-by: David Daney
    Signed-off-by: Bjorn Helgaas
    Acked-by: Sean O. Stalley

    David Daney
     
  • The new Enhanced Allocation (EA) capability support (patches to follow)
    creates resources with the IORESOURCE_PCI_FIXED set. Since these resources
    cannot be relocated or resized, their alignment is not really defined, and
    it is therefore not specified. This causes a problem in pbus_size_mem()
    where resources with unspecified alignment are disabled.

    So, in pbus_size_mem() skip IORESOURCE_PCI_FIXED resources, instead of
    disabling them.

    [bhelgaas: folded in "flags & IORESOURCE_PCI_FIXED" fix from David]
    Signed-off-by: David Daney
    Signed-off-by: Bjorn Helgaas
    Acked-by: Sean O. Stalley

    David Daney
     

02 Jun, 2015

1 commit

  • In d74b9027a4da ("PCI: Consider additional PF's IOV BAR alignment in sizing
    and assigning"), we store additional alignment in realloc_head and take
    this into consideration for assignment.

    In __assign_resources_sorted(), we changed dev_res->res->start, then used
    resource_start() (which depends on res->start), so the recomputed res->end
    was completely bogus. Even if we'd had the correct size, the end would
    have been off by one.

    Preserve the resource size when we adjust its alignment.

    [bhelgaas: changelog]
    Fixes: d74b9027a4da ("PCI: Consider additional PF's IOV BAR alignment in sizing and assigning")
    Signed-off-by: Yinghai Lu
    Signed-off-by: Bjorn Helgaas
    Acked-by: Wei Yang
    CC: Benjamin Herrenschmidt

    Yinghai Lu
     

28 May, 2015

1 commit

  • In d74b9027a4da ("PCI: Consider additional PF's IOV BAR alignment in sizing
    and assigning"), it stores additional alignment in realloc_head and takes
    this into consideration for assignment.

    After getting the additional alignment, it reorders the head list so
    resources with bigger alignment are ahead of resources with smaller
    alignment. It does this by iterating over the head list and inserting
    ahead of any resource with smaller alignment. This should be done for the
    first occurrence, but the code currently iterates over the whole list.

    Fix this by terminating the loop when we find the first smaller resource in
    the head list.

    [bhelgaas: changelog]
    Fixes: d74b9027a4da ("PCI: Consider additional PF's IOV BAR alignment in sizing and assigning")
    Signed-off-by: Wei Yang
    Signed-off-by: Bjorn Helgaas

    Wei Yang
     

17 Apr, 2015

1 commit

  • Pull powerpc updates from Michael Ellerman:

    - Numerous minor fixes, cleanups etc.

    - More EEH work from Gavin to remove its dependency on device_nodes.

    - Memory hotplug implemented entirely in the kernel from Nathan
    Fontenot.

    - Removal of redundant CONFIG_PPC_OF by Kevin Hao.

    - Rewrite of VPHN parsing logic & tests from Greg Kurz.

    - A fix from Nish Aravamudan to reduce memory usage by clamping
    nodes_possible_map.

    - Support for pstore on powernv from Hari Bathini.

    - Removal of old powerpc specific byte swap routines by David Gibson.

    - Fix from Vasant Hegde to prevent the flash driver telling you it was
    flashing your firmware when it wasn't.

    - Patch from Ben Herrenschmidt to add an OPAL heartbeat driver.

    - Fix for an oops causing get/put_cpu_var() imbalance in perf by Jan
    Stancek.

    - Some fixes for migration from Tyrel Datwyler.

    - A new syscall to switch the cpu endian by Michael Ellerman.

    - Large series from Wei Yang to implement SRIOV, reviewed and acked by
    Bjorn.

    - A fix for the OPAL sensor driver from Cédric Le Goater.

    - Fixes to get STRICT_MM_TYPECHECKS building again by Michael Ellerman.

    - Large series from Daniel Axtens to make our PCI hooks per PHB rather
    than per machine.

    - Small patch from Sam Bobroff to explicitly abort non-suspended
    transactions on syscalls, plus a test to exercise it.

    - Numerous reworks and fixes for the 24x7 PMU from Sukadev Bhattiprolu.

    - Small patch to enable the hard lockup detector from Anton Blanchard.

    - Fix from Dave Olson for missing L2 cache information on some CPUs.

    - Some fixes from Michael Ellerman to get Cell machines booting again.

    - Freescale updates from Scott: Highlights include BMan device tree
    nodes, an MSI erratum workaround, a couple minor performance
    improvements, config updates, and misc fixes/cleanup.

    * tag 'powerpc-4.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux: (196 commits)
    powerpc/powermac: Fix build error seen with powermac smp builds
    powerpc/pseries: Fix compile of memory hotplug without CONFIG_MEMORY_HOTREMOVE
    powerpc: Remove PPC32 code from pseries specific find_and_init_phbs()
    powerpc/cell: Fix iommu breakage caused by controller_ops change
    powerpc/eeh: Fix crash in eeh_add_device_early() on Cell
    powerpc/perf: Cap 64bit userspace backtraces to PERF_MAX_STACK_DEPTH
    powerpc/perf/hv-24x7: Fail 24x7 initcall if create_events_from_catalog() fails
    powerpc/pseries: Correct memory hotplug locking
    powerpc: Fix missing L2 cache size in /sys/devices/system/cpu
    powerpc: Add ppc64 hard lockup detector support
    oprofile: Disable oprofile NMI timer on ppc64
    powerpc/perf/hv-24x7: Add missing put_cpu_var()
    powerpc/perf/hv-24x7: Break up single_24x7_request
    powerpc/perf/hv-24x7: Define update_event_count()
    powerpc/perf/hv-24x7: Whitespace cleanup
    powerpc/perf/hv-24x7: Define add_event_to_24x7_request()
    powerpc/perf/hv-24x7: Rename hv_24x7_event_update
    powerpc/perf/hv-24x7: Move debug prints to separate function
    powerpc/perf/hv-24x7: Drop event_24x7_request()
    powerpc/perf/hv-24x7: Use pr_devel() to log message
    ...

    Conflicts:
    tools/testing/selftests/powerpc/Makefile
    tools/testing/selftests/powerpc/tm/Makefile

    Linus Torvalds
     

09 Apr, 2015

1 commit

  • Export the following symbols so they can be referenced by a PCI host bridge
    driver compiled as a kernel loadable module:

    pci_common_swizzle
    pci_create_root_bus
    pci_stop_root_bus
    pci_remove_root_bus
    pci_assign_unassigned_bus_resources
    pci_fixup_irqs

    Signed-off-by: Ray Jui
    Signed-off-by: Bjorn Helgaas
    Acked-by: Arnd Bergmann

    Ray Jui
     

31 Mar, 2015

1 commit

  • When sizing and assigning resources, we divide the resources into two
    lists: the requested list and the additional list. We don't consider the
    alignment of additional VF(n) BAR space.

    This is because the alignment required for the VF(n) BAR space is the size
    of an individual VF BAR, not the size of the space for *all* VFs. But we
    want additional alignment to support partitioning on PowerNV.

    Consider the additional IOV BAR alignment when sizing and assigning
    resources. When there is not enough system MMIO space to accomodate both
    the requested list and the additional list, the PF's IOV BAR alignment will
    not contribute to the bridge. When there is enough system MMIO space for
    both lists, the additional alignment will contribute to the bridge.

    The additional alignment is stored in the min_align of pci_dev_resource,
    which is stored in the additional list by add_to_list() at the end of
    pbus_size_mem(). The additional alignment is calculated in
    pci_resource_alignment(). For an IOV BAR, we have arch dependent function
    to get the alignment for different arch.

    [bhelgaas: changelog, printk cast]
    Signed-off-by: Wei Yang
    Acked-by: Bjorn Helgaas
    Signed-off-by: Benjamin Herrenschmidt

    Wei Yang
     

17 Jan, 2015

2 commits

  • Add pci_claim_bridge_resource() to claim a PCI-PCI bridge window. This is
    like regular pci_claim_resource(), except that if we fail to claim the
    window, we check to see if we can reduce the size of the window and try
    again.

    This is for scenarios like this:

    pci_bus 0000:00: root bus resource [mem 0xc0000000-0xffffffff]
    pci 0000:00:01.0: bridge window [mem 0xbdf00000-0xddefffff 64bit pref]
    pci 0000:01:00.0: reg 0x10: [mem 0xc0000000-0xcfffffff pref]

    The 00:01.0 window is illegal: it starts before the host bridge window, so
    we have to assume the [0xbdf00000-0xbfffffff] region is inaccessible. We
    can make it legal by clipping it to [mem 0xc0000000-0xddefffff 64bit pref].

    Previously we discarded the 00:01.0 window and tried to reassign that part
    of the hierarchy from scratch. That is a problem because Linux doesn't
    always assign things optimally. For example, in this case, BIOS put the
    01:00.0 device in a prefetchable window below 4GB, but after 5b28541552ef,
    Linux puts the prefetchable window above 4GB where the 32-bit 01:00.0
    device can't use it.

    Clipping the 00:01.0 window is less intrusive than completely reassigning
    things and is sufficient to let us use most of the BIOS configuration. Of
    course, it's possible that devices below 00:01.0 will no longer fit. If
    that's the case, we'll have to reassign things. But that's a separate
    problem.

    [bhelgaas: changelog, split into separate patch]
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=85491
    Reported-by: Marek Kordik
    Fixes: 5b28541552ef ("PCI: Restrict 64-bit prefetchable bridge windows to 64-bit resources")
    Signed-off-by: Yinghai Lu
    Signed-off-by: Bjorn Helgaas
    CC: stable@vger.kernel.org # v3.16+

    Yinghai Lu
     
  • pci_setup_bridge_io(), pci_setup_bridge_mmio(), and
    pci_setup_bridge_mmio_pref() program the windows of PCI-PCI bridges.
    Previously they accepted a pointer to the pci_bus of the secondary bus,
    then looked up the bridge leading to that bus. Pass the bridge directly,
    which will make it more convenient for future callers.

    No functional change.

    [bhelgaas: changelog, split into separate patch]
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=85491
    Reported-by: Marek Kordik
    Fixes: 5b28541552ef ("PCI: Restrict 64-bit prefetchable bridge windows to 64-bit resources")
    Signed-off-by: Yinghai Lu
    Signed-off-by: Bjorn Helgaas
    CC: stable@vger.kernel.org # v3.16+

    Yinghai Lu
     

01 Oct, 2014

1 commit

  • In 5b28541552ef ("PCI: Restrict 64-bit prefetchable bridge windows to
    64-bit resources"), we added IORESOURCE_MEM_64 to the mask in
    pci_assign_unassigned_root_bus_resources(), but not to the mask in
    pci_assign_unassigned_bridge_resources().

    Add IORESOURCE_MEM_64 to the pci_assign_unassigned_bridge_resources() type
    mask.

    Fixes: 5b28541552ef ("PCI: Restrict 64-bit prefetchable bridge windows to 64-bit resources")
    Signed-off-by: Yinghai Lu
    Signed-off-by: Bjorn Helgaas
    CC: stable@vger.kernel.org # v3.16+

    Yinghai Lu
     

09 Jul, 2014

1 commit


11 Jun, 2014

2 commits

  • Merge quoted strings that are broken across lines into a single entity.
    The compiler merges them anyway, but checkpatch complains about it, and
    merging them makes it easier to grep for strings.

    No functional change.

    [bhelgaas: changelog, do the same for everything under drivers/pci]
    Signed-off-by: Ryan Desfosses
    Signed-off-by: Bjorn Helgaas

    Ryan Desfosses
     
  • Fix various whitespace errors.

    No functional change.

    [bhelgaas: fix other similar problems]
    Signed-off-by: Ryan Desfosses
    Signed-off-by: Bjorn Helgaas

    Ryan Desfosses
     

29 May, 2014

1 commit

  • * pci/hotplug:
    PCI: cpqphp: Fix possible null pointer dereference
    NVMe: Implement PCIe reset notification callback
    PCI: Notify driver before and after device reset

    * pci/pci_is_bridge:
    pcmcia: Use pci_is_bridge() to simplify code
    PCI: pciehp: Use pci_is_bridge() to simplify code
    PCI: acpiphp: Use pci_is_bridge() to simplify code
    PCI: cpcihp: Use pci_is_bridge() to simplify code
    PCI: shpchp: Use pci_is_bridge() to simplify code
    PCI: rpaphp: Use pci_is_bridge() to simplify code
    sparc/PCI: Use pci_is_bridge() to simplify code
    powerpc/PCI: Use pci_is_bridge() to simplify code
    ia64/PCI: Use pci_is_bridge() to simplify code
    x86/PCI: Use pci_is_bridge() to simplify code
    PCI: Use pci_is_bridge() to simplify code
    PCI: Add new pci_is_bridge() interface
    PCI: Rename pci_is_bridge() to pci_has_subordinate()

    * pci/virtualization:
    PCI: Introduce new device binding path using pci_dev.driver_override

    Conflicts:
    drivers/pci/pci-sysfs.c

    Bjorn Helgaas
     

28 May, 2014

1 commit

  • Use pci_is_bridge() to simplify code. No functional change.

    Requires: 326c1cdae741 PCI: Rename pci_is_bridge() to pci_has_subordinate()
    Requires: 1c86438c9423 PCI: Add new pci_is_bridge() interface
    Signed-off-by: Yijing Wang
    Signed-off-by: Bjorn Helgaas

    Yijing Wang
     

27 May, 2014

1 commit

  • * dma-api:
    iommu/exynos: Remove unnecessary "&" from function pointers
    DMA-API: Update dma_pool_create ()and dma_pool_alloc() descriptions
    DMA-API: Fix duplicated word in DMA-API-HOWTO.txt
    DMA-API: Capitalize "CPU" consistently
    sh/PCI: Pass GAPSPCI_DMA_BASE CPU & bus address to dma_declare_coherent_memory()
    DMA-API: Change dma_declare_coherent_memory() CPU address to phys_addr_t
    DMA-API: Clarify physical/bus address distinction

    * pci/virtualization:
    PCI: Mark RTL8110SC INTx masking as broken

    * pci/msi:
    PCI/MSI: Remove pci_enable_msi_block()

    * pci/misc:
    PCI: Remove pcibios_add_platform_entries()
    s390/pci: use pdev->dev.groups for attribute creation
    PCI: Move Open Firmware devspec attribute to PCI common code

    * pci/resource:
    PCI: Add resource allocation comments
    PCI: Simplify __pci_assign_resource() coding style
    PCI: Change pbus_size_mem() return values to be more conventional
    PCI: Restrict 64-bit prefetchable bridge windows to 64-bit resources
    PCI: Support BAR sizes up to 8GB
    resources: Clarify sanity check message
    PCI: Don't add disabled subtractive decode bus resources
    PCI: Don't print anything while decoding is disabled
    PCI: Don't set BAR to zero if dma_addr_t is too small
    PCI: Don't convert BAR address to resource if dma_addr_t is too small
    PCI: Reject BAR above 4GB if dma_addr_t is too small
    PCI: Fail safely if we can't handle BARs larger than 4GB
    x86/gart: Tidy messages and add bridge device info
    x86/gart: Replace printk() with pr_info()
    x86/PCI: Move pcibios_assign_resources() annotation to definition
    x86/PCI: Mark ATI SBx00 HPET BAR as IORESOURCE_PCI_FIXED
    x86/PCI: Don't try to move IORESOURCE_PCI_FIXED resources
    x86/PCI: Fix Broadcom CNB20LE unintended sign extension

    Bjorn Helgaas
     

24 May, 2014

3 commits

  • Add comments in the code to match the allocation strategy of 7c671426dfc3
    ("PCI: Restrict 64-bit prefetchable bridge windows to 64-bit resources").

    No functional change.

    Signed-off-by: Bjorn Helgaas

    Bjorn Helgaas
     
  • pbus_size_mem() previously returned 0 for failure and 1 for success.
    Change it to return -ENOSPC for failure and 0 for success.

    No functional change.

    Signed-off-by: Bjorn Helgaas

    Bjorn Helgaas
     
  • This patch changes the way we handle 64-bit prefetchable bridge windows to
    make it more likely that we can assign space to all devices.

    Previously we put all prefetchable resources in the prefetchable bridge
    window. If any of those resources was 32-bit only, we restricted the
    window to be below 4GB.

    After this patch, we only put 64-bit prefetchable resources in a 64-bit
    prefetchable window. We put all 32-bit prefetchable resources in the
    non-prefetchable window, even if there are no 64-bit prefetchable
    resources.

    With the previous approach, if there was a 32-bit prefetchable resource
    behind a bridge, we forced the bridge's prefetchable window below 4GB,
    which meant that even if there was plenty of space above 4GB available, we
    couldn't use it, and assignment of large 64-bit resources could fail, as
    in the bugzilla below.

    The new strategy is:

    1) If the prefetchable window is 64 bits wide, we put only 64-bit
    prefetchable resources in it. Any 32-bit prefetchable resources go in
    the non-prefetchable window.

    2) If the prefetchable window is 32 bits wide, we put both 32- and 64-bit
    prefetchable resources in it.

    3) If there is no prefetchable window, all MMIO resources go in the
    non-prefetchable window.

    This reduces performance for 32-bit prefetchable resources below a bridge
    with a 64-bit prefetchable window. We previously assigned prefetchable
    space, but now we'll assign non-prefetchable space. This is the case even
    if there are no 64-bit prefetchable resources, or if they would all fit
    below 4GB. In those cases, the old strategy would work and would have
    better performance.

    [bhelgaas: write changelog, add bugzilla link, fold in mem64_mask removal]
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=74151
    Tested-by: Guo Chao
    Tested-by: Wei Yang
    Signed-off-by: Yinghai Lu
    Signed-off-by: Bjorn Helgaas

    Yinghai Lu