Linux-PCI Archive mirror
 help / color / mirror / Atom feed
From: Xilin Wu <sophon@radxa.com>
To: "Manivannan Sadhasivam" <mani@kernel.org>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>,
	 linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org,
	 linux-kernel@vger.kernel.org, Xilin Wu <sophon@radxa.com>
Subject: [PATCH] PCI: qcom: Restrict PERST# parsing to PCI bridge nodes
Date: Thu, 07 May 2026 22:18:31 +0800	[thread overview]
Message-ID: <20260507-fix-qcom-pcie-parse-perst-v1-1-79bdcce38eeb@radxa.com> (raw)

Commit 2fd60a2edb83 ("PCI: qcom: Parse PERST# from all PCIe bridge
nodes") extended PERST# parsing below the Root Port, so that downstream
PCIe switch bridge nodes can describe their own PERST# GPIOs.

However, the implementation recurses into every available child node.  A
PCI hierarchy may contain non-bridge child nodes with unrelated
"reset-gpios" properties, such as an Ethernet PHY below an MDIO bus.  If
such a reset GPIO is provided by a PCI endpoint GPIO controller, the
endpoint has not been enumerated while the host bridge is still probing.
Trying to acquire that GPIO then returns -EPROBE_DEFER and the Root Port
probe is deferred indefinitely.

Only recurse into child nodes that are PCI bridge/bus nodes.  Keep parsing
the Root Port passed by qcom_pcie_parse_port(), but filter descendants to
nodes with device_type = "pci" and either a bus-range property or an
explicit PCI bridge class compatible.

Fixes: 2fd60a2edb83 ("PCI: qcom: Parse PERST# from all PCIe bridge nodes")
Signed-off-by: Xilin Wu <sophon@radxa.com>
---
 drivers/pci/controller/dwc/pcie-qcom.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index af6bf5cce65b..5e0c31cc32a0 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1693,7 +1693,16 @@ static const struct pci_ecam_ops pci_qcom_ecam_ops = {
 	}
 };
 
-/* Parse PERST# from all nodes in depth first manner starting from @np */
+static bool qcom_pcie_is_bridge_node(struct device_node *np)
+{
+	if (!of_node_is_type(np, "pci"))
+		return false;
+
+	return of_property_present(np, "bus-range") ||
+	       of_device_is_compatible(np, "pciclass,0604");
+}
+
+/* Parse PERST# from all PCIe bridge nodes starting from @np */
 static int qcom_pcie_parse_perst(struct qcom_pcie *pcie,
 				 struct qcom_pcie_port *port,
 				 struct device_node *np)
@@ -1731,6 +1740,9 @@ static int qcom_pcie_parse_perst(struct qcom_pcie *pcie,
 
 parse_child_node:
 	for_each_available_child_of_node_scoped(np, child) {
+		if (!qcom_pcie_is_bridge_node(child))
+			continue;
+
 		ret = qcom_pcie_parse_perst(pcie, port, child);
 		if (ret)
 			return ret;

---
base-commit: 735d2f48cadaa9a87e7c7601667878de70c771c5
change-id: 20260507-fix-qcom-pcie-parse-perst-a882f580a658

Best regards,
--  
Xilin Wu <sophon@radxa.com>


             reply	other threads:[~2026-05-07 14:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07 14:18 Xilin Wu [this message]
2026-05-15 17:41 ` [PATCH] PCI: qcom: Restrict PERST# parsing to PCI bridge nodes Manivannan Sadhasivam

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=20260507-fix-qcom-pcie-parse-perst-v1-1-79bdcce38eeb@radxa.com \
    --to=sophon@radxa.com \
    --cc=bhelgaas@google.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=manivannan.sadhasivam@oss.qualcomm.com \
    --cc=robh@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).