1. 04 2月, 2017 1 次提交
    • E
      PCI: Lock each enable/disable num_vfs operation in sysfs · 5b0948df
      Emil Tantilov 提交于
      Enabling/disabling SRIOV via sysfs by echo-ing multiple values
      simultaneously:
      
        # echo 63 > /sys/class/net/ethX/device/sriov_numvfs&
        # echo 63 > /sys/class/net/ethX/device/sriov_numvfs
      
        # sleep 5
      
        # echo 0 > /sys/class/net/ethX/device/sriov_numvfs&
        # echo 0 > /sys/class/net/ethX/device/sriov_numvfs
      
      results in the following bug:
      
        kernel BUG at drivers/pci/iov.c:495!
        invalid opcode: 0000 [#1] SMP
        CPU: 1 PID: 8050 Comm: bash Tainted: G   W   4.9.0-rc7-net-next #2092
        RIP: 0010:[<ffffffff813b1647>]
      	    [<ffffffff813b1647>] pci_iov_release+0x57/0x60
      
        Call Trace:
         [<ffffffff81391726>] pci_release_dev+0x26/0x70
         [<ffffffff8155be6e>] device_release+0x3e/0xb0
         [<ffffffff81365ee7>] kobject_cleanup+0x67/0x180
         [<ffffffff81365d9d>] kobject_put+0x2d/0x60
         [<ffffffff8155bc27>] put_device+0x17/0x20
         [<ffffffff8139c08a>] pci_dev_put+0x1a/0x20
         [<ffffffff8139cb6b>] pci_get_dev_by_id+0x5b/0x90
         [<ffffffff8139cca5>] pci_get_subsys+0x35/0x40
         [<ffffffff8139ccc8>] pci_get_device+0x18/0x20
         [<ffffffff8139ccfb>] pci_get_domain_bus_and_slot+0x2b/0x60
         [<ffffffff813b09e7>] pci_iov_remove_virtfn+0x57/0x180
         [<ffffffff813b0b95>] pci_disable_sriov+0x65/0x140
         [<ffffffffa00a1af7>] ixgbe_disable_sriov+0xc7/0x1d0 [ixgbe]
         [<ffffffffa00a1e9d>] ixgbe_pci_sriov_configure+0x3d/0x170 [ixgbe]
         [<ffffffff8139d28c>] sriov_numvfs_store+0xdc/0x130
        ...
        RIP  [<ffffffff813b1647>] pci_iov_release+0x57/0x60
      
      Use the existing mutex lock to protect each enable/disable operation.
      Signed-off-by: NEmil Tantilov <emil.s.tantilov@intel.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      CC: Alexander Duyck <alexander.h.duyck@intel.com>
      5b0948df
  2. 13 12月, 2016 1 次提交
  3. 07 12月, 2016 1 次提交
  4. 30 11月, 2016 2 次提交
  5. 18 11月, 2016 2 次提交
    • L
      PCI: Activate runtime PM on a PCIe port only if it can suspend · c6a63307
      Lukas Wunner 提交于
      Currently pcie_portdrv_probe() activates runtime PM on a PCIe port even
      if it will never actually suspend because the BIOS is too old or the
      "pcie_port_pm=off" option was specified on the kernel command line.
      
      A few CPU cycles can be saved by not activating runtime PM at all in these
      cases, because rpm_idle() and rpm_suspend() will bail out right at the
      beginning when calling rpm_check_suspend_allowed(), instead of carrying out
      various locking and assignments, invoking rpm_callback(), getting back
      -EBUSY and rolling everything back.
      
      The conditions checked in pci_bridge_d3_possible() are all static, they
      never change during uptime of the system, hence it's safe to call this to
      determine if runtime PM should be activated.
      
      No functional change intended.
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c6a63307
    • L
      PCI: Autosense device removal in pci_bridge_d3_update() · 1ed276a7
      Lukas Wunner 提交于
      The algorithm to update the flag indicating whether a bridge may go to D3
      makes a few optimizations based on whether the update was caused by the
      removal of a device on the one hand, versus the addition of a device or the
      change of its D3cold flags on the other hand.
      
      The information whether the update pertains to a removal is currently
      passed in by the caller, but the function may as well determine that itself
      by examining the device in question, thereby allowing for a considerable
      simplification and reduction of the code.
      
      Out of several options to determine removal, I've chosen the function
      device_is_registered() because it's cheap:  It merely returns the
      dev->kobj.state_in_sysfs flag.  That flag is set through device_add() when
      the root bus is scanned and cleared through device_remove().  The call to
      pci_bridge_d3_update() happens after each of these calls, respectively, so
      the ordering is correct.
      
      No functional change intended.
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1ed276a7
  6. 29 9月, 2016 1 次提交
    • L
      PCI: Query platform firmware for device power state · cc7cc02b
      Lukas Wunner 提交于
      Usually the most accurate way to determine a PCI device's power state is to
      read its PM Control & Status Register.  There are two cases however when
      this is not an option:  If the device doesn't have the PM capability at
      all, or if it is in D3cold (in which case its config space is
      inaccessible).
      
      In both cases, we can alternatively query the platform firmware for its
      opinion on the device's power state.  To facilitate this, augment struct
      pci_platform_pm_ops with a ->get_power callback and implement it for
      acpi_pci_platform_pm (the only pci_platform_pm_ops existing so far).
      
      It is used by a forthcoming commit to let pci_update_current_state()
      recognize D3cold.
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      cc7cc02b
  7. 16 8月, 2016 1 次提交
  8. 14 6月, 2016 1 次提交
    • M
      PCI: Put PCIe ports into D3 during suspend · 9d26d3a8
      Mika Westerberg 提交于
      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: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      9d26d3a8
  9. 16 4月, 2016 1 次提交
  10. 01 3月, 2016 4 次提交
  11. 09 12月, 2015 1 次提交
  12. 01 12月, 2015 1 次提交
  13. 26 11月, 2015 1 次提交
  14. 30 10月, 2015 1 次提交
  15. 13 10月, 2015 1 次提交
    • R
      PCI / PM: Avoid resuming more devices during system suspend · 2cef548a
      Rafael J. Wysocki 提交于
      Commit bac2a909 (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: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      2cef548a
  16. 15 7月, 2015 1 次提交
  17. 30 5月, 2015 1 次提交
  18. 07 5月, 2015 1 次提交
  19. 09 4月, 2015 1 次提交
  20. 31 3月, 2015 2 次提交
  21. 24 1月, 2015 1 次提交
    • R
      PCI / PM: Avoid resuming PCI devices during system suspend · bac2a909
      Rafael J. Wysocki 提交于
      Commit f25c0ae2 (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
      aae4518b (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: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      bac2a909
  22. 17 1月, 2015 1 次提交
  23. 20 11月, 2014 1 次提交
  24. 14 11月, 2014 1 次提交
  25. 28 5月, 2014 1 次提交
  26. 30 4月, 2014 1 次提交
    • B
      PCI: Remove unnecessary __ref annotations · 10874f5a
      Bjorn Helgaas 提交于
      Some PCI functions used to be marked __devinit.  When CONFIG_HOTPLUG was
      not set, these functions were discarded after boot.  A few callers of these
      __devinit functions were marked __ref to indicate that they could safely
      call the __devinit functions even though the callers were not __devinit.
      
      But CONFIG_HOTPLUG and __devinit are now gone, and the need for the __ref
      annotations is also gone, so remove them.  Relevant historical commits:
      
        54b956b9 Remove __dev* markings from init.h
        a8e4b9c1 PCI: add generic pci_hp_add_bridge()
        0ab2b57f PCI: fix section mismatch warning in pci_scan_child_bus
        451124a7 PCI: fix 4x section mismatch warnings
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      10874f5a
  27. 20 2月, 2014 1 次提交
  28. 14 1月, 2014 1 次提交
  29. 08 10月, 2013 2 次提交
  30. 27 9月, 2013 1 次提交
  31. 31 7月, 2013 1 次提交
  32. 26 7月, 2013 1 次提交
  33. 23 6月, 2013 1 次提交
    • J
      PCI / ACPI: Use boot-time resource allocation rules during hotplug · d66ecb72
      Jiang Liu 提交于
      On x86 platforms, the kernel respects PCI resource assignments from
      the BIOS and only reassigns resources for unassigned BARs at boot
      time.  However, with the ACPI-based hotplug (acpiphp), it ignores the
      BIOS' PCI resource assignments completely and reassigns all resources
      by itself.  This causes differences in PCI resource allocation
      between boot time and runtime hotplug to occur, which is generally
      undesirable and sometimes actively breaks things.
      
      Namely, if there are enough resources, reassigning all PCI resources
      during runtime hotplug should work, but it may fail if the resources
      are constrained.  This may happen, for instance, when some PCI
      devices with huge MMIO BARs are involved in the runtime hotplug
      operations, because the current PCI MMIO alignment algorithm may
      waste huge chunks of MMIO address space in those cases.
      
      On the Alexander's Sony VAIO VPCZ23A4R the BIOS allocates limited
      MMIO resources for the dock station which contains a device
      (graphics adapter) with a 256MB MMIO BAR.  An attempt to reassign
      that during runtime hotplug causes the dock station MMIO window to be
      exhausted and acpiphp fails to allocate resources for the majority
      of devices on the dock station as a result.
      
      To prevent that from happening, modify acpiphp to follow the boot
      time resources allocation behavior so that the BIOS' resource
      assignments are respected during runtime hotplug too.
      
      [rjw: Changelog]
      References: https://bugzilla.kernel.org/show_bug.cgi?id=56531Reported-and-tested-by: NAlexander E. Patrakov <patrakov@gmail.com>
      Tested-by: NIllya Klymov <xanf@xanf.me>
      Signed-off-by: NJiang Liu <jiang.liu@huawei.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Cc: 3.9+ <stable@vger.kernel.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d66ecb72