From: Mario Limonciello <superm1@kernel.org>
To: Bjorn Helgaas <helgaas@kernel.org>, linux-pci@vger.kernel.org
Cc: "Rafael J . Wysocki" <rafael@kernel.org>,
Lukas Wunner <lukas@wunner.de>,
Marco Nenciarini <mnencia@kcore.it>,
Michal Winiarski <michal.winiarski@intel.com>,
Ilpo Jarvinen <ilpo.jarvinen@linux.intel.com>,
Eric Chanudet <echanude@redhat.com>,
Jean Guyader <jean.guyader@gmail.com>,
Alex Williamson <alex@shazbot.org>, Sinan Kaya <okaya@kernel.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
linux-kernel@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>,
Gary Li <Gary.Li@amd.com>
Subject: Re: [PATCH v1] PCI: Wait for device readiness after D3hot -> D0uninitialized transition
Date: Thu, 14 May 2026 13:52:08 -0500 [thread overview]
Message-ID: <e0129a50-11d9-4212-99ca-4e7f4e862030@kernel.org> (raw)
In-Reply-To: <20260514153124.404060-1-bhelgaas@google.com>
On 5/14/26 10:31, Bjorn Helgaas wrote:
> For a device that advertises No_Soft_Reset == 0, a transition from D3hot to
> D0uninitialized is a soft reset, and the resulting internal device state is
> undefined.
>
> A transition from D3hot to D0uninitialized requires a minimum delay of
> 10 msec before accessing the device, but after that delay, the device is
> permitted to respond to config requests with RRS completion status if it
> needs more time to initialize (PCIe r7.0, sec 2.3.1).
>
> Call pci_dev_wait() after pci_power_up() performs a D3hot->D0uninitialized
> transition to ensure the device is ready to accept config accesses, as is
> done after the similar transition in pci_pm_reset().
>
> If the device is already ready, this is essentially a no-op except for one
> additional config read.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
BTW -
This reminds me of an attempt I had at solving a similar issue a few
years back. It would be a nice side effect if this actually solves that
issue too.
https://lore.kernel.org/linux-pci/20240823154023.360234-3-superm1@kernel.org/
> ---
> drivers/pci/pci.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 8f7cfcc00090..9d0fc9fbb76a 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -1301,6 +1301,16 @@ int pci_power_up(struct pci_dev *dev)
> pci_power_t state;
> u16 pmcsr;
>
> + /*
> + * When setting power state to D0, platform_pci_set_power_state()
> + * ensures main power is on. If it puts the device in D0, it also
> + * completes any required delays after the transition; if it leaves
> + * the device in D1, D2, or D3hot, we use the PM Capability to
> + * transition to D0.
> + *
> + * In all cases, the device is either Configuration-Ready or
> + * inaccessible upon return.
> + */
> platform_pci_set_power_state(dev, PCI_D0);
>
> if (!dev->pm_cap) {
> @@ -1341,10 +1351,14 @@ int pci_power_up(struct pci_dev *dev)
> pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, 0);
>
> /* Mandatory transition delays; see PCI PM 1.2. */
> - if (state == PCI_D3hot)
> + if (state == PCI_D3hot) {
> pci_dev_d3_sleep(dev);
> - else if (state == PCI_D2)
> + if (!(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET))
> + pci_dev_wait(dev, "power up D3hot->D0uninitialized",
> + PCIE_RESET_READY_POLL_MS);
> + } else if (state == PCI_D2) {
> udelay(PCI_PM_D2_DELAY);
> + }
>
> end:
> dev->current_state = PCI_D0;
next prev parent reply other threads:[~2026-05-14 18:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-14 15:31 [PATCH v1] PCI: Wait for device readiness after D3hot -> D0uninitialized transition Bjorn Helgaas
2026-05-14 18:52 ` Mario Limonciello [this message]
2026-05-14 20:06 ` sashiko-bot
2026-05-14 21:38 ` Bjorn Helgaas
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=e0129a50-11d9-4212-99ca-4e7f4e862030@kernel.org \
--to=superm1@kernel.org \
--cc=Gary.Li@amd.com \
--cc=alex@shazbot.org \
--cc=bhelgaas@google.com \
--cc=echanude@redhat.com \
--cc=helgaas@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jean.guyader@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=michal.winiarski@intel.com \
--cc=mika.westerberg@linux.intel.com \
--cc=mnencia@kcore.it \
--cc=okaya@kernel.org \
--cc=rafael@kernel.org \
/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