1. 24 5月, 2018 1 次提交
  2. 10 5月, 2018 1 次提交
    • R
      PCI / PM: Check device_may_wakeup() in pci_enable_wake() · cfcadfaa
      Rafael J. Wysocki 提交于
      Commit 0847684c (PCI / PM: Simplify device wakeup settings code)
      went too far and dropped the device_may_wakeup() check from
      pci_enable_wake() which causes wakeup to be enabled during system
      suspend, hibernation or shutdown for some PCI devices that are not
      allowed by user space to wake up the system from sleep (or power off).
      
      As a result of this, excessive power is drawn by some of the affected
      systems while in sleep states or off.
      
      Restore the device_may_wakeup() check in pci_enable_wake(), but make
      sure that the PCI bus type's runtime suspend callback will not call
      device_may_wakeup() which is about system wakeup from sleep and not
      about device wakeup from runtime suspend.
      
      Fixes: 0847684c (PCI / PM: Simplify device wakeup settings code)
      Reported-by: NJoseph Salisbury <joseph.salisbury@canonical.com>
      Cc: 4.13+ <stable@vger.kernel.org> # 4.13+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      cfcadfaa
  3. 09 5月, 2018 1 次提交
    • K
      PCI / PM: Always check PME wakeup capability for runtime wakeup support · 8feaec33
      Kai Heng Feng 提交于
      USB controller ASM1042 stops working after commit de3ef1eb (PM /
      core: Drop run_wake flag from struct dev_pm_info).
      
      The device in question is not power managed by platform firmware,
      furthermore, it only supports PME# from D3cold:
      Capabilities: [78] Power Management version 3
             Flags: PMEClk- DSI- D1- D2- AuxCurrent=55mA PME(D0-,D1-,D2-,D3hot-,D3cold+)
             Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
      
      Before commit de3ef1eb, the device never gets runtime suspended.
      After that commit, the device gets runtime suspended to D3hot, which can
      not generate any PME#.
      
      usb_hcd_pci_probe() unconditionally calls device_wakeup_enable(), hence
      device_can_wakeup() in pci_dev_run_wake() always returns true.
      
      So pci_dev_run_wake() needs to check PME wakeup capability as its first
      condition.
      
      In addition, change wakeup flag passed to pci_target_state() from false
      to true, because we want to find the deepest state different from D3cold
      that the device can still generate PME#. In this case, it's D0 for the
      device in question.
      
      Fixes: de3ef1eb (PM / core: Drop run_wake flag from struct dev_pm_info)
      Signed-off-by: NKai-Heng Feng <kai.heng.feng@canonical.com>
      Cc: 4.13+ <stable@vger.kernel.org> # 4.13+
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8feaec33
  4. 21 4月, 2018 1 次提交
  5. 11 4月, 2018 1 次提交
  6. 04 4月, 2018 3 次提交
  7. 03 4月, 2018 2 次提交
    • T
      PCI: Add pcie_print_link_status() to log link speed and whether it's limited · 9e506a7b
      Tal Gilboa 提交于
      Add pcie_print_link_status().  This logs the current settings of the link
      (speed, width, and total available bandwidth).
      
      If the device is capable of more bandwidth but is limited by a slower
      upstream link, we include information about the link that limits the
      device's performance.
      
      The user may be able to move the device to a different slot for better
      performance.
      
      This provides a unified method for all PCI devices to report status and
      issues, instead of each device reporting in a different way, using
      different code.
      Signed-off-by: NTal Gilboa <talgi@mellanox.com>
      [bhelgaas: changelog, reword log messages, print device capabilities when
      not limited, print bandwidth in Gb/s]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      9e506a7b
    • T
      PCI: Add pcie_bandwidth_available() to compute bandwidth available to device · 6db79a88
      Tal Gilboa 提交于
      Add pcie_bandwidth_available() to compute the bandwidth available to a
      device.  This may be limited by the device itself or by a slower upstream
      link leading to the device.
      
      The available bandwidth at each link along the path is computed as:
      
        link_width * link_speed * (1 - encoding_overhead)
      
      2.5 and 5.0 GT/s links use 8b/10b encoding, which reduces the raw bandwidth
      available by 20%; 8.0 GT/s and faster links use 128b/130b encoding, which
      reduces it by about 1.5%.
      
      The result is in Mb/s, i.e., megabits/second, of raw bandwidth.
      
      Also return the device with the slowest link and the speed and width of
      that link.
      Signed-off-by: NTal Gilboa <talgi@mellanox.com>
      [bhelgaas: changelog, leave pcie_get_minimum_link() alone for now, return
      bw directly, use pci_upstream_bridge(), check "next_bw <= bw" to find
      uppermost limiting device, return speed/width of the limiting device]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      6db79a88
  8. 31 3月, 2018 3 次提交
  9. 20 3月, 2018 1 次提交
  10. 14 3月, 2018 1 次提交
    • L
      PCI: Make pci_wakeup_bus() & pci_bus_set_current_state() public · 2a4d2c42
      Lukas Wunner 提交于
      There are PCI devices which are power-manageable by a nonstandard means,
      such as a custom ACPI method.  One example are discrete GPUs in hybrid
      graphics laptops, another are Thunderbolt controllers in Macs.
      
      Such devices can't be put into D3cold with pci_set_power_state() because
      pci_platform_power_transition() fails with -ENODEV.  Instead they're put
      into D3hot by pci_set_power_state() and subsequently into D3cold by
      invoking the nonstandard means.  However as a consequence the cached
      current_state is incorrectly left at D3hot.
      
      What we need to do is walk the hierarchy below such a PCI device on
      powerdown and update the current_state to D3cold.  On powerup the PCI
      device itself and the hierarchy below it is in D0uninitialized, so we
      need to walk the hierarchy again and wake all devices, causing them to
      be put into D0active and then letting them autosuspend as they see fit.
      
      To this end make pci_wakeup_bus() & pci_bus_set_current_state() public
      so PCI drivers don't have to reinvent the wheel.
      
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/2962443259e7faec577274b4ef8c54aad66f9a94.1520068884.git.lukas@wunner.de
      2a4d2c42
  11. 12 3月, 2018 1 次提交
  12. 05 3月, 2018 3 次提交
  13. 02 3月, 2018 1 次提交
  14. 28 2月, 2018 3 次提交
  15. 23 2月, 2018 1 次提交
  16. 22 2月, 2018 1 次提交
  17. 27 1月, 2018 1 次提交
  18. 24 1月, 2018 1 次提交
    • J
      PCI: Add pci_enable_atomic_ops_to_root() · 430a2368
      Jay Cornwall 提交于
      The Atomic Operations feature (PCIe r4.0, sec 6.15) allows atomic
      transctions to be requested by, routed through and completed by PCIe
      components. Routing and completion do not require software support.
      Component support for each is detectable via the DEVCAP2 register.
      
      A Requester may use AtomicOps only if its PCI_EXP_DEVCTL2_ATOMIC_REQ is
      set. This should be set only if the Completer and all intermediate routing
      elements support AtomicOps.
      
      A concrete example is the AMD Fiji-class GPU (which is capable of making
      AtomicOp requests), below a PLX 8747 switch (advertising AtomicOp routing)
      with a Haswell host bridge (advertising AtomicOp completion support).
      
      Add pci_enable_atomic_ops_to_root() for per-device control over AtomicOp
      requests. This checks to be sure the Root Port supports completion of the
      desired AtomicOp sizes and the path to the Root Port supports routing the
      AtomicOps.
      Signed-off-by: NJay Cornwall <Jay.Cornwall@amd.com>
      Signed-off-by: NFelix Kuehling <Felix.Kuehling@amd.com>
      [bhelgaas: changelog, comments, whitespace]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      430a2368
  19. 19 1月, 2018 1 次提交
  20. 14 12月, 2017 1 次提交
  21. 09 11月, 2017 1 次提交
  22. 06 11月, 2017 1 次提交
  23. 26 10月, 2017 1 次提交
    • B
      PCI: Document reset method return values · 832c418a
      Bjorn Helgaas 提交于
      The pci_reset_function() path may try several different reset methods:
      device-specific resets, PCIe Function Level Resets, PCI Advanced Features
      Function Level Reset, etc.
      
      Add a comment about what the return values from these methods mean.  If one
      of the methods fails, in some cases we want to continue and try the next
      one in the list, but sometimes we want to stop trying.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      832c418a
  24. 25 10月, 2017 1 次提交
  25. 12 10月, 2017 2 次提交
  26. 06 10月, 2017 1 次提交
  27. 15 9月, 2017 1 次提交
    • B
      Revert "PCI: Avoid race while enabling upstream bridges" · 0f50a49e
      Bjorn Helgaas 提交于
      This reverts commit 40f11adc.
      
      Jens found that iwlwifi firmware loading failed on a Lenovo X1 Carbon,
      gen4:
      
        iwlwifi 0000:04:00.0: Direct firmware load for iwlwifi-8000C-34.ucode failed with error -2
        iwlwifi 0000:04:00.0: Direct firmware load for iwlwifi-8000C-33.ucode failed with error -2
        iwlwifi 0000:04:00.0: Direct firmware load for iwlwifi-8000C-32.ucode failed with error -2
        iwlwifi 0000:04:00.0: loaded firmware version 31.532993.0 op_mode iwlmvm
        iwlwifi 0000:04:00.0: Detected Intel(R) Dual Band Wireless AC 8260, REV=0x208
        ...
        iwlwifi 0000:04:00.0: Failed to load firmware chunk!
        iwlwifi 0000:04:00.0: Could not load the [0] uCode section
        iwlwifi 0000:04:00.0: Failed to start INIT ucode: -110
        iwlwifi 0000:04:00.0: Failed to run INIT ucode: -110
      
      He bisected it to 40f11adc ("PCI: Avoid race while enabling upstream
      bridges").  Revert that commit to fix the regression.
      
      Link: http://lkml.kernel.org/r/4bcbcbc1-7c79-09f0-5071-bc2f53bf6574@kernel.dk
      Fixes: 40f11adc ("PCI: Avoid race while enabling upstream bridges")
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: Srinath Mannam <srinath.mannam@broadcom.com>
      CC: Jens Axboe <axboe@kernel.dk>
      CC: Luca Coelho <luca@coelho.fi>
      CC: Johannes Berg <johannes@sipsolutions.net>
      CC: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
      0f50a49e
  28. 30 8月, 2017 1 次提交
    • S
      PCI: Wait up to 60 seconds for device to become ready after FLR · 821cdad5
      Sinan Kaya 提交于
      Sporadic reset issues have been observed with an Intel 750 NVMe drive while
      assigning the physical function to the guest machine.  The sequence of
      events observed is as follows:
      
        - perform a Function Level Reset (FLR)
        - sleep up to 1000ms total
        - read ~0 from PCI_COMMAND (CRS completion for config read)
        - warn that the device didn't return from FLR
        - touch the device before it's ready
        - device drops config writes when we restore register settings (there's
          no mechanism for software to learn about CRS completions for writes)
        - incomplete register restore leaves device in inconsistent state
        - device probe fails because device is in inconsistent state
      
      After reset, an endpoint may respond to config requests with Configuration
      Request Retry Status (CRS) to indicate that it is not ready to accept new
      requests. See PCIe r3.1, sec 2.3.1 and 6.6.2.
      
      Increase the timeout value from 1 second to 60 seconds to cover the period
      where device responds with CRS and also report polling progress.
      Signed-off-by: NSinan Kaya <okaya@codeaurora.org>
      [bhelgaas: include the mandatory 100ms in the delays we print]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      821cdad5
  29. 25 8月, 2017 1 次提交
  30. 19 8月, 2017 1 次提交
    • S
      PCI: Avoid race while enabling upstream bridges · 40f11adc
      Srinath Mannam 提交于
      When we enable a device, we first enable any upstream bridges.  If a bridge
      has multiple downstream devices and we enable them simultaneously, the race
      to enable the upstream bridge may cause problems.  Consider this hierarchy:
      
        bridge A --+-- device B
                   +-- device C
      
      If drivers for B and C call pci_enable_device() simultaneously, both will
      attempt to enable A, which involves setting PCI_COMMAND_MASTER via
      pci_set_master() and PCI_COMMAND_MEMORY via pci_enable_resources().
      
      In the following sequence, B's update to set A's PCI_COMMAND_MEMORY is
      lost, and neither B nor C will work correctly:
      
            B                                C
        pci_set_master(A)
          cmd = read(A, PCI_COMMAND)
          cmd |= PCI_COMMAND_MASTER
                                         pci_set_master(A)
                                           cmd = read(A, PCI_COMMAND)
                                           cmd |= PCI_COMMAND_MASTER
          write(A, PCI_COMMAND, cmd)
        pci_enable_device(A)
          pci_enable_resources(A)
            cmd = read(A, PCI_COMMAND)
            cmd |= PCI_COMMAND_MEMORY
            write(A, PCI_COMMAND, cmd)
                                           write(A, PCI_COMMAND, cmd)
      
      Avoid this race by holding a new pci_bridge_mutex while enabling a bridge.
      This ensures that both PCI_COMMAND_MASTER and PCI_COMMAND_MEMORY will be
      updated before another thread can start enabling the bridge.
      
      Note that although pci_enable_bridge() is recursive, it enables any
      upstream bridges *before* acquiring the mutex.  When it acquires the mutex
      and calls pci_set_master() and pci_enable_device(), any upstream bridges
      have already been enabled so pci_enable_device() will not deadlock by
      calling pci_enable_bridge() again.
      Signed-off-by: NSrinath Mannam <srinath.mannam@broadcom.com>
      [bhelgaas: changelog, comment]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      40f11adc