From: Mario Limonciello <superm1@kernel.org>
To: Bjorn Helgaas <bhelgaas@google.com>,
"open list:PCI SUBSYSTEM" <linux-pci@vger.kernel.org>
Cc: linux-pm@vger.kernel.org,
"Rafael J . Wysocki" <rjw@rjwysocki.net>,
"Lukas Wunner" <lukas@wunner.de>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Rafael J . Wysocki" <rafael@kernel.org>
Subject: Re: [PATCH v6] PCI/PM: Skip resuming to D0 if disconnected
Date: Fri, 5 Sep 2025 13:38:33 -0500 [thread overview]
Message-ID: <ccad60cf-7aad-4cb7-9ac2-545e7ff4afe1@kernel.org> (raw)
In-Reply-To: <20250811163510.601103-1-superm1@kernel.org>
On 8/11/2025 11:35 AM, Mario Limonciello (AMD) wrote:
> When a USB4 dock is unplugged the PCIe bridge it's connected to will
> issue a "Link Down" and "Card not detected event". The PCI core will
> treat this as a surprise hotplug event and unconfigure all downstream
> devices. This involves setting the device error state to
> `pci_channel_io_perm_failure` which pci_dev_is_disconnected() will check.
>
> It doesn't make sense to runtime resume disconnected devices to D0 and
> report the (expected) error, so bail early.
>
> Suggested-by: Lukas Wunner <lukas@wunner.de>
> Reviewed-by: Lukas Wunner <lukas@wunner.de>
> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Bjorn,
Can you take a look at this one?
> ---
> v6:
> * rebase on v6.17-rc1
> v5:
> * Pick up tags, rebase on linux-next
> * https://lore.kernel.org/linux-pci/20250709205948.3888045-1-superm1@kernel.org/T/#mbd784f786c50a3d1b5ab1833520995c01eae2fd2
> ---
> drivers/pci/pci.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index b0f4d98036cdd..036511f5b2625 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -1374,6 +1374,11 @@ int pci_power_up(struct pci_dev *dev)
> return -EIO;
> }
>
> + if (pci_dev_is_disconnected(dev)) {
> + dev->current_state = PCI_D3cold;
> + return -EIO;
> + }
> +
> pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
> if (PCI_POSSIBLE_ERROR(pmcsr)) {
> pci_err(dev, "Unable to change power state from %s to D0, device inaccessible\n",
>
> base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
next prev parent reply other threads:[~2025-09-05 18:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 16:35 [PATCH v6] PCI/PM: Skip resuming to D0 if disconnected Mario Limonciello (AMD)
2025-09-05 18:38 ` Mario Limonciello [this message]
2025-09-08 21:03 ` Bjorn Helgaas
2025-09-08 21:29 ` Mario Limonciello (kernel.org)
2025-09-08 21:48 ` Bjorn Helgaas
2025-09-08 21:53 ` Mario Limonciello (kernel.org)
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=ccad60cf-7aad-4cb7-9ac2-545e7ff4afe1@kernel.org \
--to=superm1@kernel.org \
--cc=bhelgaas@google.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=rafael@kernel.org \
--cc=rjw@rjwysocki.net \
/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