[SRU][O][PATCH 0/1] PCI: Wait for device readiness with Configuration RRS
Tim Whisonant
tim.whisonant at canonical.com
Fri Apr 4 17:14:14 UTC 2025
BugLink: https://bugs.launchpad.net/bugs/2106251
SRU Justification:
[Impact]
PCI: Wait for device readiness with Configuration RRS
After a device reset, delays are required before the device can
successfully complete config accesses. PCIe r6.0, sec 6.6, specifies some
delays required before software can perform config accesses. Devices that
require more time after those delays may respond to config accesses with
Configuration Request Retry Status (RRS) completions.
Callers of pci_dev_wait() are responsible for delays until the device can
respond to config accesses. pci_dev_wait() waits any additional time until
the device can successfully complete config accesses.
Reading config space of devices that are not present or not ready typically
returns ~0 (PCI_ERROR_RESPONSE). Previously we polled the Command register
until we got a value other than ~0. This is sometimes a problem because
Root Complex handling of RRS completions may include several retries and
implementation-specific behavior that is invisible to software (see sec
2.3.2), so the exponential backoff in pci_dev_wait() may not work as
intended.
Linux enables Configuration RRS Software Visibility on all Root Ports that
support it. If it is enabled, read the Vendor ID instead of the Command
register. RRS completions cause immediate return of the 0x0001 reserved
Vendor ID value, so the pci_dev_wait() backoff works correctly.
When a read of Vendor ID eventually completes successfully by returning a
non-0x0001 value (the Vendor ID or 0xffff for VFs), the device should be
initialized and ready to respond to config requests.
For conventional PCI devices or devices below Root Ports that don't support
Configuration RRS Software Visibility, poll the Command register as before.
This was developed independently, but is very similar to Stanislav
Spassov's previous work at
https://lore.kernel.org/linux-pci/20200223122057.6504-1-stanspas@amazon.com
[Fix]
Oracular: cherry picked from upstream
Noble: backported from upstream
Jammy: not required
Focal: not required
Bionic: not required
Xenial: not required
Trusty: not required
[Test Plan]
Compile and boot tested.
[Where problems could occur]
The PCI core is affected in the device wait logic. Latency between
device reset and configuration accesses may be altered.
Bjorn Helgaas (1):
PCI: Wait for device readiness with Configuration RRS
drivers/pci/pci.c | 41 ++++++++++++++++++++++++++++-------------
drivers/pci/pci.h | 5 +++++
drivers/pci/probe.c | 9 +++------
include/linux/pci.h | 1 +
4 files changed, 37 insertions(+), 19 deletions(-)
--
2.43.0
More information about the kernel-team
mailing list