From: Xilin Wu <sophon@radxa.com>
To: Bjorn Helgaas <bhelgaas@google.com>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Luca Ceresoli <luca.ceresoli@bootlin.com>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>,
Linus Walleij <linusw@kernel.org>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org,
Stephen Chen <stephen@radxa.com>, Junhao Xie <bigfoot@radxa.com>,
Xilin Wu <sophon@radxa.com>
Subject: [PATCH 1/6] PCI: of: Avoid config reads for disabled bridge nodes
Date: Tue, 01 Sep 2026 16:47:54 +0800 [thread overview]
Message-ID: <20260901-q8b-dts-v1-1-7de0b6a73d08@radxa.com> (raw)
In-Reply-To: <20260901-q8b-dts-v1-0-7de0b6a73d08@radxa.com>
The TC9563 PCI power-control driver powers off external downstream ports
whose device tree nodes have status = "disabled".
On the Radxa Dragon Q8B, reading the Vendor ID from one of these
powered-off port functions during PCI enumeration raises an Arm SError
instead of returning an all-ones PCI error response. This prevents the
board from completing boot.
Commit 1a8c251cff20 ("PCI: move OF status = "disabled" detection to
dev->match_driver") made disabled PCI functions remain discoverable so
PCI fixups can still be applied, while suppressing driver binding later.
Preserve that behavior for endpoint functions.
For an unavailable node describing a PCI-to-PCI bridge, however, the
node also represents a subordinate bus that must not be enumerated.
Check the device tree node before reading the Vendor ID and return a PCI
error response without accessing config space when such a bridge is
disabled.
Functions not described by device tree and disabled endpoint functions
remain discoverable.
Signed-off-by: Xilin Wu <sophon@radxa.com>
---
drivers/pci/of.c | 27 +++++++++++++++++++++++++--
drivers/pci/pci.h | 5 +++++
drivers/pci/probe.c | 5 +++++
3 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/of.c b/drivers/pci/of.c
index a51dff91b196..37e9062065d7 100644
--- a/drivers/pci/of.c
+++ b/drivers/pci/of.c
@@ -24,8 +24,8 @@
* pci_set_of_node - Find and set device's DT device_node
* @dev: the PCI device structure to fill
*
- * Returns 0 on success with of_node set or when no device is described in the
- * DT. Returns -ENODEV if the device is present, but disabled in the DT.
+ * Return: 0 on success with of_node set or when no device is described in the
+ * DT.
*/
int pci_set_of_node(struct pci_dev *dev)
{
@@ -46,6 +46,29 @@ int pci_set_of_node(struct pci_dev *dev)
return 0;
}
+/**
+ * pci_of_device_skip_config_read - check whether to skip probing a PCI device
+ * @bus: PCI bus to scan
+ * @devfn: device/function number to check
+ *
+ * Return: true only when firmware explicitly describes an unavailable PCI
+ * bridge/port node. Disabled endpoints remain discoverable so fixups still run,
+ * while driver binding is suppressed later in pci_bus_add_device().
+ */
+bool pci_of_device_skip_config_read(struct pci_bus *bus, unsigned int devfn)
+{
+ if (!bus->dev.of_node)
+ return false;
+
+ struct device_node *node __free(device_node) =
+ of_pci_find_child_device(bus->dev.of_node, devfn);
+
+ if (!node || of_device_is_available(node))
+ return false;
+
+ return of_node_is_type(node, "pci");
+}
+
void pci_release_of_node(struct pci_dev *dev)
{
of_node_put(dev->dev.of_node);
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index ba3c3fddddc2..7cb1d04d947d 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -1244,6 +1244,7 @@ u32 of_pci_get_slot_power_limit(struct device_node *node,
u8 *slot_power_limit_scale);
bool of_pci_preserve_config(struct device_node *node);
int pci_set_of_node(struct pci_dev *dev);
+bool pci_of_device_skip_config_read(struct pci_bus *bus, unsigned int devfn);
void pci_release_of_node(struct pci_dev *dev);
void pci_set_bus_of_node(struct pci_bus *bus);
void pci_release_bus_of_node(struct pci_bus *bus);
@@ -1284,6 +1285,10 @@ static inline bool of_pci_preserve_config(struct device_node *node)
}
static inline int pci_set_of_node(struct pci_dev *dev) { return 0; }
+static inline bool pci_of_device_skip_config_read(struct pci_bus *bus, unsigned int devfn)
+{
+ return false;
+}
static inline void pci_release_of_node(struct pci_dev *dev) { }
static inline void pci_set_bus_of_node(struct pci_bus *bus) { }
static inline void pci_release_bus_of_node(struct pci_bus *bus) { }
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 27008e2ea5af..ce29bf78a6f7 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2586,6 +2586,11 @@ bool pci_bus_generic_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,
bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,
int timeout)
{
+ if (pci_of_device_skip_config_read(bus, devfn)) {
+ PCI_SET_ERROR_RESPONSE(l);
+ return false;
+ }
+
return pci_bus_generic_read_dev_vendor_id(bus, devfn, l, timeout);
}
EXPORT_SYMBOL(pci_bus_read_dev_vendor_id);
--
2.55.0
next prev parent reply other threads:[~2026-09-01 8:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 8:47 [PATCH 0/6] arm64: dts: qcom: Add support for Radxa Dragon Q8B Xilin Wu
2026-09-01 8:47 ` Xilin Wu [this message]
2026-09-02 8:43 ` [PATCH 1/6] PCI: of: Avoid config reads for disabled bridge nodes Konrad Dybcio
2026-09-02 9:31 ` Xilin Wu
2026-09-03 14:40 ` Konrad Dybcio
2026-09-03 14:41 ` Xilin Wu
2026-09-01 8:47 ` [PATCH 2/6] dt-bindings: display: bridge: simple: document Chrontel CH7218A Xilin Wu
2026-09-03 12:29 ` Krzysztof Kozlowski
2026-09-01 8:47 ` [PATCH 3/6] drm/bridge: simple: add " Xilin Wu
2026-09-01 8:47 ` [PATCH 4/6] dt-bindings: arm: qcom: document Radxa Dragon Q8B Xilin Wu
2026-09-03 12:36 ` Krzysztof Kozlowski
2026-09-01 8:47 ` [PATCH 5/6] dt-bindings: pinctrl: qcom,sc8280xp-tlmm: allow gpio-line-names Xilin Wu
2026-09-01 14:17 ` Konrad Dybcio
2026-09-03 12:35 ` Krzysztof Kozlowski
2026-09-01 8:47 ` [PATCH 6/6] arm64: dts: qcom: sc8280xp: add Radxa Dragon Q8B Xilin Wu
2026-09-03 11:00 ` [PATCH 0/6] arm64: dts: qcom: Add support for " Daniele Briguglio
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=20260901-q8b-dts-v1-1-7de0b6a73d08@radxa.com \
--to=sophon@radxa.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andersson@kernel.org \
--cc=andrzej.hajda@intel.com \
--cc=bhelgaas@google.com \
--cc=bigfoot@radxa.com \
--cc=brgl@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=robh@kernel.org \
--cc=simona@ffwll.ch \
--cc=stephen@radxa.com \
--cc=tzimmermann@suse.de \
/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