From: Aviv Bakal <avivb@amazon.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>,
"Lukas Wunner" <lukas@wunner.de>,
Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@linux.intel.com>,
<linux-pci@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Zeev Zilberman <zeev@amazon.com>, <stable@vger.kernel.org>
Subject: [PATCH v2 1/3] PCI/PM: Honor PCI_DEV_FLAGS_NO_D3 in pci_bridge_d3_possible()
Date: Mon, 16 Nov 2026 18:51:08 +0200 [thread overview]
Message-ID: <20261116165110.2773301-2-avivb@amazon.com> (raw)
In-Reply-To: <20261116165110.2773301-1-avivb@amazon.com>
pci_set_power_state() does not put a device with PCI_DEV_FLAGS_NO_D3
into D3, but pci_bridge_d3_possible() ignores the flag.
pcie_portdrv_probe() therefore enables runtime PM on such a port, and
on runtime suspend pciehp masks the hotplug interrupt while the port
stays in D0.
Return false from pci_bridge_d3_possible() when the flag is set.
pci_bridge_d3_possible() must return the same value for the lifetime
of the device, and FINAL fixups may set the flag after portdrv has
probed, so record the flag in pci_pm_init() and check that copy.
Fixes: d4c79b63d82d ("PCI: Allow D3 for native hotplug-capable Root Ports on non-x86 platforms")
Cc: stable@vger.kernel.org # 7.3.x
Co-developed-by: Zeev Zilberman <zeev@amazon.com>
Signed-off-by: Zeev Zilberman <zeev@amazon.com>
Signed-off-by: Aviv Bakal <avivb@amazon.com>
---
drivers/pci/pci.c | 10 ++++++++++
include/linux/pci.h | 1 +
2 files changed, 11 insertions(+)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 7c6f2aba8144..eb7f2f03d9ae 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -3055,6 +3055,10 @@ bool pci_bridge_d3_possible(struct pci_dev *bridge)
if (pci_bridge_d3_disable)
return false;
+ /* The port is known not to work correctly in D3 */
+ if (bridge->no_d3)
+ return false;
+
/*
* Hotplug ports handled by platform firmware may not be put
* into D3 by the OS, e.g. ACPI slots ...
@@ -3227,6 +3231,12 @@ void pci_pm_init(struct pci_dev *dev)
dev->pm_cap = 0;
dev->pme_support = 0;
+ /*
+ * pci_bridge_d3_possible() must not change after this point, so
+ * ignore NO_D3 set by later fixups.
+ */
+ dev->no_d3 = !!(dev->dev_flags & PCI_DEV_FLAGS_NO_D3);
+
/* find PCI PM capability in list */
pm = pci_find_capability(dev, PCI_CAP_ID_PM);
if (!pm)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index aa3765a20a96..1238667d643c 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -420,6 +420,7 @@ struct pci_dev {
unsigned int no_d1d2:1; /* D1 and D2 are forbidden */
unsigned int no_d3cold:1; /* D3cold is forbidden */
unsigned int bridge_d3:1; /* Allow D3 for bridge */
+ unsigned int no_d3:1; /* NO_D3 set before PM init */
unsigned int d3cold_allowed:1; /* D3cold is allowed by user */
unsigned int mmio_always_on:1; /* Disallow turning off io/mem
decoding during BAR sizing */
--
2.50.1
next prev parent reply other threads:[~2026-11-16 16:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 16:51 [PATCH v2 0/3] PCI/PM: Keep hotplug ports that can't wake from D3hot out of D3 Aviv Bakal
2026-11-16 16:51 ` Aviv Bakal [this message]
2026-11-16 17:11 ` [PATCH v2 1/3] PCI/PM: Honor PCI_DEV_FLAGS_NO_D3 in pci_bridge_d3_possible() sashiko-bot
2026-11-16 17:47 ` Kuppuswamy Sathyanarayanan
2026-11-16 16:51 ` [PATCH v2 2/3] PCI: Avoid runtime D3 on Amazon PCIe switch ports Aviv Bakal
2026-11-16 16:58 ` sashiko-bot
2026-11-16 16:51 ` [PATCH v2 3/3] PCI/PM: Keep hotplug ports out of D3 if they can't signal PME from D3hot Aviv Bakal
2026-11-16 17:04 ` sashiko-bot
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=20261116165110.2773301-2-avivb@amazon.com \
--to=avivb@amazon.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=manivannan.sadhasivam@oss.qualcomm.com \
--cc=sathyanarayanan.kuppuswamy@linux.intel.com \
--cc=stable@vger.kernel.org \
--cc=zeev@amazon.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.