mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Brett Creeley <brett.creeley@amd.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Lukas Wunner" <lukas@wunner.de>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Eric Joyner" <eric.joyner@amd.com>,
	"Nikhil P. Rao" <nikhil.rao@amd.com>,
	"Brett Creeley" <brett.creeley@amd.com>
Subject: [PATCH RFC 0/3] PCI: Allow a device more time for its link to return after a reset
Date: Wed, 2 Dec 2026 16:43:25 -0800	[thread overview]
Message-ID: <20261202-b4-pci-link-up-timeout-v1-0-04fba0824d63@amd.com> (raw)

When the SoC of an AMD Pensando Vulcano 800 AI NIC is reset, for example
when the card's management controller power-cycles it after a fatal
error, its link stays down for up to ~12 seconds.  The Root Port sees a
Surprise Down and DPC contains the port, but after releasing DPC,
pci_bridge_wait_for_secondary_bus() waits only 1 s for the link to come
back.  Recovery fails and the card is disconnected, even though it would
have returned.  In the power-cycle case the card is unpowered for most
of the outage, so its firmware cannot keep the link up.

PCIe r5.0 sec 6.6.1 requires that, within 1.0 s of a Conventional Reset,
a device can receive a Configuration Request and return a Successful
Completion, independent of how quickly link training completes.  A link
that is still down after ~12 s cannot meet that, so this is handled as a
device erratum.  The Readiness Time Reporting Extended Capability cannot
express it: its times are capped at about 1.006 s and only shorten the
spec-mandated waits.  This follows Lukas' suggestion that hardware which
doesn't meet the spec gets a quirk that raises the timeout for that
device, rather than a blanket increase [1].

Patch 1 adds PCI_VENDOR_ID_PENSANDO to pci_ids.h.

Patch 2 adds pci_dev->link_up_timeout, which a quirk can set.  When
waiting for the secondary bus after a reset, the core uses the largest
value of the devices on that bus.  The value lives in the child's struct
pci_dev, so it is still available while the device's config space is
unreachable during DPC.  Devices without the quirk keep the existing 1 s
timeout.  Ports at or below 5 GT/s, and ports without link active
reporting (which can only sleep, not poll), are unchanged.

This complements d3cold_delay rather than duplicating it: on this path
d3cold_delay is the wait after the link is up, before the device is
accessed, whereas link_up_timeout bounds how long the link may take to
come up in the first place.

Patch 3 sets 20 s for the Vulcano upstream port.

Questions for this RFC:

- Is a device quirk the right place for this, rather than having the
  device's driver set the value at probe?  A quirk covers the card even
  when no driver is bound to its functions, and it is set before any
  driver probes.
- Should the core cap link_up_timeout (e.g. at
  PCIE_RESET_READY_POLL_MS), or is the quirk's value trusted as is?
- Hotplug-capable slots are not handled yet.  Vulcano cards are deployed
  in slots that support hotplug, and there pciehp waits only 4 s in
  pci_dpc_recovered() for DPC recovery before treating the Link Down as
  a removal, so a ~12 s outage still ends in the card being torn down.
  That wait covers the DPC recovery which, with this series, already
  includes link_up_timeout, so one possible approach is to reuse the
  same field: have pci_dpc_recovered() extend its 4 s by the amount a
  quirked device below the port adds to the link-up wait, leaving other
  devices unchanged.  Bjorn has suggested instead that this wait match
  PCIE_RESET_READY_POLL_MS for everyone [2].  Which would you prefer?
  This part is not implemented or tested yet.
- Ports at or below 5 GT/s still use the fixed 1 s budget.  Is it worth
  extending that path too, or is it fine to leave it until a device
  needs it?

Testing: on systems with a Vulcano 800 AI NIC in slots without hotplug,
resetting the card's SoC keeps the link down for ~12 s.  Without this
series, DPC recovery fails and the card is disconnected; with it, the
link returns within the extended wait and DPC recovery succeeds.

[1] https://lore.kernel.org/linux-pci/awIScN3rXFv6v9x2@wunner.de/
[2] https://lore.kernel.org/linux-pci/20250806213409.GA19037@bhelgaas/

Signed-off-by: Brett Creeley <brett.creeley@amd.com>
---
Brett Creeley (3):
      PCI: Add PCI_VENDOR_ID_PENSANDO
      PCI: Allow quirks to extend the link-up wait after reset
      PCI: Extend link-up timeout for AMD Pensando Vulcano upstream port

 drivers/pci/pci.c       | 73 +++++++++++++++++++++++++++++++++++++++++--------
 drivers/pci/quirks.c    | 13 +++++++++
 include/linux/pci.h     |  1 +
 include/linux/pci_ids.h |  2 ++
 4 files changed, 78 insertions(+), 11 deletions(-)
---
base-commit: 85a0cf7926b9e6883cbc515b8b5f77090d3b1889
change-id: 20261202-b4-pci-link-up-timeout-07f7ebc95747

Best regards,
--  
Brett Creeley <brett.creeley@amd.com>


             reply	other threads:[~2026-12-03  0:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  0:43 Brett Creeley [this message]
2026-12-03  0:43 ` [PATCH RFC 1/3] PCI: Add PCI_VENDOR_ID_PENSANDO Brett Creeley
2026-12-03  8:36   ` Lukas Wunner
2026-12-03  0:43 ` [PATCH RFC 2/3] PCI: Allow quirks to extend the link-up wait after reset Brett Creeley
2026-12-03  8:34   ` Lukas Wunner
2026-12-03 17:07     ` Creeley, Brett
2026-12-03  0:43 ` [PATCH RFC 3/3] PCI: Extend link-up timeout for AMD Pensando Vulcano upstream port Brett Creeley
2026-12-03  8:37   ` Lukas Wunner
2026-12-03 16:47     ` Creeley, Brett
2026-12-03  8:45 ` [PATCH RFC 0/3] PCI: Allow a device more time for its link to return after a reset Lukas Wunner
2026-12-03 15:57   ` Eric Joyner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261202-b4-pci-link-up-timeout-v1-0-04fba0824d63@amd.com \
    --to=brett.creeley@amd.com \
    --cc=bhelgaas@google.com \
    --cc=eric.joyner@amd.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=nikhil.rao@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®