30 May, 2018

1 commit

  • [ Upstream commit 5775b843a619b3c93f946e2b55a208d9f0f48b59 ]

    We leave PCI devices not bound to a driver in D0 during runtime suspend.
    But they may have a parent which is bound and can be transitioned to
    D3cold at runtime. Once the parent goes to D3cold, the unbound child
    may go to D3cold as well. When the child goes to D3cold, its internal
    state, including configuration of BARs, MSI, ASPM, MPS, etc., is lost.

    One example are recent hybrid graphics laptops which cut power to the
    discrete GPU when the root port above it goes to ACPI power state D3.
    Users may provoke this by unbinding the GPU driver and allowing runtime
    PM on the GPU via sysfs: The PM core will then treat the GPU as
    "suspended", which in turn allows the root port to runtime suspend,
    causing the power resources listed in its _PR3 object to be powered off.
    The GPU's BARs will be uninitialized when a driver later probes it.

    Another example are hybrid graphics laptops where the GPU itself (rather
    than the root port) is capable of runtime suspending to D3cold. If the
    GPU's integrated HDA controller is not bound and the GPU's driver
    decides to runtime suspend to D3cold, the HDA controller's BARs will be
    uninitialized when a driver later probes it.

    Fix by saving and restoring config space over a runtime suspend cycle
    even if the device is not bound.

    Acked-by: Bjorn Helgaas
    Tested-by: Peter Wu # Nvidia Optimus
    Tested-by: Lukas Wunner # MacBook Pro
    Signed-off-by: Rafael J. Wysocki
    [lukas: add commit message, bikeshed code comments for clarity]
    Signed-off-by: Lukas Wunner
    Link: https://patchwork.freedesktop.org/patch/msgid/92fb6e6ae2730915eb733c08e2f76c6a313e3860.1520068884.git.lukas@wunner.de
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     

30 Dec, 2017

1 commit

  • commit 5839ee7389e893a31e4e3c9cf17b50d14103c902 upstream.

    It is incorrect to call pci_restore_state() for devices in low-power
    states (D1-D3), as that involves the restoration of MSI setup which
    requires MMIO to be operational and that is only the case in D0.

    However, pci_pm_thaw_noirq() may do that if the driver's "freeze"
    callbacks put the device into a low-power state, so fix it by making
    it force devices into D0 via pci_set_power_state() instead of trying
    to "update" their power state which is pointless.

    Fixes: e60514bd4485 (PCI/PM: Restore the status of PCI devices across hibernation)
    Reported-by: Thomas Gleixner
    Reported-by: Maarten Lankhorst
    Tested-by: Thomas Gleixner
    Tested-by: Maarten Lankhorst
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Bjorn Helgaas
    Signed-off-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     

06 Sep, 2017

1 commit

  • Pull ACPI updates from Rafael Wysocki:
    "These include a usual ACPICA code update (this time to upstream
    revision 20170728), a fix for a boot crash on some systems with
    Thunderbolt devices connected at boot time, a rework of the handling
    of PCI bridges when setting up device wakeup, new support for Apple
    device properties, support for DMA configurations reported via ACPI on
    ARM64, APEI-related updates, ACPI EC driver updates and assorted minor
    modifications in several places.

    Specifics:

    - Update the ACPICA code in the kernel to upstream revision 20170728
    including:
    * Alias operator handling update (Bob Moore).
    * Deferred resolution of reference package elements (Bob Moore).
    * Support for the _DMA method in walk resources (Bob Moore).
    * Tables handling update and support for deferred table
    verification (Lv Zheng).
    * Update of SMMU models for IORT (Robin Murphy).
    * Compiler and disassembler updates (Alex James, Erik Schmauss,
    Ganapatrao Kulkarni, James Morse).
    * Tools updates (Erik Schmauss, Lv Zheng).
    * Assorted minor fixes and cleanups (Bob Moore, Kees Cook, Lv
    Zheng, Shao Ming).

    - Rework the initialization of non-wakeup GPEs with method handlers
    in order to address a boot crash on some systems with Thunderbolt
    devices connected at boot time where we miss an early hotplug event
    due to a delay in GPE enabling (Rafael Wysocki).

    - Rework the handling of PCI bridges when setting up ACPI-based
    device wakeup in order to avoid disabling wakeup for bridges
    prematurely (Rafael Wysocki).

    - Consolidate Apple DMI checks throughout the tree, add support for
    Apple device properties to the device properties framework and use
    these properties for the handling of I2C and SPI devices on Apple
    systems (Lukas Wunner).

    - Add support for _DMA to the ACPI-based device properties lookup
    code and make it possible to use the information from there to
    configure DMA regions on ARM64 systems (Lorenzo Pieralisi).

    - Fix several issues in the APEI code, add support for exporting the
    BERT error region over sysfs and update APEI MAINTAINERS entry with
    reviewers information (Borislav Petkov, Dongjiu Geng, Loc Ho, Punit
    Agrawal, Tony Luck, Yazen Ghannam).

    - Fix a potential initialization ordering issue in the ACPI EC driver
    and clean it up somewhat (Lv Zheng).

    - Update the ACPI SPCR driver to extend the existing XGENE 8250
    workaround in it to a new platform (m400) and to work around an
    Xgene UART clock issue (Graeme Gregory).

    - Add a new utility function to the ACPI core to support using ACPI
    OEM ID / OEM Table ID / Revision for system identification in
    blacklisting or similar and switch over the existing code already
    using this information to this new interface (Toshi Kani).

    - Fix an xpower PMIC issue related to GPADC reads that always return
    0 without extra pin manipulations (Hans de Goede).

    - Add statements to print debug messages in a couple of places in the
    ACPI core for easier diagnostics (Rafael Wysocki).

    - Clean up the ACPI processor driver slightly (Colin Ian King, Hanjun
    Guo).

    - Clean up the ACPI x86 boot code somewhat (Andy Shevchenko).

    - Add a quirk for Dell OptiPlex 9020M to the ACPI backlight driver
    (Alex Hung).

    - Assorted fixes, cleanups and updates related to ACPI (Amitoj Kaur
    Chawla, Bhumika Goyal, Frank Rowand, Jean Delvare, Punit Agrawal,
    Ronald Tschalär, Sumeet Pawnikar)"

    * tag 'acpi-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (75 commits)
    ACPI / APEI: Suppress message if HEST not present
    intel_pstate: convert to use acpi_match_platform_list()
    ACPI / blacklist: add acpi_match_platform_list()
    ACPI, APEI, EINJ: Subtract any matching Register Region from Trigger resources
    ACPI: make device_attribute const
    ACPI / sysfs: Extend ACPI sysfs to provide access to boot error region
    ACPI: APEI: fix the wrong iteration of generic error status block
    ACPI / processor: make function acpi_processor_check_duplicates() static
    ACPI / EC: Clean up EC GPE mask flag
    ACPI: EC: Fix possible issues related to EC initialization order
    ACPI / PM: Add debug statements to acpi_pm_notify_handler()
    ACPI: Add debug statements to acpi_global_event_handler()
    ACPI / scan: Enable GPEs before scanning the namespace
    ACPICA: Make it possible to enable runtime GPEs earlier
    ACPICA: Dispatch active GPEs at init time
    ACPI: SPCR: work around clock issue on xgene UART
    ACPI: SPCR: extend XGENE 8250 workaround to m400
    ACPI / LPSS: Don't abort ACPI scan on missing mem resource
    mailbox: pcc: Drop uninformative output during boot
    ACPI/IORT: Add IORT named component memory address limits
    ...

    Linus Torvalds
     

19 Aug, 2017

1 commit

  • Some drivers (specifically the nes IB driver), want to create a lot of
    sysfs driver attributes. Instead of open-coding the creation and
    removal of these files (and getting it wrong btw), it's a better idea to
    let the driver core handle all of this logic for us.

    So add a new field to the pci driver structure, **groups, that allows
    pci drivers to specify an attribute group list it wishes to have created
    when it is registered with the driver core.

    Big bonus is now the driver doesn't race with userspace when the sysfs
    files are created vs. when the kobject is announced, so any script/tool
    that actually wanted to use these files will not have to poll waiting
    for them to show up.

    Cc: Faisal Latif
    Cc: Doug Ledford
    Cc: Sean Hefty
    Cc: Hal Rosenstock
    Cc: Bjorn Helgaas
    Signed-off-by: Greg Kroah-Hartman
    Acked-by: Bjorn Helgaas
    Signed-off-by: Doug Ledford

    Greg Kroah-Hartman
     

01 Aug, 2017

1 commit

  • PCI bridges only have a reason to generate wakeup signals on behalf
    of devices below them, so avoid preparing bridges for wakeup directly
    in pci_enable_wake().

    Also drop the pci_has_subordinate() check from pci_pm_default_resume()
    as this will be done by pci_enable_wake() itself now.

    Signed-off-by: Rafael J. Wysocki
    Reviewed-by: Mika Westerberg
    Acked-by: Bjorn Helgaas

    Rafael J. Wysocki
     

14 Jul, 2017

1 commit


13 Jul, 2017

1 commit

  • Commit dc15e71eefc7 (PCI / PM: Restore PME Enable if skipping wakeup
    setup) introduced a mechanism by which the PME Enable bit can be
    restored by pci_enable_wake() if dev->wakeup_prepared is set in
    case it has been overwritten by PCI config space restoration.

    However, that commit overlooked the fact that on some systems (Dell
    XPS13 9360 in particular) the AML handling wakeup events checks PME
    Status and PME Enable and it won't trigger a Notify() for devices
    where those bits are not set while it is running.

    That happens during resume from suspend-to-idle when pci_restore_state()
    invoked by pci_pm_default_resume_early() clears PME Enable before the
    wakeup events are processed by AML, effectively causing those wakeup
    events to be ignored.

    Fix this issue by restoring the PME Enable configuration right after
    pci_restore_state() has been called instead of doing that in
    pci_enable_wake().

    Fixes: dc15e71eefc7 (PCI / PM: Restore PME Enable if skipping wakeup setup)
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Bjorn Helgaas

    Rafael J. Wysocki
     

09 Jul, 2017

1 commit

  • Pull PCI updates from Bjorn Helgaas:

    - add sysfs max_link_speed/width, current_link_speed/width (Wong Vee
    Khee)

    - make host bridge IRQ mapping much more generic (Matthew Minter,
    Lorenzo Pieralisi)

    - convert most drivers to pci_scan_root_bus_bridge() (Lorenzo
    Pieralisi)

    - mutex sriov_configure() (Jakub Kicinski)

    - mutex pci_error_handlers callbacks (Christoph Hellwig)

    - split ->reset_notify() into ->reset_prepare()/reset_done()
    (Christoph Hellwig)

    - support multiple PCIe portdrv interrupts for MSI as well as MSI-X
    (Gabriele Paoloni)

    - allocate MSI/MSI-X vector for Downstream Port Containment (Gabriele
    Paoloni)

    - fix MSI IRQ affinity pre/post/min_vecs issue (Michael Hernandez)

    - test INTx masking during enumeration, not at run-time (Piotr Gregor)

    - avoid using device_may_wakeup() for runtime PM (Rafael J. Wysocki)

    - restore the status of PCI devices across hibernation (Chen Yu)

    - keep parent resources that start at 0x0 (Ard Biesheuvel)

    - enable ECRC only if device supports it (Bjorn Helgaas)

    - restore PRI and PASID state after Function-Level Reset (CQ Tang)

    - skip DPC event if device is not present (Keith Busch)

    - check domain when matching SMBIOS info (Sujith Pandel)

    - mark Intel XXV710 NIC INTx masking as broken (Alex Williamson)

    - avoid AMD SB7xx EHCI USB wakeup defect (Kai-Heng Feng)

    - work around long-standing Macbook Pro poweroff issue (Bjorn Helgaas)

    - add Switchtec "running" status flag (Logan Gunthorpe)

    - fix dra7xx incorrect RW1C IRQ register usage (Arvind Yadav)

    - modify xilinx-nwl IRQ chip for legacy interrupts (Bharat Kumar
    Gogada)

    - move VMD SRCU cleanup after bus, child device removal (Jon Derrick)

    - add Faraday clock handling (Linus Walleij)

    - configure Rockchip MPS and reorganize (Shawn Lin)

    - limit Qualcomm TLP size to 2K (hardware issue) (Srinivas Kandagatla)

    - support Tegra MSI 64-bit addressing (Thierry Reding)

    - use Rockchip normal (not privileged) register bank (Shawn Lin)

    - add HiSilicon Kirin SoC PCIe controller driver (Xiaowei Song)

    - add Sigma Designs Tango SMP8759 PCIe controller driver (Marc
    Gonzalez)

    - add MediaTek PCIe host controller support (Ryder Lee)

    - add Qualcomm IPQ4019 support (John Crispin)

    - add HyperV vPCI protocol v1.2 support (Jork Loeser)

    - add i.MX6 regulator support (Quentin Schulz)

    * tag 'pci-v4.13-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (113 commits)
    PCI: tango: Add Sigma Designs Tango SMP8759 PCIe host bridge support
    PCI: Add DT binding for Sigma Designs Tango PCIe controller
    PCI: rockchip: Use normal register bank for config accessors
    dt-bindings: PCI: Add documentation for MediaTek PCIe
    PCI: Remove __pci_dev_reset() and pci_dev_reset()
    PCI: Split ->reset_notify() method into ->reset_prepare() and ->reset_done()
    PCI: xilinx: Make of_device_ids const
    PCI: xilinx-nwl: Modify IRQ chip for legacy interrupts
    PCI: vmd: Move SRCU cleanup after bus, child device removal
    PCI: vmd: Correct comment: VMD domains start at 0x10000, not 0x1000
    PCI: versatile: Add local struct device pointers
    PCI: tegra: Do not allocate MSI target memory
    PCI: tegra: Support MSI 64-bit addressing
    PCI: rockchip: Use local struct device pointer consistently
    PCI: rockchip: Check for clk_prepare_enable() errors during resume
    MAINTAINERS: Remove Wenrui Li as Rockchip PCIe driver maintainer
    PCI: rockchip: Configure RC's MPS setting
    PCI: rockchip: Reconfigure configuration space header type
    PCI: rockchip: Split out rockchip_pcie_cfg_configuration_accesses()
    PCI: rockchip: Move configuration accesses into rockchip_pcie_cfg_atu()
    ...

    Linus Torvalds
     

05 Jul, 2017

1 commit

  • Pull power management updates from Rafael Wysocki:
    "The big ticket items here are the rework of suspend-to-idle in order
    to add proper support for power button wakeup from it on recent Dell
    laptops and the rework of interfaces exporting the current CPU
    frequency on x86.

    In addition to that, support for a few new pieces of hardware is
    added, the PCI/ACPI device wakeup infrastructure is simplified
    significantly and the wakeup IRQ framework is fixed to unbreak the IRQ
    bus locking infrastructure.

    Also, there are some functional improvements for intel_pstate, tools
    updates and small fixes and cleanups all over.

    Specifics:

    - Rework suspend-to-idle to allow it to take wakeup events signaled
    by the EC into account on ACPI-based platforms in order to properly
    support power button wakeup from suspend-to-idle on recent Dell
    laptops (Rafael Wysocki).

    That includes the core suspend-to-idle code rework, support for the
    Low Power S0 _DSM interface, and support for the ACPI INT0002
    Virtual GPIO device from Hans de Goede (required for USB keyboard
    wakeup from suspend-to-idle to work on some machines).

    - Stop trying to export the current CPU frequency via /proc/cpuinfo
    on x86 as that is inaccurate and confusing (Len Brown).

    - Rework the way in which the current CPU frequency is exported by
    the kernel (over the cpufreq sysfs interface) on x86 systems with
    the APERF and MPERF registers by always using values read from
    these registers, when available, to compute the current frequency
    regardless of which cpufreq driver is in use (Len Brown).

    - Rework the PCI/ACPI device wakeup infrastructure to remove the
    questionable and artificial distinction between "devices that can
    wake up the system from sleep states" and "devices that can
    generate wakeup signals in the working state" from it, which allows
    the code to be simplified quite a bit (Rafael Wysocki).

    - Fix the wakeup IRQ framework by making it use SRCU instead of RCU
    which doesn't allow sleeping in the read-side critical sections,
    but which in turn is expected to be allowed by the IRQ bus locking
    infrastructure (Thomas Gleixner).

    - Modify some computations in the intel_pstate driver to avoid
    rounding errors resulting from them (Srinivas Pandruvada).

    - Reduce the overhead of the intel_pstate driver in the HWP
    (hardware-managed P-states) mode and when the "performance" P-state
    selection algorithm is in use by making it avoid registering
    scheduler callbacks in those cases (Len Brown).

    - Rework the energy_performance_preference sysfs knob in intel_pstate
    by changing the values that correspond to different symbolic hint
    names used by it (Len Brown).

    - Make it possible to use more than one cpuidle driver at the same
    time on ARM (Daniel Lezcano).

    - Make it possible to prevent the cpuidle menu governor from using
    the 0 state by disabling it via sysfs (Nicholas Piggin).

    - Add support for FFH (Fixed Functional Hardware) MWAIT in ACPI C1 on
    AMD systems (Yazen Ghannam).

    - Make the CPPC cpufreq driver take the lowest nonlinear performance
    information into account (Prashanth Prakash).

    - Add support for hi3660 to the cpufreq-dt driver, fix the imx6q
    driver and clean up the sfi, exynos5440 and intel_pstate drivers
    (Colin Ian King, Krzysztof Kozlowski, Octavian Purdila, Rafael
    Wysocki, Tao Wang).

    - Fix a few minor issues in the generic power domains (genpd)
    framework and clean it up somewhat (Krzysztof Kozlowski, Mikko
    Perttunen, Viresh Kumar).

    - Fix a couple of minor issues in the operating performance points
    (OPP) framework and clean it up somewhat (Viresh Kumar).

    - Fix a CONFIG dependency in the hibernation core and clean it up
    slightly (Balbir Singh, Arvind Yadav, BaoJun Luo).

    - Add rk3228 support to the rockchip-io adaptive voltage scaling
    (AVS) driver (David Wu).

    - Fix an incorrect bit shift operation in the RAPL power capping
    driver (Adam Lessnau).

    - Add support for the EPP field in the HWP (hardware managed
    P-states) control register, HWP.EPP, to the x86_energy_perf_policy
    tool and update msr-index.h with HWP.EPP values (Len Brown).

    - Fix some minor issues in the turbostat tool (Len Brown).

    - Add support for AMD family 0x17 CPUs to the cpupower tool and fix a
    minor issue in it (Sherry Hurwitz).

    - Assorted cleanups, mostly related to the constification of some
    data structures (Arvind Yadav, Joe Perches, Kees Cook, Krzysztof
    Kozlowski)"

    * tag 'pm-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (69 commits)
    cpufreq: Update scaling_cur_freq documentation
    cpufreq: intel_pstate: Clean up after performance governor changes
    PM: hibernate: constify attribute_group structures.
    cpuidle: menu: allow state 0 to be disabled
    intel_idle: Use more common logging style
    PM / Domains: Fix missing default_power_down_ok comment
    PM / Domains: Fix unsafe iteration over modified list of domains
    PM / Domains: Fix unsafe iteration over modified list of domain providers
    PM / Domains: Fix unsafe iteration over modified list of device links
    PM / Domains: Handle safely genpd_syscore_switch() call on non-genpd device
    PM / Domains: Call driver's noirq callbacks
    PM / core: Drop run_wake flag from struct dev_pm_info
    PCI / PM: Simplify device wakeup settings code
    PCI / PM: Drop pme_interrupt flag from struct pci_dev
    ACPI / PM: Consolidate device wakeup settings code
    ACPI / PM: Drop run_wake from struct acpi_device_wakeup_flags
    PM / QoS: constify *_attribute_group.
    PM / AVS: rockchip-io: add io selectors and supplies for rk3228
    powercap/RAPL: prevent overridding bits outside of the mask
    PM / sysfs: Constify attribute groups
    ...

    Linus Torvalds
     

04 Jul, 2017

1 commit

  • Pull driver core updates from Greg KH:
    "Here is the big driver core update for 4.13-rc1.

    The large majority of this is a lot of cleanup of old fields in the
    driver core structures and their remaining usages in random drivers.
    All of those fixes have been reviewed by the various subsystem
    maintainers. There's also some small firmware updates in here, a new
    kobject uevent api interface that makes userspace interaction easier,
    and a few other minor things.

    All of these have been in linux-next for a long while with no reported
    issues"

    * tag 'driver-core-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (56 commits)
    arm: mach-rpc: ecard: fix build error
    zram: convert remaining CLASS_ATTR() to CLASS_ATTR_RO()
    driver-core: remove struct bus_type.dev_attrs
    powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
    powerpc: vio: use dev_groups and not dev_attrs for bus_type
    USB: usbip: convert to use DRIVER_ATTR_RW
    s390: drivers: convert to use DRIVER_ATTR_RO/WO
    platform: thinkpad_acpi: convert to use DRIVER_ATTR_RO/RW
    pcmcia: ds: convert to use DRIVER_ATTR_RO
    wireless: ipw2x00: convert to use DRIVER_ATTR_RW
    net: ehea: convert to use DRIVER_ATTR_RO
    net: caif: convert to use DRIVER_ATTR_RO
    TTY: hvc: convert to use DRIVER_ATTR_RW
    PCI: pci-driver: convert to use DRIVER_ATTR_WO
    IB: nes: convert to use DRIVER_ATTR_RW
    HID: hid-core: convert to use DRIVER_ATTR_RO and drv_groups
    arm: ecard: fix dev_groups patch typo
    tty: serdev: use dev_groups and not dev_attrs for bus_type
    sparc: vio: use dev_groups and not dev_attrs for bus_type
    hid: intel-ish-hid: use dev_groups and not dev_attrs for bus_type
    ...

    Linus Torvalds
     

03 Jul, 2017

2 commits

  • * pci/irq-fixups:
    arm64: PCI: Drop DT IRQ allocation from pcibios_alloc_irq()
    PCI: xilinx-nwl: Move to struct pci_host_bridge IRQ mapping functions
    PCI: rockchip: Move to struct pci_host_bridge IRQ mapping functions
    PCI: xgene: Move to struct pci_host_bridge IRQ mapping functions
    PCI: altera: Drop pci_fixup_irqs()
    PCI: versatile: Drop pci_fixup_irqs()
    PCI: generic: Drop pci_fixup_irqs()
    PCI: faraday: Drop pci_fixup_irqs()
    PCI: designware: Drop pci_fixup_irqs()
    PCI: iproc: Drop pci_fixup_irqs()
    PCI: rcar: Drop pci_fixup_irqs()
    PCI: xilinx: Drop pci_fixup_irqs()
    PCI: tegra: Drop pci_fixup_irqs()
    ARM/PCI: Remove pci_fixup_irqs() call for bios32 host controllers
    PCI: Add a call to pci_assign_irq() in pci_device_probe()
    OF/PCI: Update of_irq_parse_and_map_pci() comment
    PCI: Add pci_assign_irq() function and have pci_fixup_irqs() use it
    PCI: Add IRQ mapping function pointers to pci_host_bridge struct
    PCI: Build setup-irq.o on all arches
    PCI: Remove pci_scan_root_bus_msi()
    PCI: xilinx-nwl: Convert PCI scan API to pci_scan_root_bus_bridge()
    PCI: rockchip: Convert PCI scan API to pci_scan_root_bus_bridge()
    PCI: generic: Convert PCI scan API to pci_scan_root_bus_bridge()
    PCI: xgene: Convert PCI scan API to pci_scan_root_bus_bridge()
    PCI: xilinx: Convert PCI scan API to pci_scan_root_bus_bridge()
    PCI: altera: Convert PCI scan API to pci_scan_root_bus_bridge()
    PCI: versatile: Convert PCI scan API to pci_scan_root_bus_bridge()
    PCI: iproc: Convert PCI scan API to pci_scan_root_bus_bridge()
    PCI: rcar: Convert PCI scan API to pci_scan_root_bus_bridge()
    PCI: aardvark: Convert PCI scan API to pci_scan_root_bus_bridge()
    PCI: designware: Convert PCI scan API to pci_scan_root_bus_bridge()
    ARM/PCI: Convert PCI scan API to pci_scan_root_bus_bridge()
    PCI: Make pci_register_host_bridge() PCI core internal
    PCI: Add pci_scan_root_bus_bridge() interface
    PCI: tegra: Fix host bridge memory leakage
    PCI: faraday: Fix host bridge memory leakage
    PCI: Add devm_pci_alloc_host_bridge() interface
    PCI: Add pci_free_host_bridge() interface
    PCI: Initialize bridge release function at bridge allocation
    PCI: faraday: Convert IRQ masking to raw PCI config accessors
    PCI: iproc: Convert link check to raw PCI config accessors
    PCI: xilinx-nwl: Remove nwl_pcie_enable_msi() unused bus parameter

    Bjorn Helgaas
     
  • The pci_assign_irq() function allows assignment of an IRQ to devices during
    device enable time rather than only at boot. Therefore call it in the
    pci_device_probe() function during the enable device code path so this
    assignment can be performed.

    This patch will do nothing on arches which do not set the IRQ mapping
    function pointers and is therefore currently a nop, however as support for
    these function pointers is added to arch-specific code this will cause IRQ
    assignment to migrate to device enable time allowing the new code paths to
    be used.

    Signed-off-by: Matthew Minter
    [lorenzo.pieralisi@arm.com: moved pci_assign_irq() call site]
    Signed-off-by: Lorenzo Pieralisi
    Signed-off-by: Bjorn Helgaas

    Matthew Minter
     

01 Jul, 2017

1 commit

  • Currently we saw a lot of "No irq handler" errors during hibernation, which
    caused the system hang finally:

    ata4.00: qc timeout (cmd 0xec)
    ata4.00: failed to IDENTIFY (I/O error, err_mask=0x4)
    ata4.00: revalidation failed (errno=-5)
    ata4: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
    do_IRQ: 31.151 No irq handler for vector

    According to above logs, there is an interrupt triggered and it is
    dispatched to CPU31 with a vector number 151, but there is no handler for
    it, thus this IRQ will not get acked and will cause an IRQ flood which
    kills the system. To be more specific, the 31.151 is an interrupt from the
    AHCI host controller.

    After some investigation, the reason why this issue is triggered is because
    the thaw_noirq() function does not restore the MSI/MSI-X settings across
    hibernation.

    The scenario is illustrated below:

    1. Before hibernation, IRQ 34 is the handler for the AHCI device, which
    is bound to CPU31.

    2. Hibernation starts, the AHCI device is put into low power state.

    3. All the nonboot CPUs are put offline, so IRQ 34 has to be migrated to
    the last alive one - CPU0.

    4. After the snapshot has been created, all the nonboot CPUs are brought
    up again; IRQ 34 remains bound to CPU0.

    5. AHCI devices are put into D0.

    6. The snapshot is written to the disk.

    The issue is triggered in step 6. The AHCI interrupt should be delivered
    to CPU0, however it is delivered to the original CPU31 instead, which
    causes the "No irq handler" issue.

    Ying Huang has provided a clue that, in step 3 it is possible that writing
    to the register might not take effect as the PCI devices have been
    suspended.

    In step 3, the IRQ 34 affinity should be modified from CPU31 to CPU0, but
    in fact it is not. In __pci_write_msi_msg(), if the device is already in
    low power state, the low level MSI message entry will not be updated but
    cached. During the device restore process after a normal suspend/resume,
    pci_restore_msi_state() writes the cached MSI back to the hardware.

    But this is not the case for hibernation. pci_restore_msi_state() is not
    currently called in pci_pm_thaw_noirq(), although pci_save_state() has
    saved the necessary PCI cached information in pci_pm_freeze_noirq().

    Restore the PCI status for the device during hibernation. Otherwise the
    status might be lost across hibernation (for example, settings for MSI,
    MSI-X, ATS, ACS, IOV, etc.), which might cause problems during hibernation.

    Suggested-by: Ying Huang
    Suggested-by: Rafael J. Wysocki
    Signed-off-by: Chen Yu
    [bhelgaas: changelog]
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Rafael J. Wysocki
    Cc: stable@vger.kernel.org
    Cc: Len Brown
    Cc: Dan Williams
    Cc: Rui Zhang
    Cc: Ying Huang

    Chen Yu
     

28 Jun, 2017

1 commit

  • After previous changes it is not necessary to distinguish between
    device wakeup for run time and device wakeup from system sleep states
    any more, so rework the PCI device wakeup settings code accordingly.

    Signed-off-by: Rafael J. Wysocki
    Reviewed-by: Mika Westerberg
    Acked-by: Bjorn Helgaas

    Rafael J. Wysocki
     

12 Jun, 2017

1 commit


26 May, 2017

2 commits

  • pci_call_probe() can called recursively when a physcial function is probed
    and the probing creates virtual functions, which are populated via
    pci_bus_add_device() which in turn can end up calling pci_call_probe()
    again.

    The code has an interesting way to prevent recursing into the workqueue
    code. That's accomplished by a check whether the current task runs already
    on the numa node which is associated with the device.

    While that works to prevent the recursion into the workqueue code, it's
    racy versus normal execution as there is no guarantee that the node does
    not vanish after the check.

    There is another issue with this code. It dereferences cpumask_of_node()
    unconditionally without checking whether the node is available.

    Make the detection reliable by:

    - Mark a probed device as 'is_probed' in pci_call_probe()

    - Check in pci_call_probe for a virtual function. If it's a virtual
    function and the associated physical function device is marked
    'is_probed' then this is a recursive call, so the call can be invoked in
    the calling context.

    - Add a check whether the node is online before dereferencing it.

    Signed-off-by: Thomas Gleixner
    Acked-by: Ingo Molnar
    Acked-by: Bjorn Helgaas
    Cc: Paul E. McKenney
    Cc: Peter Zijlstra
    Cc: linux-pci@vger.kernel.org
    Cc: Sebastian Siewior
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/20170524081548.771457199@linutronix.de

    Thomas Gleixner
     
  • Converting the hotplug locking, i.e. get_online_cpus(), to a percpu rwsem
    unearthed a circular lock dependency which was hidden from lockdep due to
    the lockdep annotation of get_online_cpus() which prevents lockdep from
    creating full dependency chains. There are several variants of this. And
    example is:

    Chain exists of:

    cpu_hotplug_lock.rw_sem --> drm_global_mutex --> &item->mutex

    CPU0 CPU1
    ---- ----
    lock(&item->mutex);
    lock(drm_global_mutex);
    lock(&item->mutex);
    lock(cpu_hotplug_lock.rw_sem);

    because there are dependencies through workqueues. The call chain is:

    get_online_cpus
    apply_workqueue_attrs
    __alloc_workqueue_key
    ttm_mem_global_init
    ast_ttm_mem_global_init
    drm_global_item_ref
    ast_mm_init
    ast_driver_load
    drm_dev_register
    drm_get_pci_dev
    ast_pci_probe
    local_pci_probe
    work_for_cpu_fn
    process_one_work
    worker_thread

    This is not a problem of get_online_cpus() recursion, it's a possible
    deadlock undetected by lockdep so far.

    The cure is to use cpu_hotplug_disable() instead of get_online_cpus() to
    protect the PCI probing.

    There is a side effect to this: cpu_hotplug_disable() makes a concurrent
    cpu hotplug attempt via the sysfs interfaces fail with -EBUSY, but PCI
    probing usually happens during the boot process where no interaction is
    possible. Any later invocations are infrequent enough and concurrent
    hotplug attempts are so unlikely that the danger of user space visible
    regressions is very close to zero. Anyway, thats preferrable over a real
    deadlock.

    Signed-off-by: Thomas Gleixner
    Acked-by: Ingo Molnar
    Acked-by: Bjorn Helgaas
    Cc: Paul E. McKenney
    Cc: Peter Zijlstra
    Cc: linux-pci@vger.kernel.org
    Cc: Sebastian Siewior
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/20170524081548.691198590@linutronix.de

    Thomas Gleixner
     

28 Apr, 2017

1 commit

  • * pci/virtualization:
    ixgbe: Use pcie_flr() instead of duplicating it
    IB/hfi1: Use pcie_flr() instead of duplicating it
    PCI: Call pcie_flr() from reset_chelsio_generic_dev()
    PCI: Call pcie_flr() from reset_intel_82599_sfp_virtfn()
    PCI: Export pcie_flr()
    PCI: Add sysfs sriov_drivers_autoprobe to control VF driver binding
    PCI: Avoid FLR for Intel 82579 NICs

    Conflicts:
    include/linux/pci.h

    Bjorn Helgaas
     

20 Apr, 2017

1 commit

  • Sometimes it is not desirable to bind SR-IOV VFs to drivers. This can save
    host side resource usage by VF instances that will be assigned to VMs.

    Add a new PCI sysfs interface "sriov_drivers_autoprobe" to control that
    from the PF. To modify it, echo 0/n/N (disable probe) or 1/y/Y (enable
    probe) to:

    /sys/bus/pci/devices//sriov_drivers_autoprobe

    Note that this must be done before enabling VFs. The change will not take
    effect if VFs are already enabled. Simply, one can disable VFs by setting
    sriov_numvfs to 0, choose whether to probe or not, and then re-enable the
    VFs by restoring sriov_numvfs.

    [bhelgaas: changelog, ABI doc]
    Signed-off-by: Bodong Wang
    Signed-off-by: Eli Cohen
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Gavin Shan
    Reviewed-by: Alex Williamson

    Bodong Wang
     

10 Mar, 2017

1 commit

  • The pci_bus_type .shutdown method, pci_device_shutdown(), is called from
    device_shutdown() in the kernel restart and shutdown paths.

    Previously, pci_device_shutdown() called pci_msi_shutdown() and
    pci_msix_shutdown(). This disables MSI and MSI-X, which causes the device
    to fall back to raising interrupts via INTx. But the driver is still bound
    to the device, it doesn't know about this change, and it likely doesn't
    have an INTx handler, so these INTx interrupts cause "nobody cared"
    warnings like this:

    irq 16: nobody cared (try booting with the "irqpoll" option)
    CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.8.2-1.el7_UNSUPPORTED.x86_64 #1
    Hardware name: Hewlett-Packard HP Z820 Workstation/158B, BIOS J63 v03.90 06/
    ...

    The MSI disabling code was added by d52877c7b1af ("pci/irq: let
    pci_device_shutdown to call pci_msi_shutdown v2") because a driver left MSI
    enabled and kdump failed because the kexeced kernel wasn't prepared to
    receive the MSI interrupts.

    Subsequent commits 1851617cd2da ("PCI/MSI: Disable MSI at enumeration even
    if kernel doesn't support MSI") and e80e7edc55ba ("PCI/MSI: Initialize MSI
    capability for all architectures") changed the kexeced kernel to disable
    all MSIs itself so it no longer depends on the crashed kernel to clean up
    after itself.

    Stop disabling MSI/MSI-X in pci_device_shutdown(). This resolves the
    "nobody cared" unhandled IRQ issue above. It also allows PCI serial
    devices, which may rely on the MSI interrupts, to continue outputting
    messages during reboot/shutdown.

    [bhelgaas: changelog, drop pci_msi_shutdown() and pci_msix_shutdown() calls
    altogether]
    Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=187351
    Signed-off-by: Prarit Bhargava
    Signed-off-by: Bjorn Helgaas
    CC: Alex Williamson
    CC: David Arcari
    CC: Myron Stowe
    CC: Lukas Wunner
    CC: Keith Busch
    CC: Mika Westerberg

    Prarit Bhargava
     

24 Feb, 2017

1 commit

  • Pull PCI updates from Bjorn Helgaas:

    - add ASPM L1 substate support

    - enable PCIe Extended Tags when supported

    - configure PCIe MPS settings on iProc, Versatile, X-Gene, and Xilinx

    - increase VPD access timeout

    - add ACS quirks for Intel Union Point, Qualcomm QDF2400 and QDF2432

    - use new pci_irq_alloc_vectors() in more drivers

    - fix MSI affinity memory leak

    - remove unused MSI interfaces and update documentation

    - remove unused AER .link_reset() callback

    - avoid pci_lock / p->pi_lock deadlock seen with perf

    - serialize sysfs enable/disable num_vfs operations

    - move DesignWare IP from drivers/pci/host/ to drivers/pci/dwc/ and
    refactor so we can support both hosts and endpoints

    - add DT ECAM-like support for HiSilicon Hip06/Hip07 controllers

    - add Rockchip system power management support

    - add Thunder-X cn81xx and cn83xx support

    - add Exynos 5440 PCIe PHY support

    * tag 'pci-v4.11-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (93 commits)
    PCI: dwc: Remove dependency of designware on CONFIG_PCI
    PCI: dwc: Add CONFIG_PCIE_DW_HOST to enable PCI dwc host
    PCI: dwc: Split pcie-designware.c into host and core files
    PCI: dwc: designware: Fix style errors in pcie-designware.c
    PCI: dwc: designware: Parse "num-lanes" property in dw_pcie_setup_rc()
    PCI: dwc: all: Split struct pcie_port into host-only and core structures
    PCI: dwc: designware: Get device pointer at the start of dw_pcie_host_init()
    PCI: dwc: all: Rename cfg_read/cfg_write to read/write
    PCI: dwc: all: Use platform_set_drvdata() to save private data
    PCI: dwc: designware: Move register defines to designware header file
    PCI: dwc: Use PTR_ERR_OR_ZERO to simplify code
    PCI: dra7xx: Group PHY API invocations
    PCI: dra7xx: Enable MSI and legacy interrupts simultaneously
    PCI: dra7xx: Add support to force RC to work in GEN1 mode
    PCI: dra7xx: Simplify probe code with devm_gpiod_get_optional()
    PCI: Move DesignWare IP support to new drivers/pci/dwc/ directory
    PCI: exynos: Support the PHY generic framework
    Documentation: binding: Modify the exynos5440 PCIe binding
    phy: phy-exynos-pcie: Add support for Exynos PCIe PHY
    Documentation: samsung-phy: Add exynos-pcie-phy binding
    ...

    Linus Torvalds
     

11 Feb, 2017

1 commit


21 Jan, 2017

1 commit


03 Oct, 2016

1 commit

  • * pci/pm:
    PCI: Avoid unnecessary resume after direct-complete
    PCI: Recognize D3cold in pci_update_current_state()
    PCI: Query platform firmware for device power state
    PCI: Afford direct-complete to devices with non-standard PM

    Bjorn Helgaas
     

29 Sep, 2016

1 commit

  • Commit 58a1fbbb2ee8 ("PM / PCI / ACPI: Kick devices that might have been
    reset by firmware") added a runtime resume for devices that were runtime
    suspended when the system entered sleep.

    The motivation was that devices might be in a reset-power-on state after
    waking from system sleep, so their power state as perceived by Linux
    (stored in pci_dev->current_state) would no longer reflect reality. By
    resuming such devices, we allow them to return to a low-power state via
    autosuspend and also bring their current_state in sync with reality.

    However for devices that are *not* in a reset-power-on state, doing an
    unconditional resume wastes energy. A more refined approach is called for
    which issues a runtime resume only if the power state after direct-complete
    is shallower than it was before. To achieve this, update the device's
    current_state and compare it to its pre-sleep value.

    Signed-off-by: Lukas Wunner
    Signed-off-by: Bjorn Helgaas
    Acked-by: Rafael J. Wysocki

    Lukas Wunner
     

10 Aug, 2016

1 commit

  • Drop the CONFIG_KEXEC_CORE #ifdef around reference to "kexec_in_progress".

    Commit 2b94ed245861 ("kexec: define kexec_in_progress in !CONFIG_KEXEC
    case") has made this unnecessary.

    Signed-off-by: Lukas Wunner
    Signed-off-by: Bjorn Helgaas

    Lukas Wunner
     

14 Jun, 2016

1 commit

  • Currently the Linux PCI core does not touch power state of PCI bridges and
    PCIe ports when system suspend is entered. Leaving them in D0 consumes
    power unnecessarily and may prevent the CPU from entering deeper C-states.

    With recent PCIe hardware we can power down the ports to save power given
    that we take into account few restrictions:

    - The PCIe port hardware is recent enough, starting from 2015.

    - Devices connected to PCIe ports are effectively in D3cold once the port
    is transitioned to D3 (the config space is not accessible anymore and
    the link may be powered down).

    - Devices behind the PCIe port need to be allowed to transition to D3cold
    and back. There is a way both drivers and userspace can forbid this.

    - If the device behind the PCIe port is capable of waking the system it
    needs to be able to do so from D3cold.

    This patch adds a new flag to struct pci_device called 'bridge_d3'. This
    flag is set and cleared by the PCI core whenever there is a change in power
    management state of any of the devices behind the PCIe port. When system
    later on is suspended we only need to check this flag and if it is true
    transition the port to D3 otherwise we leave it in D0.

    Also provide override mechanism via command line parameter
    "pcie_port_pm=[off|force]" that can be used to disable or enable the
    feature regardless of the BIOS manufacturing date.

    Tested-by: Lukas Wunner
    Signed-off-by: Mika Westerberg
    Signed-off-by: Bjorn Helgaas
    Acked-by: Rafael J. Wysocki

    Mika Westerberg
     

02 Dec, 2015

1 commit

  • The runtime PM core doesn't treat EBUSY and EAGAIN retvals from the driver
    suspend hooks as errors, but they still show up as errors in dmesg. Tune
    them down. See rpm_suspend() for details of handling these return values.

    Note that we use dev_dbg() for the retryable retvals, so after this
    change you'll need either CONFIG_DYNAMIC_DEBUG or CONFIG_PCI_DEBUG
    for them to show up in the log.

    One problem caused by this was noticed by Daniel: the i915 driver
    returns EAGAIN to signal a temporary failure to suspend and as a request
    towards the RPM core for scheduling a suspend again. This is a normal
    event, but the resulting error message flags a breakage during the
    driver's automated testing which parses dmesg and picks up the error.

    Reported-by: Daniel Vetter
    Link: https://bugs.freedesktop.org/show_bug.cgi?id=92992
    Signed-off-by: Imre Deak
    Acked-by: Bjorn Helgaas
    Signed-off-by: Rafael J. Wysocki

    Imre Deak
     

07 Nov, 2015

1 commit

  • Pull PCI updates from Bjorn Helgaas:
    "Resource management:
    - Add support for Enhanced Allocation devices (Sean O. Stalley)
    - Add Enhanced Allocation register entries (Sean O. Stalley)
    - Handle IORESOURCE_PCI_FIXED when sizing resources (David Daney)
    - Handle IORESOURCE_PCI_FIXED when assigning resources (David Daney)
    - Handle Enhanced Allocation capability for SR-IOV devices (David Daney)
    - Clear IORESOURCE_UNSET when reverting to firmware-assigned address (Bjorn Helgaas)
    - Make Enhanced Allocation bitmasks more obvious (Bjorn Helgaas)
    - Expand Enhanced Allocation BAR output (Bjorn Helgaas)
    - Add of_pci_check_probe_only to parse "linux,pci-probe-only" (Marc Zyngier)
    - Fix lookup of linux,pci-probe-only property (Marc Zyngier)
    - Add sparc mem64 resource parsing for root bus (Yinghai Lu)

    PCI device hotplug:
    - pciehp: Queue power work requests in dedicated function (Guenter Roeck)

    Driver binding:
    - Add builtin_pci_driver() to avoid registration boilerplate (Paul Gortmaker)

    Virtualization:
    - Set SR-IOV NumVFs to zero after enumeration (Alexander Duyck)
    - Remove redundant validation of SR-IOV offset/stride registers (Alexander Duyck)
    - Remove VFs in reverse order if virtfn_add() fails (Alexander Duyck)
    - Reorder pcibios_sriov_disable() (Alexander Duyck)
    - Wait 1 second between disabling VFs and clearing NumVFs (Alexander Duyck)
    - Fix sriov_enable() error path for pcibios_enable_sriov() failures (Alexander Duyck)
    - Enable SR-IOV ARI Capable Hierarchy before reading TotalVFs (Ben Shelton)
    - Don't try to restore VF BARs (Wei Yang)

    MSI:
    - Don't alloc pcibios-irq when MSI is enabled (Joerg Roedel)
    - Add msi_controller setup_irqs() method for special multivector setup (Lucas Stach)
    - Export all remapped MSIs to sysfs attributes (Romain Bezut)
    - Disable MSI on SiS 761 (Ondrej Zary)

    AER:
    - Clear error status registers during enumeration and restore (Taku Izumi)

    Generic host bridge driver:
    - Fix lookup of linux,pci-probe-only property (Marc Zyngier)
    - Allow multiple hosts with different map_bus() methods (David Daney)
    - Pass starting bus number to pci_scan_root_bus() (David Daney)
    - Fix address window calculation for non-zero starting bus (David Daney)

    Altera host bridge driver:
    - Add msi.h to ARM Kbuild (Ley Foon Tan)
    - Add Altera PCIe host controller driver (Ley Foon Tan)
    - Add Altera PCIe MSI driver (Ley Foon Tan)

    APM X-Gene host bridge driver:
    - Remove msi_controller assignment (Duc Dang)

    Broadcom iProc host bridge driver:
    - Fix header comment "Corporation" misspelling (Florian Fainelli)
    - Fix code comment to match code (Ray Jui)
    - Remove unused struct iproc_pcie.irqs[] (Ray Jui)
    - Call pci_fixup_irqs() for ARM64 as well as ARM (Ray Jui)
    - Fix PCIe reset logic (Ray Jui)
    - Improve link detection logic (Ray Jui)
    - Update PCIe device tree bindings (Ray Jui)
    - Add outbound mapping support (Ray Jui)

    Freescale i.MX6 host bridge driver:
    - Return real error code from imx6_add_pcie_port() (Fabio Estevam)
    - Add PCIE_PHY_RX_ASIC_OUT_VALID definition (Fabio Estevam)

    Freescale Layerscape host bridge driver:
    - Remove ls_pcie_establish_link() (Minghuan Lian)
    - Ignore PCIe controllers in Endpoint mode (Minghuan Lian)
    - Factor out SCFG related function (Minghuan Lian)
    - Update ls_add_pcie_port() (Minghuan Lian)
    - Remove unused fields from struct ls_pcie (Minghuan Lian)
    - Add support for LS1043a and LS2080a (Minghuan Lian)
    - Add ls_pcie_msi_host_init() (Minghuan Lian)

    HiSilicon host bridge driver:
    - Add HiSilicon SoC Hip05 PCIe driver (Zhou Wang)

    Marvell MVEBU host bridge driver:
    - Return zero for reserved or unimplemented config space (Russell King)
    - Use exact config access size; don't read/modify/write (Russell King)
    - Use of_get_available_child_count() (Russell King)
    - Use for_each_available_child_of_node() to walk child nodes (Russell King)
    - Report full node name when reporting a DT error (Russell King)
    - Use port->name rather than "PCIe%d.%d" (Russell King)
    - Move port parsing and resource claiming to separate function (Russell King)
    - Fix memory leaks and refcount leaks (Russell King)
    - Split port parsing and resource claiming from port setup (Russell King)
    - Use gpio_set_value_cansleep() (Russell King)
    - Use devm_kcalloc() to allocate an array (Russell King)
    - Use gpio_desc to carry around gpio (Russell King)
    - Improve clock/reset handling (Russell King)
    - Add PCI Express root complex capability block (Russell King)
    - Remove code restricting accesses to slot 0 (Russell King)

    NVIDIA Tegra host bridge driver:
    - Wrap static pgprot_t initializer with __pgprot() (Ard Biesheuvel)

    Renesas R-Car host bridge driver:
    - Build pci-rcar-gen2.c only on ARM (Geert Uytterhoeven)
    - Build pcie-rcar.c only on ARM (Geert Uytterhoeven)
    - Make PCI aware of the I/O resources (Phil Edworthy)
    - Remove dependency on ARM-specific struct hw_pci (Phil Edworthy)
    - Set root bus nr to that provided in DT (Phil Edworthy)
    - Fix I/O offset for multiple host bridges (Phil Edworthy)

    ST Microelectronics SPEAr13xx host bridge driver:
    - Fix dw_pcie_cfg_read/write() usage (Gabriele Paoloni)

    Synopsys DesignWare host bridge driver:
    - Make "clocks" and "clock-names" optional DT properties (Bhupesh Sharma)
    - Use exact access size in dw_pcie_cfg_read() (Gabriele Paoloni)
    - Simplify dw_pcie_cfg_read/write() interfaces (Gabriele Paoloni)
    - Require config accesses to be naturally aligned (Gabriele Paoloni)
    - Make "num-lanes" an optional DT property (Gabriele Paoloni)
    - Move calculation of bus addresses to DRA7xx (Gabriele Paoloni)
    - Replace ARM pci_sys_data->align_resource with global function pointer (Gabriele Paoloni)
    - Factor out MSI msg setup (Lucas Stach)
    - Implement multivector MSI IRQ setup (Lucas Stach)
    - Make get_msi_addr() return phys_addr_t, not u32 (Lucas Stach)
    - Set up high part of MSI target address (Lucas Stach)
    - Fix PORT_LOGIC_LINK_WIDTH_MASK (Zhou Wang)
    - Revert "PCI: designware: Program ATU with untranslated address" (Zhou Wang)
    - Use of_pci_get_host_bridge_resources() to parse DT (Zhou Wang)
    - Make driver arch-agnostic (Zhou Wang)

    Miscellaneous:
    - Make x86 pci_subsys_init() static (Alexander Kuleshov)
    - Turn off Request Attributes to avoid Chelsio T5 Completion erratum (Hariprasad Shenai)"

    * tag 'pci-v4.4-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (94 commits)
    PCI: altera: Add Altera PCIe MSI driver
    PCI: hisi: Add HiSilicon SoC Hip05 PCIe driver
    PCI: layerscape: Add ls_pcie_msi_host_init()
    PCI: layerscape: Add support for LS1043a and LS2080a
    PCI: layerscape: Remove unused fields from struct ls_pcie
    PCI: layerscape: Update ls_add_pcie_port()
    PCI: layerscape: Factor out SCFG related function
    PCI: layerscape: Ignore PCIe controllers in Endpoint mode
    PCI: layerscape: Remove ls_pcie_establish_link()
    PCI: designware: Make "clocks" and "clock-names" optional DT properties
    PCI: designware: Make driver arch-agnostic
    ARM/PCI: Replace pci_sys_data->align_resource with global function pointer
    PCI: designware: Use of_pci_get_host_bridge_resources() to parse DT
    Revert "PCI: designware: Program ATU with untranslated address"
    PCI: designware: Move calculation of bus addresses to DRA7xx
    PCI: designware: Make "num-lanes" an optional DT property
    PCI: designware: Require config accesses to be naturally aligned
    PCI: designware: Simplify dw_pcie_cfg_read/write() interfaces
    PCI: designware: Use exact access size in dw_pcie_cfg_read()
    PCI: spear: Fix dw_pcie_cfg_read/write() usage
    ...

    Linus Torvalds
     

14 Oct, 2015

2 commits

  • There is a concern that if the platform firmware was involved in
    the system resume that's being completed, some devices might have
    been reset by it and if those devices had the power.direct_complete
    flag set during the preceding suspend transition, they may stay
    in a reset-power-on state indefinitely (until they are runtime-resumed
    and then suspended again). That may not be a big deal from the
    individual device's perspective, but if the system is an SoC, it may
    be prevented from entering deep SoC-wide low-power states on idle
    because of that.

    The devices that are most likely to be affected by this issue are
    PCI devices and ACPI-enumerated devices using the general ACPI PM
    domain, so to prevent it from happening for those devices, force a
    runtime resume for them if they have their power.direct_complete
    flags set and the platform firmware was involved in the resume
    transition currently in progress.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • The pm_request_idle() in pm_generic_complete() is pointless as it is
    called with the runtime PM usage counter different from zero (bumped
    up by the core during the prepare phase of system suspend) and the
    core calls pm_runtime_put() for all devices after executing their
    complete callbacks, so drop it.

    This allows the PCI PM layer to use pm_generic_complete() too.

    Signed-off-by: Rafael J. Wysocki
    Reviewed-by: Ulf Hansson

    Rafael J. Wysocki
     

13 Oct, 2015

1 commit

  • Commit bac2a909a096 (PCI / PM: Avoid resuming PCI devices during
    system suspend) introduced a mechanism by which some PCI devices that
    were runtime-suspended at the system suspend time might be left in
    that state for the duration of the system suspend-resume cycle.
    However, it overlooked devices that were marked as capable of waking
    up the system just because PME support was detected in their PCI
    config space.

    Namely, in that case, device_can_wakeup(dev) returns 'true' for the
    device and if the device is not configured for system wakeup,
    device_may_wakeup(dev) returns 'false' and it will be resumed during
    system suspend even though configuring it for system wakeup may not
    really make sense at all.

    To avoid this problem, simply disable PME for PCI devices that have
    not been configured for system wakeup and are runtime-suspended at
    the system suspend time for the duration of the suspend-resume cycle.

    If the device is in D3cold, its config space is not available and it
    shouldn't be written to, but that's only possible if the device
    has platform PM support and the platform code is responsible for
    checking whether or not the device's configuration is suitable for
    system suspend in that case.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

25 Sep, 2015

1 commit

  • Section 3.2 "Device Runtime Power Management" of pci.txt has become
    outdated, so update it to correctly reflect the current code flow.

    Also update the comment in local_pci_probe() to document the fact
    that pm_runtime_put_noidle() is not the only runtime PM helper
    function that can be used to decrement the device's runtime PM
    usage counter in .probe().

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Alan Stern

    Rafael J. Wysocki
     

19 Sep, 2015

1 commit

  • In store_remove_id(), set the default return value to -ENODEV, and
    overwrite it with the input buffer size if we find a matching list entry.
    Then we don't need to test whether to return an error or the count.

    No functional change.

    [bhelgaas: changelog]
    Signed-off-by: Zhen Lei
    Signed-off-by: Bjorn Helgaas

    Zhen Lei
     

11 Sep, 2015

1 commit

  • There are two kexec load syscalls, kexec_load another and kexec_file_load.
    kexec_file_load has been splited as kernel/kexec_file.c. In this patch I
    split kexec_load syscall code to kernel/kexec.c.

    And add a new kconfig option KEXEC_CORE, so we can disable kexec_load and
    use kexec_file_load only, or vice verse.

    The original requirement is from Ted Ts'o, he want kexec kernel signature
    being checked with CONFIG_KEXEC_VERIFY_SIG enabled. But kexec-tools use
    kexec_load syscall can bypass the checking.

    Vivek Goyal proposed to create a common kconfig option so user can compile
    in only one syscall for loading kexec kernel. KEXEC/KEXEC_FILE selects
    KEXEC_CORE so that old config files still work.

    Because there's general code need CONFIG_KEXEC_CORE, so I updated all the
    architecture Kconfig with a new option KEXEC_CORE, and let KEXEC selects
    KEXEC_CORE in arch Kconfig. Also updated general kernel code with to
    kexec_load syscall.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Dave Young
    Cc: Eric W. Biederman
    Cc: Vivek Goyal
    Cc: Petr Tesarik
    Cc: Theodore Ts'o
    Cc: Josh Boyer
    Cc: David Howells
    Cc: Geert Uytterhoeven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Young
     

31 Jul, 2015

1 commit

  • Add pcibios_alloc_irq() and pcibios_free_irq(), which are called when
    binding/unbinding PCI device drivers.

    PCI arch code may implement these to manage IRQ resources for hotplugged
    devices.

    [bhelgaas: changelog]
    Signed-off-by: Jiang Liu
    Signed-off-by: Bjorn Helgaas
    Acked-by: Thomas Gleixner

    Jiang Liu
     

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
     

24 Jan, 2015

1 commit

  • Commit f25c0ae2b4c4 (ACPI / PM: Avoid resuming devices in ACPI PM
    domain during system suspend) modified the ACPI PM domain's system
    suspend callbacks to allow devices attached to it to be left in the
    runtime-suspended state during system suspend so as to optimize
    the suspend process.

    This was based on the general mechanism introduced by commit
    aae4518b3124 (PM / sleep: Mechanism to avoid resuming runtime-suspended
    devices unnecessarily).

    Extend that approach to PCI devices by modifying the PCI bus type's
    ->prepare callback to return 1 for devices that are runtime-suspended
    when it is being executed and that are in a suitable power state and
    need not be resumed going forward.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Bjorn Helgaas

    Rafael J. Wysocki
     

10 Jan, 2015

1 commit

  • Some implementations of modprobe fail to load the driver for a PCI device
    automatically because the "interface" part of the modalias from the kernel
    is lowercase, and the modalias from file2alias is uppercase.

    The "interface" is the low-order byte of the Class Code, defined in PCI
    r3.0, Appendix D. Most interface types defined in the spec do not use
    alpha characters, so they won't be affected. For example, 00h, 01h, 10h,
    20h, etc. are unaffected.

    Print the "interface" byte of the Class Code in uppercase hex, as we
    already do for the Vendor ID, Device ID, Class, etc.

    Commit 89ec3dcf17fd ("PCI: Generate uppercase hex for modalias interface
    class") fixed only half of the problem. Some udev implementations rely on
    the uevent file and not the modalias file.

    Fixes: d1ded203adf1 ("PCI: add MODALIAS to hotplug event for pci devices")
    Fixes: 89ec3dcf17fd ("PCI: Generate uppercase hex for modalias interface class")
    Signed-off-by: Ricardo Ribalda Delgado
    Signed-off-by: Bjorn Helgaas
    Acked-by: Greg Kroah-Hartman
    CC: stable@vger.kernel.org

    Ricardo Ribalda Delgado
     

04 Dec, 2014

1 commit

  • After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is
    selected) PM_RUNTIME is always set if PM is set, so quite a few
    depend on CONFIG_PM.

    Replace CONFIG_PM_RUNTIME with CONFIG_PM in the PCI core code.

    Reviewed-by: Ulf Hansson
    Acked-by: Bjorn Helgaas
    Acked-by: Kevin Hilman
    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki