android_kernel_motorola_sm6375/drivers/pci
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Lukas Wunner 144019e813 PCI: Unify delay handling for reset and resume
commit ac91e6980563ed53afadd925fa6585ffd2bc4a2c upstream.

Sheng Bi reports that pci_bridge_secondary_bus_reset() may fail to wait
for devices on the secondary bus to become accessible after reset:

Although it does call pci_dev_wait(), it erroneously passes the bridge's
pci_dev rather than that of a child.  The bridge of course is always
accessible while its secondary bus is reset, so pci_dev_wait() returns
immediately.

Sheng Bi proposes introducing a new pci_bridge_secondary_bus_wait()
function which is called from pci_bridge_secondary_bus_reset():

https://lore.kernel.org/linux-pci/20220523171517.32407-1-windy.bi.enflame@gmail.com/

However we already have pci_bridge_wait_for_secondary_bus() which does
almost exactly what we need.  So far it's only called on resume from
D3cold (which implies a Fundamental Reset per PCIe r6.0 sec 5.8).
Re-using it for Secondary Bus Resets is a leaner and more rational
approach than introducing a new function.

That only requires a few minor tweaks:

- Amend pci_bridge_wait_for_secondary_bus() to await accessibility of
  the first device on the secondary bus by calling pci_dev_wait() after
  performing the prescribed delays.  pci_dev_wait() needs two parameters,
  a reset reason and a timeout, which callers must now pass to
  pci_bridge_wait_for_secondary_bus().  The timeout is 1 sec for resume
  (PCIe r6.0 sec 6.6.1) and 60 sec for reset (commit 821cdad5c4 ("PCI:
  Wait up to 60 seconds for device to become ready after FLR")).
  Introduce a PCI_RESET_WAIT macro for the 1 sec timeout.

- Amend pci_bridge_wait_for_secondary_bus() to return 0 on success or
  -ENOTTY on error for consumption by pci_bridge_secondary_bus_reset().

- Drop an unnecessary 1 sec delay from pci_reset_secondary_bus() which
  is now performed by pci_bridge_wait_for_secondary_bus().  A static
  delay this long is only necessary for Conventional PCI, so modern
  PCIe systems benefit from shorter reset times as a side effect.

Fixes: 6b2f1351af ("PCI: Wait for device to become ready after secondary bus reset")
Link: https://lore.kernel.org/r/da77c92796b99ec568bd070cbe4725074a117038.1673769517.git.lukas@wunner.de
Reported-by: Sheng Bi <windy.bi.enflame@gmail.com>
Tested-by: Ravi Kishore Koppuravuri <ravi.kishore.koppuravuri@intel.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Cc: stable@vger.kernel.org # v4.17+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-22 13:28:09 +01:00
..
controller PCI: tegra194: Fix link up retry sequence 2022-08-25 11:17:58 +02:00
endpoint
hotplug PCI: pciehp: Add Qualcomm quirk for Command Completed erratum 2022-04-15 14:18:33 +02:00
pcie PCI/portdrv: Enable Bandwidth Notification only if port supports it 2021-09-22 12:26:22 +02:00
switch
access.c PCI: Reduce warnings on possible RW1C corruption 2022-04-15 14:18:15 +02:00
ats.c
bus.c
ecam.c PCI/ACPI: Add Ampere Altra SOC MCFG quirk 2021-09-26 14:07:05 +02:00
host-bridge.c
iov.c
irq.c PCI: Check for alloc failure in pci_request_irq() 2023-01-18 11:41:18 +01:00
Kconfig
Makefile
mmap.c
msi.c PCI/MSI: Fix pci_irq_vector()/pci_irq_get_affinity() 2022-01-27 09:19:38 +01:00
of.c
p2pdma.c
pci-acpi.c
pci-bridge-emul.c PCI: pci-bridge-emul: Set PCI_STATUS_CAP_LIST for PCIe device 2022-01-27 09:19:50 +01:00
pci-bridge-emul.h PCI: pci-bridge-emul: Add PCIe Root Capabilities Register 2021-09-26 14:07:04 +02:00
pci-driver.c PCI: Unify delay handling for reset and resume 2023-03-22 13:28:09 +01:00
pci-label.c
pci-mid.c
pci-pf-stub.c
pci-stub.c
pci-sysfs.c PCI/sysfs: Fix double free in error path 2023-01-18 11:41:49 +01:00
pci.c PCI: Unify delay handling for reset and resume 2023-03-22 13:28:09 +01:00
pci.h PCI: Unify delay handling for reset and resume 2023-03-22 13:28:09 +01:00
probe.c PCI: Fix pci_host_bridge struct device release/free handling 2021-10-06 15:42:38 +02:00
proc.c
quirks.c PCI: Add ACS quirk for Wangxun NICs 2023-03-11 16:44:15 +01:00
remove.c PCI: Fix pci_host_bridge struct device release/free handling 2021-10-06 15:42:38 +02:00
rom.c
search.c
setup-bus.c
setup-irq.c
setup-res.c PCI: Sanitise firmware BAR assignments behind a PCI-PCI bridge 2022-10-26 13:22:16 +02:00
slot.c
syscall.c PCI: Return ~0 data on pciconfig_read() CAP_SYS_ADMIN failure 2021-09-22 12:26:22 +02:00
vc.c
vpd.c
xen-pcifront.c