Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Brett Creeley <brett.creeley@amd.com>
Cc: "Bjorn Helgaas" <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Eric Joyner" <eric.joyner@amd.com>,
	"Nikhil P. Rao" <nikhil.rao@amd.com>
Subject: Re: [PATCH RFC 2/3] PCI: Allow quirks to extend the link-up wait after reset
Date: Thu, 3 Dec 2026 09:34:33 +0100	[thread overview]
Message-ID: <axEpmfJ5h5Sm5awr@wunner.de> (raw)
In-Reply-To: <20261202-b4-pci-link-up-timeout-v1-2-04fba0824d63@amd.com>

On Wed, Dec 02, 2026 at 04:43:27PM -0800, Brett Creeley wrote:
> +++ b/drivers/pci/pci.c
> @@ -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)
>  {

Can you make it so that pcie_wait_for_link_status() doesn't take
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.

> @@ -4833,7 +4875,9 @@ int pci_bridge_wait_for_secondary_bus(struct pci_dev *dev, char *reset_type)
>  
>  	/* 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;
>  	}

Why is this needed?  I'd expect the control flow to just fall through
to the !pcie_wait_for_link_delay() at the end of
pci_bridge_wait_for_secondary_bus()?

> +++ b/include/linux/pci.h
> @@ -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 */
>

I'd preer link_up_delay for consistency with the other fields
in the struct.  I'm not sure the >5 GT/s limitation needs to
be mentioned.

Thanks,

Lukas

  reply	other threads:[~2026-12-03  8:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  0:43 [PATCH RFC 0/3] PCI: Allow a device more time for its link to return after a reset Brett Creeley
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 [this message]
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  0:50 ` [PATCH RFC 0/3] PCI: Allow a device more time for its link to return after a reset sashiko-bot
2026-12-03  8:45 ` Lukas Wunner

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=axEpmfJ5h5Sm5awr@wunner.de \
    --to=lukas@wunner.de \
    --cc=bhelgaas@google.com \
    --cc=brett.creeley@amd.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=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