1. 19 8月, 2021 1 次提交
  2. 18 8月, 2021 4 次提交
  3. 25 6月, 2021 1 次提交
  4. 22 6月, 2021 1 次提交
  5. 04 6月, 2021 2 次提交
  6. 25 5月, 2021 1 次提交
  7. 01 5月, 2021 1 次提交
  8. 20 4月, 2021 1 次提交
  9. 01 4月, 2021 1 次提交
  10. 24 3月, 2021 1 次提交
    • R
      PCI: PM: Do not read power state in pci_enable_device_flags() · 4514d991
      Rafael J. Wysocki 提交于
      It should not be necessary to update the current_state field of
      struct pci_dev in pci_enable_device_flags() before calling
      do_pci_enable_device() for the device, because none of the
      code between that point and the pci_set_power_state() call in
      do_pci_enable_device() invoked later depends on it.
      
      Moreover, doing that is actively harmful in some cases.  For example,
      if the given PCI device depends on an ACPI power resource whose _STA
      method initially returns 0 ("off"), but the config space of the PCI
      device is accessible and the power state retrieved from the
      PCI_PM_CTRL register is D0, the current_state field in the struct
      pci_dev representing that device will get out of sync with the
      power.state of its ACPI companion object and that will lead to
      power management issues going forward.
      
      To avoid such issues it is better to leave the current_state value
      as is until it is changed to PCI_D0 by do_pci_enable_device() as
      appropriate.  However, the power state of the device is not changed
      to PCI_D0 if it is already enabled when pci_enable_device_flags()
      gets called for it, so update its current_state in that case, but
      use pci_update_current_state() covering platform PM too for that.
      
      Link: https://lore.kernel.org/lkml/20210314000439.3138941-1-luzmaximilian@gmail.com/Reported-by: NMaximilian Luz <luzmaximilian@gmail.com>
      Tested-by: NMaximilian Luz <luzmaximilian@gmail.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      4514d991
  11. 17 3月, 2021 1 次提交
  12. 18 2月, 2021 1 次提交
    • G
      PCI: Fix pci_register_io_range() memory leak · f6bda644
      Geert Uytterhoeven 提交于
      Kmemleak reports:
      
        unreferenced object 0xc328de40 (size 64):
          comm "kworker/1:1", pid 21, jiffies 4294938212 (age 1484.670s)
          hex dump (first 32 bytes):
            00 00 00 00 00 00 00 00 e0 d8 fc eb 00 00 00 00  ................
            00 00 10 fe 00 00 00 00 00 00 00 00 00 00 00 00  ................
      
        backtrace:
          [<ad758d10>] pci_register_io_range+0x3c/0x80
          [<2c7f139e>] of_pci_range_to_resource+0x48/0xc0
          [<f079ecc8>] devm_of_pci_get_host_bridge_resources.constprop.0+0x2ac/0x3ac
          [<e999753b>] devm_of_pci_bridge_init+0x60/0x1b8
          [<a895b229>] devm_pci_alloc_host_bridge+0x54/0x64
          [<e451ddb0>] rcar_pcie_probe+0x2c/0x644
      
      In case a PCI host driver's probe is deferred, the same I/O range may be
      allocated again, and be ignored, causing a memory leak.
      
      Fix this by (a) letting logic_pio_register_range() return -EEXIST if the
      passed range already exists, so pci_register_io_range() will free it, and
      by (b) making pci_register_io_range() not consider -EEXIST an error
      condition.
      
      Link: https://lore.kernel.org/r/20210202100332.829047-1-geert+renesas@glider.beSigned-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      f6bda644
  13. 28 1月, 2021 1 次提交
  14. 15 1月, 2021 3 次提交
  15. 11 12月, 2020 3 次提交
  16. 09 12月, 2020 1 次提交
  17. 05 12月, 2020 4 次提交
  18. 01 12月, 2020 3 次提交
  19. 21 11月, 2020 1 次提交
  20. 31 10月, 2020 1 次提交
  21. 01 10月, 2020 3 次提交
  22. 30 9月, 2020 1 次提交
  23. 18 9月, 2020 2 次提交
    • L
      PCI: Simplify pci_dev_reset_slot_function() · 10791141
      Lukas Wunner 提交于
      pci_dev_reset_slot_function() refuses to reset a hotplug slot if it is
      shared by multiple pci_devs.  That's the case if and only if the slot is
      occupied by a multifunction device.
      
      Simplify the function to check the device's multifunction flag instead
      of iterating over the devices on the bus.  (Iterating over the devices
      requires holding pci_bus_sem, which the function erroneously does not
      acquire.)
      
      Link: https://lore.kernel.org/r/c6aab5af096f7b1b3db57f6335cebba8f0fcca89.1595330431.git.lukas@wunner.deSigned-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: Alex Williamson <alex.williamson@redhat.com>
      10791141
    • L
      PCI: pciehp: Reduce noisiness on hot removal · 8a614499
      Lukas Wunner 提交于
      When a PCIe card is hot-removed, the Presence Detect State and Data Link
      Layer Link Active bits often do not clear simultaneously.  I've seen delays
      of up to 244 msec between the two events with Thunderbolt.
      
      After pciehp has brought down the slot in response to the first event, the
      other bit may still be set.  It's not discernible whether it's set because
      a new card is already in the slot or if it will soon clear.  So pciehp
      tries to bring up the slot and in the latter case fails with a bunch of
      messages, some of them at KERN_ERR severity.  If the slot is no longer
      occupied, the messages are false positives and annoy users.
      
      Stuart Hayes reports the following splat on hot removal:
      
        KERN_INFO pcieport 0000:3c:06.0: pciehp: Slot(180): Link Up
        KERN_INFO pcieport 0000:3c:06.0: pciehp: Timeout waiting for Presence Detect
        KERN_ERR  pcieport 0000:3c:06.0: pciehp: link training error: status 0x0001
        KERN_ERR  pcieport 0000:3c:06.0: pciehp: Failed to check link status
      
      Dongdong Liu complains about a similar splat:
      
        KERN_INFO pciehp 0000:80:10.0:pcie004: Slot(36): Link Down
        KERN_INFO iommu: Removing device 0000:87:00.0 from group 12
        KERN_INFO pciehp 0000:80:10.0:pcie004: Slot(36): Card present
        KERN_INFO pcieport 0000:80:10.0: Data Link Layer Link Active not set in 1000 msec
        KERN_ERR  pciehp 0000:80:10.0:pcie004: Failed to check link status
      
      Users are particularly irritated to see a bringup attempt even though the
      slot was explicitly brought down via sysfs.  In a perfect world, we could
      avoid this by setting Link Disable on slot bringdown and re-enabling it
      upon a Presence Detect State change.  In reality however, there are broken
      hotplug ports which hardwire Presence Detect to zero, see 80696f99
      ("PCI: pciehp: Tolerate Presence Detect hardwired to zero").  Conversely,
      PCIe r1.0 hotplug ports hardwire Link Active to zero because Link Active
      Reporting wasn't specified before PCIe r1.1.  On unplug, some ports first
      clear Presence then Link (see Stuart Hayes' splat) whereas others use the
      inverse order (see Dongdong Liu's splat).  To top it off, there are hotplug
      ports which flap the Presence and Link bits on slot bringup, see
      6c35a1ac ("PCI: pciehp: Tolerate initially unstable link").
      
      pciehp is designed to work with all of these variants.  Surplus attempts at
      slot bringup are a lesser evil than not being able to bring up slots at
      all.  Although we could try to perfect the behavior for specific hotplug
      controllers, we'd risk breaking others or increasing code complexity.
      
      But we can certainly minimize annoyance by emitting only a single message
      with KERN_INFO severity if bringup is unsuccessful:
      
      * Drop the "Timeout waiting for Presence Detect" message in
        pcie_wait_for_presence().  The sole caller of that function,
        pciehp_check_link_status(), ignores the timeout and carries on.  It emits
        error messages of its own and I don't think this particular message adds
        much value.
      
      * There's a single error condition in pciehp_check_link_status() which
        does not emit a message.  Adding one allows dropping the "Failed to check
        link status" message emitted by board_added() if
        pciehp_check_link_status() returns a non-zero integer.
      
      * Tone down all messages in pciehp_check_link_status() to KERN_INFO
        severity and rephrase them to look as innocuous as possible.  To this
        end, move the message emitted by pcie_wait_for_link_delay() to its
        callers.
      
      As a result, Stuart Hayes' splat becomes:
      
        KERN_INFO pcieport 0000:3c:06.0: pciehp: Slot(180): Link Up
        KERN_INFO pcieport 0000:3c:06.0: pciehp: Slot(180): Cannot train link: status 0x0001
      
      Dongdong Liu's splat becomes:
      
        KERN_INFO pciehp 0000:80:10.0:pcie004: Slot(36): Card present
        KERN_INFO pciehp 0000:80:10.0:pcie004: Slot(36): No link
      
      The messages now merely serve as information that presence or link bits
      were set a little longer than expected.  Bringup failures which are not
      false positives are still reported, albeit no longer at KERN_ERR severity.
      
      Link: https://lore.kernel.org/linux-pci/20200310182100.102987-1-stuart.w.hayes@gmail.com/
      Link: https://lore.kernel.org/linux-pci/1547649064-19019-1-git-send-email-liudongdong3@huawei.com/
      Link: https://lore.kernel.org/r/b45e46fd8a6aa6930aaac9d7718c2e4b787a4e5e.1595935071.git.lukas@wunner.deReported-by: NStuart Hayes <stuart.w.hayes@gmail.com>
      Reported-by: NDongdong Liu <liudongdong3@huawei.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      8a614499
  24. 17 9月, 2020 1 次提交
    • R
      PCI/ACS: Enable Translation Blocking for external devices · 76fc8e85
      Rajat Jain 提交于
      Translation Blocking is a required feature for Downstream Ports (Root
      Ports or Switch Downstream Ports) that implement ACS.  When enabled, the
      Port checks the Address Type (AT) of each upstream Memory Request it
      receives.
      
      The default AT (00b) means "untranslated" and the IOMMU can decide whether
      to treat the address as I/O virtual or physical.
      
      If AT is not the default, i.e., if the Memory Request contains an
      already-translated (physical) address, the Port blocks the request and
      reports an ACS error.
      
      When enabling ACS, enable Translation Blocking for external-facing ports
      and untrusted (external) devices.  This is to help prevent attacks from
      external devices that initiate DMA with physical addresses that bypass the
      IOMMU.
      
      [bhelgaas: commit log, simplify setting bit and drop warning; TB is
      required for Downstream Ports with ACS, so we should never see the warning]
      Link: https://lore.kernel.org/r/20200707224604.3737893-4-rajatja@google.comSigned-off-by: NRajat Jain <rajatja@google.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      76fc8e85