Re: [PATCH RFC 2/3] PCI: Allow quirks to extend the link-up wait after reset
From: Creeley, Brett
Date: Thu Dec 03 2026 - 12:07:22 EST
On 12/3/2026 12:34 AM, Lukas Wunner wrote:
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
On Wed, Dec 02, 2026 at 04:43:27PM -0800, Brett Creeley wrote:
+++ b/drivers/pci/pci.cCan you make it so that pcie_wait_for_link_status() doesn't take
@@ -4614,12 +4614,14 @@ static int pci_pm_reset(struct pci_dev *dev, bool probe)
* @pdev: Device whose link to wait for.
* @use_lt: Use the LT bit if TRUE, or the DLLLA bit if FALSE.
* @active: Waiting for active or inactive?
+ * @timeout_ms: How long to wait for the status change (in ms)
*
* Return 0 if successful, or -ETIMEDOUT if status has not changed within
- * PCIE_LINK_RETRAIN_TIMEOUT_MS milliseconds.
+ * @timeout_ms milliseconds.
*/
static int pcie_wait_for_link_status(struct pci_dev *pdev,
- bool use_lt, bool active)
+ bool use_lt, bool active,
+ unsigned int timeout_ms)
{
an extra parameter, but uses pdev->link_up_timeout in lieu of
PCIE_LINK_RETRAIN_TIMEOUT_MS if it is non-zero?
That would simplify the patch considerably. Patches that deal
with non-conforming hardware should be minimally intrusive.
Makes sense. I will fix in the next version.
@@ -4833,7 +4875,9 @@ int pci_bridge_wait_for_secondary_bus(struct pci_dev *dev, char *reset_type)Why is this needed? I'd expect the control flow to just fall through
/* Take d3cold_delay requirements into account */
delay = pci_bus_max_d3cold_delay(dev->subordinate);
- if (!delay) {
+ link_up_timeout = pci_bus_max_link_up_timeout(dev->subordinate);
+ extended = pcie_link_up_timeout_extended(dev, link_up_timeout);
+ if (!delay && !extended) {
up_read(&pci_bus_sem);
return 0;
}
to the !pcie_wait_for_link_delay() at the end of
pci_bridge_wait_for_secondary_bus()?
After taking another look here, this isn't needed, so it will be removed before another version is sent, which simplifies the series even more.
+++ b/include/linux/pci.hI'd preer link_up_delay for consistency with the other fields
@@ -434,6 +434,7 @@ struct pci_dev {
unsigned int no_bw_notif:1; /* BW notifications may cause issues */
unsigned int d3hot_delay; /* D3hot->D0 transition time in ms */
unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */
+ unsigned int link_up_timeout; /* Link-up wait (ms), >5 GT/s ports */
in the struct. I'm not sure the >5 GT/s limitation needs to
be mentioned.
Also makes sense. I will fix in the next version.
Thanks for the quick review!
Brett
Thanks,
Lukas