All of lore.kernel.org
 help / color / mirror / Atom feed
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>
Subject: [PATCH v2 3/3] PCI/PM: Keep hotplug ports out of D3 if they can't signal PME from D3hot
Date: Mon, 16 Nov 2026 18:51:10 +0200	[thread overview]
Message-ID: <20261116165110.2773301-4-avivb@amazon.com> (raw)
In-Reply-To: <20261116165110.2773301-1-avivb@amazon.com>

On runtime suspend pciehp masks the hotplug interrupt and relies on
PME to resume the port on a slot event. pci_bridge_d3_possible() does
not check whether the port can signal PME from D3hot, so a port that
cannot is not resumed by slot events.

Return false from pci_bridge_d3_possible() for such native hotplug
ports. pci_pm_init() computes bridge_d3 before it reads PME_Support,
so move that assignment after dev->pme_support is set.

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 | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index eb7f2f03d9ae..fa37dd3067cf 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -3081,6 +3081,14 @@ bool pci_bridge_d3_possible(struct pci_dev *bridge)
 		if (platform_pci_bridge_d3(bridge))
 			return true;
 
+		/*
+		 * pciehp masks the hotplug interrupt on runtime suspend and
+		 * relies on PME to resume the port on a slot event. A port
+		 * that cannot signal PME from D3hot is not resumed.
+		 */
+		if (bridge->is_pciehp && !pci_pme_capable(bridge, PCI_D3hot))
+			return false;
+
 		/*
 		 * Hotplug ports handled natively by the OS on x86 platforms
 		 * were not validated by vendors for runtime D3 at least until
@@ -3253,7 +3261,6 @@ void pci_pm_init(struct pci_dev *dev)
 	dev->pm_cap = pm;
 	dev->d3hot_delay = PCI_PM_D3HOT_WAIT;
 	dev->d3cold_delay = PCI_PM_D3COLD_WAIT;
-	dev->bridge_d3 = pci_bridge_d3_possible(dev);
 	dev->d3cold_allowed = true;
 
 	dev->d1_support = false;
@@ -3289,6 +3296,9 @@ void pci_pm_init(struct pci_dev *dev)
 		pci_pme_active(dev, false);
 	}
 
+	/* pci_bridge_d3_possible() looks at pme_support */
+	dev->bridge_d3 = pci_bridge_d3_possible(dev);
+
 poweron:
 	pci_update_current_state(dev, PCI_UNKNOWN);
 	if (dev->current_state == PCI_D0) {
-- 
2.50.1


  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 ` [PATCH v2 1/3] PCI/PM: Honor PCI_DEV_FLAGS_NO_D3 in pci_bridge_d3_possible() Aviv Bakal
2026-11-16 17:11   ` 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 ` Aviv Bakal [this message]
2026-11-16 17:04   ` [PATCH v2 3/3] PCI/PM: Keep hotplug ports out of D3 if they can't signal PME from D3hot 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-4-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=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.