28 Apr, 2017

1 commit

  • Many PCI host controller drivers aren't prepared to have their devices
    unbound from them forcefully (e.g., through /sys/...//unbind), as
    they don't provide any driver .remove callback, where they'd detach the
    root bus, release resources, etc. Keeping the driver built in (i.e., not a
    loadable module) is not enough; and providing no .remove callback just
    means we don't do any teardown.

    To rule out the possibility of unbinding a device via sysfs, we need to set
    the ".suppress_bind_attrs" field.

    I found the suspect drivers via the following search:

    git grep -l platform_driver $(git grep -L -e '\.remove' -e suppress_bind_attrs drivers/pci/)

    Then I inspected them to ensure that
    (a) they set up a PCI bus in their probe() and
    (b) they don't have a remove() callback for undoing the setup

    Suggested-by: Bjorn Helgaas
    Signed-off-by: Brian Norris
    Signed-off-by: Bjorn Helgaas

    Brian Norris
     

25 Apr, 2017

1 commit

  • PCI configuration space should be mapped with a memory region type that
    generates on the CPU host bus non-posted write transations. Update the
    driver to use the devm_ioremap_nopost* interface to make sure the correct
    memory mappings for PCI configuration space are used.

    Signed-off-by: Lorenzo Pieralisi
    Signed-off-by: Bjorn Helgaas
    Cc: Rob Herring

    Lorenzo Pieralisi
     

09 Feb, 2017

1 commit


07 Sep, 2016

1 commit

  • On ARM/ARM64 architectures, PCI IO ports are emulated through memory mapped
    IO, by reserving a chunk of virtual address space starting at PCI_IOBASE
    and by mapping the PCI host bridges memory address space driving PCI IO
    cycles to it.

    PCI host bridge drivers that enable downstream PCI IO cycles map the host
    bridge memory address responding to PCI IO cycles to the fixed virtual
    address space through the pci_remap_iospace() API.

    This means that if the pci_remap_iospace() function fails, the
    corresponding host bridge PCI IO resource must be considered invalid, in
    that there is no way for the kernel to actually drive PCI IO transactions
    if the memory addresses responding to PCI IO cycles cannot be mapped into
    the CPU virtual address space.

    The PCI versatile host bridge driver does not remove the PCI IO resource
    from the host bridge resource windows if the pci_remap_iospace() call
    fails; this is an actual bug in that the PCI host bridge would consider the
    PCI IO resource valid (and possibly assign it to downstream devices) even
    if the kernel was not able to map the PCI host bridge memory address
    driving IO cycle to the CPU virtual address space (ie pci_remap_iospace()
    failures).

    Fix the PCI host bridge driver pci_remap_iospace() failure path, by
    destroying the PCI host bridge PCI IO resources retrieved through firmware
    when the pci_remap_iospace() function call fails, therefore preventing the
    kernel from adding the respective PCI IO resource to the list of PCI host
    bridge valid resources, fixing the issue.

    Fixes: b7e78170efd4 ("PCI: versatile: Add DT-based ARM Versatile PB PCIe host driver")
    Signed-off-by: Lorenzo Pieralisi
    Signed-off-by: Bjorn Helgaas
    CC: Rob Herring

    Lorenzo Pieralisi
     

25 Jun, 2016

2 commits


26 Nov, 2015

1 commit

  • Commit b3a72384fe29 ("ARM/PCI: Replace pci_sys_data->align_resource with
    global function pointer") removed the struct pci_sys_data dependency from
    the ARM pcibios functions that are part of the common ARM PCI arch
    back-end, e.g., pcibios_align_resource(), so that struct pci_sys_data has
    now become data that is only used internally by the ARM bios32 layer, i.e.,
    pci_common_init_dev(), and by host controllers drivers callbacks, e.g.,
    pci_sys_data.setup, that rely on the ARM bios32 API to probe.

    PCI host controller drivers that do not rely on ARM bios32 calls to probe
    do not need to have the pci_bus.sysdata pointer field pointing at a struct
    pci_sys_data anymore, therefore it can be removed from the respective
    drivers data structures.

    Remove the pci_sys_data structures from the host controller drivers that do
    not rely on ARM bios32 interface to scan the PCI bus, completing the
    pci_sys_data clean-up and removing the related dependency on arch/arm
    specific data.

    Signed-off-by: Lorenzo Pieralisi
    Signed-off-by: Bjorn Helgaas
    Acked-by: Arnd Bergmann
    CC: Will Deacon
    CC: Rob Herring

    Lorenzo Pieralisi
     

10 Apr, 2015

2 commits

  • …st-layerscape', 'pci/host-mvebu', 'pci/host-rcar' and 'pci/host-versatile' into next

    * pci/host-exynos:
    PCI: exynos: Fix INTx enablement statement termination error

    * pci/host-iproc:
    PCI: iproc: Add Broadcom iProc PCIe support
    PCI: iproc: Add DT docs for Broadcom iProc PCIe driver
    PCI: Export symbols required for loadable host driver modules

    * pci/host-keystone:
    PCI: keystone: Don't dereference possible NULL pointer

    * pci/host-layerscape:
    PCI: layerscape: Simplify platform_get_resource_byname() failure checking

    * pci/host-mvebu:
    PCI: mvebu: Add suspend/resume support

    * pci/host-rcar:
    PCI: rcar: Verify that mem_res is 64K-aligned
    PCI: rcar: Change PCIEPARL and PCIEPARH to PCIEPALR and PCIEPAUR
    PCI: rcar: Write zeroes to reserved PCIEPARL bits
    PCI: rcar: Fix position of MSI enable bit

    * pci/host-versatile:
    PCI: versatile: Check for devm_ioremap_resource() failures

    Bjorn Helgaas
     
  • Check for failure of devm_ioremap_resource().

    devm_ioremap_resource() validates the resource it receives, so if we check
    for devm_ioremap_resource() failure, we need not check for failure of the
    preceding platform_get_resource().

    [bhelgaas: changelog]
    Signed-off-by: Jisheng Zhang
    Signed-off-by: Bjorn Helgaas

    Jisheng Zhang
     

24 Mar, 2015

1 commit


19 Mar, 2015

1 commit

  • 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
    Signed-off-by: Bjorn Helgaas
    CC: Richard Henderson
    CC: Ivan Kokshaysky
    CC: Matt Turner
    CC: David Howells
    CC: Tony Luck
    CC: Michal Simek
    CC: Ralf Baechle
    CC: Koichi Yasutake
    CC: Sebastian Ott
    CC: "David S. Miller"
    CC: Chris Metcalf
    CC: Chris Zankel
    CC: Max Filippov
    CC: Thomas Gleixner

    Yijing Wang
     

28 Feb, 2015

1 commit

  • In Linux 4.0-rc1 ARM Versatile PCI build fails to build due to what
    appears to be an API update. This patch is a very simple correction,
    merely posted as a heads-up to the maintainers. Hopefully a better
    fix can be forwarded to Linus.

    [ arnd: the patch actually looks correct, so let's take this version ]

    Signed-off-by: Joachim Nilsson
    Signed-off-by: Arnd Bergmann
    Acked-by: Linus Walleij
    Acked-by: Bjorn Helgaas
    Signed-off-by: Rafael J. Wysocki

    Joachim Nilsson
     

11 Feb, 2015

1 commit

  • Pull ACPI and power management updates from Rafael Wysocki:
    "We have a few new features this time, including a new SFI-based
    cpufreq driver, a new devfreq driver for Tegra Activity Monitor, a new
    devfreq class for providing its governors with raw utilization data
    and a new ACPI driver for AMD SoCs.

    Still, the majority of changes here are reworks of existing code to
    make it more straightforward or to prepare it for implementing new
    features on top of it. The primary example is the rework of ACPI
    resources handling from Jiang Liu, Thomas Gleixner and Lv Zheng with
    support for IOAPIC hotplug implemented on top of it, but there is
    quite a number of changes of this kind in the cpufreq core, ACPICA,
    ACPI EC driver, ACPI processor driver and the generic power domains
    core code too.

    The most active developer is Viresh Kumar with his cpufreq changes.

    Specifics:

    - Rework of the core ACPI resources parsing code to fix issues in it
    and make using resource offsets more convenient and consolidation
    of some resource-handing code in a couple of places that have grown
    analagous data structures and code to cover the the same gap in the
    core (Jiang Liu, Thomas Gleixner, Lv Zheng).

    - ACPI-based IOAPIC hotplug support on top of the resources handling
    rework (Jiang Liu, Yinghai Lu).

    - ACPICA update to upstream release 20150204 including an interrupt
    handling rework that allows drivers to install raw handlers for
    ACPI GPEs which then become entirely responsible for the given GPE
    and the ACPICA core code won't touch it (Lv Zheng, David E Box,
    Octavian Purdila).

    - ACPI EC driver rework to fix several concurrency issues and other
    problems related to events handling on top of the ACPICA's new
    support for raw GPE handlers (Lv Zheng).

    - New ACPI driver for AMD SoCs analogous to the LPSS (Low-Power
    Subsystem) driver for Intel chips (Ken Xue).

    - Two minor fixes of the ACPI LPSS driver (Heikki Krogerus, Jarkko
    Nikula).

    - Two new blacklist entries for machines (Samsung 730U3E/740U3E and
    510R) where the native backlight interface doesn't work correctly
    while the ACPI one does (Hans de Goede).

    - Rework of the ACPI processor driver's handling of idle states to
    make the code more straightforward and less bloated overall (Rafael
    J Wysocki).

    - Assorted minor fixes related to ACPI and SFI (Andreas Ruprecht,
    Andy Shevchenko, Hanjun Guo, Jan Beulich, Rafael J Wysocki, Yaowei
    Bai).

    - PCI core power management modification to avoid resuming (some)
    runtime-suspended devices during system suspend if they are in the
    right states already (Rafael J Wysocki).

    - New SFI-based cpufreq driver for Intel platforms using SFI
    (Srinidhi Kasagar).

    - cpufreq core fixes, cleanups and simplifications (Viresh Kumar,
    Doug Anderson, Wolfram Sang).

    - SkyLake CPU support and other updates for the intel_pstate driver
    (Kristen Carlson Accardi, Srinivas Pandruvada).

    - cpufreq-dt driver cleanup (Markus Elfring).

    - Init fix for the ARM big.LITTLE cpuidle driver (Sudeep Holla).

    - Generic power domains core code fixes and cleanups (Ulf Hansson).

    - Operating Performance Points (OPP) core code cleanups and kernel
    documentation update (Nishanth Menon).

    - New dabugfs interface to make the list of PM QoS constraints
    available to user space (Nishanth Menon).

    - New devfreq driver for Tegra Activity Monitor (Tomeu Vizoso).

    - New devfreq class (devfreq_event) to provide raw utilization data
    to devfreq governors (Chanwoo Choi).

    - Assorted minor fixes and cleanups related to power management
    (Andreas Ruprecht, Krzysztof Kozlowski, Rickard Strandqvist, Pavel
    Machek, Todd E Brandt, Wonhong Kwon).

    - turbostat updates (Len Brown) and cpupower Makefile improvement
    (Sriram Raghunathan)"

    * tag 'pm+acpi-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (151 commits)
    tools/power turbostat: relax dependency on APERF_MSR
    tools/power turbostat: relax dependency on invariant TSC
    Merge branch 'pci/host-generic' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci into acpi-resources
    tools/power turbostat: decode MSR_*_PERF_LIMIT_REASONS
    tools/power turbostat: relax dependency on root permission
    ACPI / video: Add disable_native_backlight quirk for Samsung 510R
    ACPI / PM: Remove unneeded nested #ifdef
    USB / PM: Remove unneeded #ifdef and associated dead code
    intel_pstate: provide option to only use intel_pstate with HWP
    ACPI / EC: Add GPE reference counting debugging messages
    ACPI / EC: Add query flushing support
    ACPI / EC: Refine command storm prevention support
    ACPI / EC: Add command flushing support.
    ACPI / EC: Introduce STARTED/STOPPED flags to replace BLOCKED flag
    ACPI: add AMD ACPI2Platform device support for x86 system
    ACPI / table: remove duplicate NULL check for the handler of acpi_table_parse()
    ACPI / EC: Update revision due to raw handler mode.
    ACPI / EC: Reduce ec_poll() by referencing the last register access timestamp.
    ACPI / EC: Fix several GPE handling issues by deploying ACPI_GPE_DISPATCH_RAW_HANDLER mode.
    ACPICA: Events: Enable APIs to allow interrupt/polling adaptive request based GPE handling model
    ...

    Linus Torvalds
     

29 Jan, 2015

1 commit

  • This converts the Versatile PCI host code to a platform driver using the
    commom DT parsing and setup. The driver uses only an empty ARM
    pci_sys_data struct and does not use pci_common_init_dev init function.
    The old host code will be removed in a subsequent commit when Versatile is
    completely converted to DT.

    I've tested this on QEMU with the sym53c8xx driver in both i/o and memory
    mapped modes.

    Signed-off-by: Rob Herring
    Signed-off-by: Bjorn Helgaas
    Acked-by: Linus Walleij
    CC: Russell King
    CC: Peter Maydell

    Rob Herring