All of lore.kernel.org
 help / color / mirror / Atom feed
From: Angel J <iamanaws@httpd.dev>
To: linux-pci@vger.kernel.org, bhelgaas@google.com
Cc: robh@kernel.org, herve.codina@bootlin.com, lizhi.hou@amd.com,
	andrea.porta@suse.com, florian.fainelli@broadcom.com,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	regressions@lists.linux.dev, stable@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org,
	Angel J <iamanaws@httpd.dev>
Subject: [PATCH v2] PCI: of_property: Omit bus properties without a subordinate bus
Date: Fri, 11 Sep 2026 21:31:06 -0700	[thread overview]
Message-ID: <20260912043106.10715-1-iamanaws@httpd.dev> (raw)
In-Reply-To: <20260911230420.26244-1-iamanaws@httpd.dev>

A device can satisfy pci_is_bridge() without having a subordinate bus.
The dynamic OF helpers for bus-range and interrupt-map dereference
pdev->subordinate without checking it.

On a Dell XPS 8940, device 0000:00:00.0 [8086:4c43] has no subordinate
bus, and enabling CONFIG_PCI_DYNAMIC_OF_NODES causes an early boot hang.

Generate bus-range and interrupt-map only when a subordinate bus exists.
Keep the node and its remaining properties for bridges without one.

Boot-tested on Linux 6.18.44 with CONFIG_PCI_DYNAMIC_OF_NODES=y. The
system boots and the node for 00:00.0 retains device_type, reg and
compatible. The other bridges retain their nodes and bus ranges.

Fixes: 407d1a51921e ("PCI: Create device tree node for bridge")
Cc: stable@vger.kernel.org
Signed-off-by: Angel J <iamanaws@httpd.dev>
---
Changes in v2:
- Keep the dynamic OF node and skip only bus-range and interrupt-map
  when no subordinate bus exists, following review of v1.
- Tested on Linux 6.18.44 with the v1 guard removed.

 drivers/pci/of_property.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c
index 75a358f73..acd2e0f70 100644
--- a/drivers/pci/of_property.c
+++ b/drivers/pci/of_property.c
@@ -361,13 +361,15 @@ int of_pci_add_properties(struct pci_dev *pdev, struct of_changeset *ocs,
 		if (ret)
 			return ret;
 
-		ret = of_pci_prop_bus_range(pdev, ocs, np);
-		if (ret)
-			return ret;
+		if (pdev->subordinate) {
+			ret = of_pci_prop_bus_range(pdev, ocs, np);
+			if (ret)
+				return ret;
 
-		ret = of_pci_prop_intr_map(pdev, ocs, np);
-		if (ret)
-			return ret;
+			ret = of_pci_prop_intr_map(pdev, ocs, np);
+			if (ret)
+				return ret;
+		}
 	} else {
 		ret = of_pci_prop_intr_ctrl(pdev, ocs, np);
 		if (ret)
-- 
2.54.0


  parent reply	other threads:[~2026-09-12  4:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-23  2:14 [REGRESSION] PCI: Dynamic OF node creation hangs on invalid bridge configuration Angel J
2026-09-01  0:59 ` Angel J
2026-09-01  6:07   ` Thorsten Leemhuis
2026-09-03 23:17 ` Bjorn Helgaas
2026-09-04  8:57   ` Herve Codina
2026-09-09 11:27     ` Andrea della Porta
2026-09-11 23:01 ` Angel J
2026-09-11 23:04   ` [PATCH] PCI: of: Skip dynamic nodes for bridges without a subordinate bus Angel J
2026-09-11 23:13     ` sashiko-bot
2026-09-12  4:31     ` Angel J [this message]
2026-09-12  4:42       ` [PATCH v2] PCI: of_property: Omit bus properties " 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=20260912043106.10715-1-iamanaws@httpd.dev \
    --to=iamanaws@httpd.dev \
    --cc=andrea.porta@suse.com \
    --cc=bhelgaas@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=florian.fainelli@broadcom.com \
    --cc=herve.codina@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=lizhi.hou@amd.com \
    --cc=regressions@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=stable@vger.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 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.