]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Merge tag 'pci-v5.3-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 16 Jul 2019 03:44:49 +0000 (20:44 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 16 Jul 2019 03:44:49 +0000 (20:44 -0700)
Pull PCI updates from Bjorn Helgaas:
 "Enumeration changes:

   - Evaluate PCI Boot Configuration _DSM to learn if firmware wants us
     to preserve its resource assignments (Benjamin Herrenschmidt)

   - Simplify resource distribution (Nicholas Johnson)

   - Decode 32 GT/s link speed (Gustavo Pimentel)

  Virtualization:

   - Fix incorrect caching of VF config space size (Alex Williamson)

   - Fix VF driver probing sysfs knobs (Alex Williamson)

  Peer-to-peer DMA:

   - Fix dma_virt_ops check (Logan Gunthorpe)

  Altera host bridge driver:

   - Allow building as module (Ley Foon Tan)

  Armada 8K host bridge driver:

   - add PHYs support (Miquel Raynal)

  DesignWare host bridge driver:

   - Export APIs to support removable loadable module (Vidya Sagar)

   - Enable Relaxed Ordering erratum workaround only on Tegra20 &
     Tegra30 (Vidya Sagar)

  Hyper-V host bridge driver:

   - Fix use-after-free in eject (Dexuan Cui)

  Mobiveil host bridge driver:

   - Clean up and fix many issues, including non-identify mapped
     windows, 64-bit windows, multi-MSI, class code, INTx clearing (Hou
     Zhiqiang)

  Qualcomm host bridge driver:

   - Use clk bulk API for 2.4.0 controllers (Bjorn Andersson)

   - Add QCS404 support (Bjorn Andersson)

   - Assert PERST for at least 100ms (Niklas Cassel)

  R-Car host bridge driver:

   - Add r8a774a1 DT support (Biju Das)

  Tegra host bridge driver:

   - Add support for Gen2, opportunistic UpdateFC and ACK (PCIe protocol
     details) AER, GPIO-based PERST# (Manikanta Maddireddy)

   - Fix many issues, including power-on failure cases, interrupt
     masking in suspend, UPHY settings, AFI dynamic clock gating,
     pending DLL transactions (Manikanta Maddireddy)

  Xilinx host bridge driver:

   - Fix NWL Multi-MSI programming (Bharat Kumar Gogada)

  Endpoint support:

   - Fix 64bit BAR support (Alan Mikhak)

   - Fix pcitest build issues (Alan Mikhak, Andy Shevchenko)

  Bug fixes:

   - Fix NVIDIA GPU multi-function power dependencies (Abhishek Sahu)

   - Fix NVIDIA GPU HDA enablement issue (Lukas Wunner)

   - Ignore lockdep for sysfs "remove" (Marek Vasut)

  Misc:

   - Convert docs to reST (Changbin Du, Mauro Carvalho Chehab)"

* tag 'pci-v5.3-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (107 commits)
  PCI: Enable NVIDIA HDA controllers
  tools: PCI: Fix installation when `make tools/pci_install`
  PCI: dwc: pci-dra7xx: Fix compilation when !CONFIG_GPIOLIB
  PCI: Fix typos and whitespace errors
  PCI: mobiveil: Fix INTx interrupt clearing in mobiveil_pcie_isr()
  PCI: mobiveil: Fix infinite-loop in the INTx handling function
  PCI: mobiveil: Move PCIe PIO enablement out of inbound window routine
  PCI: mobiveil: Add upper 32-bit PCI base address setup in inbound window
  PCI: mobiveil: Add upper 32-bit CPU base address setup in outbound window
  PCI: mobiveil: Mask out hardcoded bits in inbound/outbound windows setup
  PCI: mobiveil: Clear the control fields before updating it
  PCI: mobiveil: Add configured inbound windows counter
  PCI: mobiveil: Fix the valid check for inbound and outbound windows
  PCI: mobiveil: Clean-up program_{ib/ob}_windows()
  PCI: mobiveil: Remove an unnecessary return value check
  PCI: mobiveil: Fix error return values
  PCI: mobiveil: Refactor the MEM/IO outbound window initialization
  PCI: mobiveil: Make some register updates more readable
  PCI: mobiveil: Reformat the code for readability
  dt-bindings: PCI: mobiveil: Change gpio_slave and apb_csr to optional
  ...

24 files changed:
1  2 
Documentation/ABI/testing/sysfs-class-powercap
Documentation/admin-guide/kernel-parameters.txt
Documentation/index.rst
Documentation/scheduler/sched-energy.rst
Documentation/translations/zh_CN/process/submitting-drivers.rst
MAINTAINERS
arch/arm64/kernel/pci.c
arch/x86/Kconfig
drivers/acpi/pci_root.c
drivers/gpu/drm/i915/intel_runtime_pm.h
drivers/opp/Kconfig
drivers/pci/p2pdma.c
drivers/pci/pci-driver.c
drivers/pci/pci.c
drivers/pci/pci.h
drivers/pci/probe.c
drivers/power/supply/power_supply_core.c
drivers/soc/tegra/pmc.c
include/linux/mod_devicetable.h
include/linux/pci.h
include/linux/pm.h
kernel/power/Kconfig
net/wireless/Kconfig
tools/pci/pcitest.c

index 71a77feb779b6a7a104b3d59d4163f409b909ebf,4afa431d9b1f8c1301f547f21f141db08aa45b36..00a0fe4241a4239118805b85f26a4bce0a9bd40b
@@@ -102,7 -101,7 +102,8 @@@ needed)
     filesystems/index
     vm/index
     bpf/index
 +   usb/index
+    PCI/index
     misc-devices/index
  
  Architecture-specific documentation
diff --cc MAINTAINERS
Simple merge
Simple merge
Simple merge
Simple merge
index 473c4850c01d0c6dacdaff180c0f1bf4077652b4,0000000000000000000000000000000000000000..2ee8f9522e0570cb0eeb2bfb35192fc3725b33a0
mode 100644,000000..100644
--- /dev/null
@@@ -1,213 -1,0 +1,213 @@@
-  * For more, read the Documentation/power/runtime_pm.txt.
 +/* SPDX-License-Identifier: MIT */
 +/*
 + * Copyright © 2019 Intel Corporation
 + */
 +
 +#ifndef __INTEL_RUNTIME_PM_H__
 +#define __INTEL_RUNTIME_PM_H__
 +
 +#include <linux/types.h>
 +
 +#include "display/intel_display.h"
 +
 +#include "intel_wakeref.h"
 +
 +#include "i915_utils.h"
 +
 +struct device;
 +struct drm_i915_private;
 +struct drm_printer;
 +
 +enum i915_drm_suspend_mode {
 +      I915_DRM_SUSPEND_IDLE,
 +      I915_DRM_SUSPEND_MEM,
 +      I915_DRM_SUSPEND_HIBERNATE,
 +};
 +
 +/*
 + * This struct helps tracking the state needed for runtime PM, which puts the
 + * device in PCI D3 state. Notice that when this happens, nothing on the
 + * graphics device works, even register access, so we don't get interrupts nor
 + * anything else.
 + *
 + * Every piece of our code that needs to actually touch the hardware needs to
 + * either call intel_runtime_pm_get or call intel_display_power_get with the
 + * appropriate power domain.
 + *
 + * Our driver uses the autosuspend delay feature, which means we'll only really
 + * suspend if we stay with zero refcount for a certain amount of time. The
 + * default value is currently very conservative (see intel_runtime_pm_enable), but
 + * it can be changed with the standard runtime PM files from sysfs.
 + *
 + * The irqs_disabled variable becomes true exactly after we disable the IRQs and
 + * goes back to false exactly before we reenable the IRQs. We use this variable
 + * to check if someone is trying to enable/disable IRQs while they're supposed
 + * to be disabled. This shouldn't happen and we'll print some error messages in
 + * case it happens.
 + *
++ * For more, read the Documentation/power/runtime_pm.rst.
 + */
 +struct intel_runtime_pm {
 +      atomic_t wakeref_count;
 +      struct device *kdev; /* points to i915->drm.pdev->dev */
 +      bool available;
 +      bool suspended;
 +      bool irqs_enabled;
 +
 +#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
 +      /*
 +       * To aide detection of wakeref leaks and general misuse, we
 +       * track all wakeref holders. With manual markup (i.e. returning
 +       * a cookie to each rpm_get caller which they then supply to their
 +       * paired rpm_put) we can remove corresponding pairs of and keep
 +       * the array trimmed to active wakerefs.
 +       */
 +      struct intel_runtime_pm_debug {
 +              spinlock_t lock;
 +
 +              depot_stack_handle_t last_acquire;
 +              depot_stack_handle_t last_release;
 +
 +              depot_stack_handle_t *owners;
 +              unsigned long count;
 +      } debug;
 +#endif
 +};
 +
 +#define BITS_PER_WAKEREF      \
 +      BITS_PER_TYPE(struct_member(struct intel_runtime_pm, wakeref_count))
 +#define INTEL_RPM_WAKELOCK_SHIFT      (BITS_PER_WAKEREF / 2)
 +#define INTEL_RPM_WAKELOCK_BIAS               (1 << INTEL_RPM_WAKELOCK_SHIFT)
 +#define INTEL_RPM_RAW_WAKEREF_MASK    (INTEL_RPM_WAKELOCK_BIAS - 1)
 +
 +static inline int
 +intel_rpm_raw_wakeref_count(int wakeref_count)
 +{
 +      return wakeref_count & INTEL_RPM_RAW_WAKEREF_MASK;
 +}
 +
 +static inline int
 +intel_rpm_wakelock_count(int wakeref_count)
 +{
 +      return wakeref_count >> INTEL_RPM_WAKELOCK_SHIFT;
 +}
 +
 +static inline void
 +assert_rpm_device_not_suspended(struct intel_runtime_pm *rpm)
 +{
 +      WARN_ONCE(rpm->suspended,
 +                "Device suspended during HW access\n");
 +}
 +
 +static inline void
 +__assert_rpm_raw_wakeref_held(struct intel_runtime_pm *rpm, int wakeref_count)
 +{
 +      assert_rpm_device_not_suspended(rpm);
 +      WARN_ONCE(!intel_rpm_raw_wakeref_count(wakeref_count),
 +                "RPM raw-wakeref not held\n");
 +}
 +
 +static inline void
 +__assert_rpm_wakelock_held(struct intel_runtime_pm *rpm, int wakeref_count)
 +{
 +      __assert_rpm_raw_wakeref_held(rpm, wakeref_count);
 +      WARN_ONCE(!intel_rpm_wakelock_count(wakeref_count),
 +                "RPM wakelock ref not held during HW access\n");
 +}
 +
 +static inline void
 +assert_rpm_raw_wakeref_held(struct intel_runtime_pm *rpm)
 +{
 +      __assert_rpm_raw_wakeref_held(rpm, atomic_read(&rpm->wakeref_count));
 +}
 +
 +static inline void
 +assert_rpm_wakelock_held(struct intel_runtime_pm *rpm)
 +{
 +      __assert_rpm_wakelock_held(rpm, atomic_read(&rpm->wakeref_count));
 +}
 +
 +/**
 + * disable_rpm_wakeref_asserts - disable the RPM assert checks
 + * @rpm: the intel_runtime_pm structure
 + *
 + * This function disable asserts that check if we hold an RPM wakelock
 + * reference, while keeping the device-not-suspended checks still enabled.
 + * It's meant to be used only in special circumstances where our rule about
 + * the wakelock refcount wrt. the device power state doesn't hold. According
 + * to this rule at any point where we access the HW or want to keep the HW in
 + * an active state we must hold an RPM wakelock reference acquired via one of
 + * the intel_runtime_pm_get() helpers. Currently there are a few special spots
 + * where this rule doesn't hold: the IRQ and suspend/resume handlers, the
 + * forcewake release timer, and the GPU RPS and hangcheck works. All other
 + * users should avoid using this function.
 + *
 + * Any calls to this function must have a symmetric call to
 + * enable_rpm_wakeref_asserts().
 + */
 +static inline void
 +disable_rpm_wakeref_asserts(struct intel_runtime_pm *rpm)
 +{
 +      atomic_add(INTEL_RPM_WAKELOCK_BIAS + 1,
 +                 &rpm->wakeref_count);
 +}
 +
 +/**
 + * enable_rpm_wakeref_asserts - re-enable the RPM assert checks
 + * @rpm: the intel_runtime_pm structure
 + *
 + * This function re-enables the RPM assert checks after disabling them with
 + * disable_rpm_wakeref_asserts. It's meant to be used only in special
 + * circumstances otherwise its use should be avoided.
 + *
 + * Any calls to this function must have a symmetric call to
 + * disable_rpm_wakeref_asserts().
 + */
 +static inline void
 +enable_rpm_wakeref_asserts(struct intel_runtime_pm *rpm)
 +{
 +      atomic_sub(INTEL_RPM_WAKELOCK_BIAS + 1,
 +                 &rpm->wakeref_count);
 +}
 +
 +void intel_runtime_pm_init_early(struct intel_runtime_pm *rpm);
 +void intel_runtime_pm_enable(struct intel_runtime_pm *rpm);
 +void intel_runtime_pm_disable(struct intel_runtime_pm *rpm);
 +void intel_runtime_pm_cleanup(struct intel_runtime_pm *rpm);
 +
 +intel_wakeref_t intel_runtime_pm_get(struct intel_runtime_pm *rpm);
 +intel_wakeref_t intel_runtime_pm_get_if_in_use(struct intel_runtime_pm *rpm);
 +intel_wakeref_t intel_runtime_pm_get_noresume(struct intel_runtime_pm *rpm);
 +intel_wakeref_t intel_runtime_pm_get_raw(struct intel_runtime_pm *rpm);
 +
 +#define with_intel_runtime_pm(rpm, wf) \
 +      for ((wf) = intel_runtime_pm_get(rpm); (wf); \
 +           intel_runtime_pm_put((rpm), (wf)), (wf) = 0)
 +
 +#define with_intel_runtime_pm_if_in_use(rpm, wf) \
 +      for ((wf) = intel_runtime_pm_get_if_in_use(rpm); (wf); \
 +           intel_runtime_pm_put((rpm), (wf)), (wf) = 0)
 +
 +void intel_runtime_pm_put_unchecked(struct intel_runtime_pm *rpm);
 +#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
 +void intel_runtime_pm_put(struct intel_runtime_pm *rpm, intel_wakeref_t wref);
 +#else
 +static inline void
 +intel_runtime_pm_put(struct intel_runtime_pm *rpm, intel_wakeref_t wref)
 +{
 +      intel_runtime_pm_put_unchecked(rpm);
 +}
 +#endif
 +void intel_runtime_pm_put_raw(struct intel_runtime_pm *rpm, intel_wakeref_t wref);
 +
 +#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
 +void print_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm,
 +                                  struct drm_printer *p);
 +#else
 +static inline void print_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm,
 +                                                struct drm_printer *p)
 +{
 +}
 +#endif
 +
 +#endif /* __INTEL_RUNTIME_PM_H__ */
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge