PCI: Dynamic OF node creation hangs on invalid bridge configuration
Subsystems (3)
Hello,
This regression was introduced in v6.17-rc1 and remains in the dynamic PCI OF node code. Linux 6.18 fails very early during boot on my Dell XPS 8940 when CONFIG_PCI_DYNAMIC_OF_NODES=y. The display goes black before any useful console or pstore output appears, and the machine remains hung.
Disabling CONFIG_PCI_DYNAMIC_OF_NODES makes the same kernel boot normally. Linux v6.19-rc5 also boots because the RP1 driver stopped selecting that option, not because the dynamic PCI OF node code changed.
Hardware:
System: Dell XPS 8940, board 0K3CM7, BIOS 2.27.1 (2025-04-03)
CPU: Intel Core i7-11700 (Rocket Lake)
Triggering device: 0000:00:00.0, Intel 8086:4c43 Firmware boot: UEFI, ACPI-based x86_64
Test results:
Linux 6.12.103: good
Linux v6.17-rc1: bad
Linux 6.18.44, CONFIG_PCI_DYNAMIC_OF_NODES=y: bad
Linux 6.18.44, CONFIG_PCI_DYNAMIC_OF_NODES=n: good
Linux 6.18.44, CONFIG_PCI_DYNAMIC_OF_NODES=y, skip invalid bridge: good Linux v6.19-rc4: bad
Linux v6.19-rc5: good
Linux 4621c338d33f: bad
Linux e55feea3a03a: good
The first-parent boundary between the last two tests is:
e55feea3a03a ("Merge tag 'soc-fixes-6.19' ...")
That merge contains ce26f588c831 ("misc: rp1: drop overlay support"), which removes:
select PCI_DYNAMIC_OF_NODES
from MISC_RP1. The generated configurations differed only by:
-CONFIG_PCI_DYNAMIC_OF_NODES=y
+# CONFIG_PCI_DYNAMIC_OF_NODES is not set
CONFIG_MISC_RP1=m in both. The known-bad 4621c338d33f and Linux 6.18.44 both boot after disabling PCI_DYNAMIC_OF_NODES (and MISC_RP1, whose Kconfig select otherwise forces it on).
There is no RP1 device in this machine, and its driver does not probe. MISC_RP1 affects this x86 system only because its Kconfig select enables PCI_DYNAMIC_OF_NODES globally.
I narrowed the hang to dynamic OF node creation for 0000:00:00.0 (8086:4c43), the Intel Rocket Lake-S integrated memory controller. On this machine it reports PCI class 0604 and header type 1, but it is bound to icl_uncore and is not a usable forwarding bridge:
Bus: primary=ff, secondary=ff, subordinate=ff
I/O and memory bridge windows: invalid/all ones
kernel: bridge configuration invalid ([bus ff-ff]), reconfiguring
A minimal dynamic node for this device boots. Adding only device_type="pci" makes it hang. Full PCI dynamic OF node generation also boots when only 0000:00:00.0 is skipped.
I also tested a generic guard in of_pci_make_dev_node(). It reads PCI_PRIMARY_BUS and skips node creation if the primary bus does not match pdev->bus->number, the secondary bus is not greater than the primary bus, or the secondary bus is greater than the subordinate bus. Linux 6.18.44 boots with CONFIG_PCI_DYNAMIC_OF_NODES=y and logs:
pci 0000:00:00.0: skipping dynamic OF node for invalid bridge
The regression was introduced by 49d63971f963 in v6.17-rc1. Commit ce26f588c831 made v6.19-rc5 boot by removing MISC_RP1's select of PCI_DYNAMIC_OF_NODES. That avoids the failing path in the tested configuration but does not change of_pci_make_dev_node().
I do not have a log from the failed boots. No output appeared with earlyprintk=efi,keep, keep_bootcon, ignore_loglevel, loglevel=8, initcall_debug, and EFI pstore enabled. Blacklisting both GPU drivers and disabling the Intel IOMMU did not make the bad kernel boot.
Should of_pci_make_dev_node() reject devices with invalid bridge bus configuration, or should 8086:4c43 use a device-specific quirk? I can prepare and test a patch for either approach. For Linux 6.18 stable, would that fix be preferable to backporting ce26f588c831 and its dependencies?
#regzbot introduced: 49d63971f963
#regzbot title: PCI_DYNAMIC_OF_NODES early boot hang on ACPI x86
Thanks,
Angel J
Hello,
A friendly ping on this regression. It still affects Linux 6.18, and the tested invalid-bridge guard allows the machine to boot with CONFIG_PCI_DYNAMIC_OF_NODES=y.
Is any additional information or testing needed from me?
Thanks,
Angel
Quoted 130 lines · Angel J
Hello,
This regression was introduced in v6.17-rc1 and remains in the dynamic PCI OF node code. Linux 6.18 fails very early during boot on my Dell XPS 8940 when
CONFIG_PCI_DYNAMIC_OF_NODES=y. The display goes black before any useful console or pstore output appears, and the machine remains hung.Disabling
CONFIG_PCI_DYNAMIC_OF_NODESmakes the same kernel boot normally. Linux v6.19-rc5 also boots because the RP1 driver stopped selecting that option, not because the dynamic PCI OF node code changed.Hardware:
System: Dell XPS 8940, board 0K3CM7, BIOS 2.27.1 (2025-04-03)
CPU: Intel Core i7-11700 (Rocket Lake)
Triggering device: 0000:00:00.0, Intel 8086:4c43 Firmware boot: UEFI, ACPI-basedx86_64Test results:
Linux 6.12.103: good
Linux v6.17-rc1: bad
Linux 6.18.44,CONFIG_PCI_DYNAMIC_OF_NODES=y: bad
Linux 6.18.44,CONFIG_PCI_DYNAMIC_OF_NODES=n: good
Linux 6.18.44,CONFIG_PCI_DYNAMIC_OF_NODES=y, skip invalid bridge: good Linux v6.19-rc4: bad
Linux v6.19-rc5: good
Linux4621c338d33f: bad
Linuxe55feea3a03a: goodThe first-parent boundary between the last two tests is:
e55feea3a03a("Merge tag 'soc-fixes-6.19' ...")That merge contains
ce26f588c831("misc: rp1: drop overlay support"), which removes:select
PCI_DYNAMIC_OF_NODESfrom
MISC_RP1. The generated configurations differed only by:-CONFIG_PCI_DYNAMIC_OF_NODES=y
+#CONFIG_PCI_DYNAMIC_OF_NODESis not set
CONFIG_MISC_RP1=min both. The known-bad4621c338d33fand Linux 6.18.44 both boot after disablingPCI_DYNAMIC_OF_NODES(andMISC_RP1, whoseKconfigselect otherwise forces it on).There is no RP1 device in this machine, and its driver does not probe.
MISC_RP1affects this x86 system only because itsKconfigselect enablesPCI_DYNAMIC_OF_NODESglobally.I narrowed the hang to dynamic OF node creation for 0000:00:00.0 (8086:4c43), the Intel Rocket Lake-S integrated memory controller. On this machine it reports PCI class 0604 and header type 1, but it is bound to
icl_uncoreand is not a usable forwarding bridge:Bus: primary=ff, secondary=ff, subordinate=ff
I/O and memory bridge windows: invalid/all ones
kernel: bridge configuration invalid ([bus ff-ff]), reconfiguringA minimal dynamic node for this device boots. Adding only device_type="pci" makes it hang. Full PCI dynamic OF node generation also boots when only 0000:00:00.0 is skipped.
I also tested a generic guard in
of_pci_make_dev_node(). It readsPCI_PRIMARY_BUSand skips node creation if the primary bus does not matchpdev->bus->number, the secondary bus is not greater than the primary bus, or the secondary bus is greater than the subordinate bus. Linux 6.18.44 boots withCONFIG_PCI_DYNAMIC_OF_NODES=yand logs:pci 0000:00:00.0: skipping dynamic OF node for invalid bridge
The regression was introduced by
49d63971f963in v6.17-rc1. Commitce26f588c831made v6.19-rc5 boot by removing MISC_RP1's select ofPCI_DYNAMIC_OF_NODES. That avoids the failing path in the tested configuration but does not changeof_pci_make_dev_node().I do not have a log from the failed boots. No output appeared with earlyprintk=efi,keep,
keep_bootcon,ignore_loglevel, loglevel=8,initcall_debug, and EFI pstore enabled. Blacklisting both GPU drivers and disabling the Intel IOMMU did not make the bad kernel boot.Should
of_pci_make_dev_node()reject devices with invalid bridge bus configuration, or should 8086:4c43 use a device-specific quirk? I can prepare and test a patch for either approach. For Linux 6.18 stable, would that fix be preferable to backportingce26f588c831and its dependencies?#regzbot introduced:
49d63971f963
#regzbot title:PCI_DYNAMIC_OF_NODESearly boot hang on ACPI x86Thanks,
Angel J
Quoted 1 line · Angel J
A friendly ping on this regression.
Ideally the problem would be fixed, sure. But by your explanation it was already in mainline and backporting those changes might be too much churn. But you could try to submit a backport of ce26f588c831 (if that's all that's needed) to the stable team (or ask somebody to do that for you), maybe they will puck it up.
And overall: I not entirely sure if this counts as a regression, as you (if I understood things properly) enabled something new in your .config (that caused some other hidden problem to show up). That makes it a non-regression, as, say, new security restrictions (that block things that used to work) guarded by a new config option could never be introduced otherwise in Linux.
Ciao, Thorsten
Quoted 143 lines
It still affects Linux 6.18, and
the tested invalid-bridge guard allows the machine to boot withCONFIG_PCI_DYNAMIC_OF_NODES=y.Is any additional information or testing needed from me?
Thanks,
AngelQuoted 130 lines · Angel J
Hello,
This regression was introduced in v6.17-rc1 and remains in the dynamic PCI OF node code. Linux 6.18 fails very early during boot on my Dell XPS 8940 when
CONFIG_PCI_DYNAMIC_OF_NODES=y. The display goes black before any useful console or pstore output appears, and the machine remains hung.Disabling
CONFIG_PCI_DYNAMIC_OF_NODESmakes the same kernel boot normally. Linux v6.19-rc5 also boots because the RP1 driver stopped selecting that option, not because the dynamic PCI OF node code changed.Hardware:
System: Dell XPS 8940, board 0K3CM7, BIOS 2.27.1 (2025-04-03)
CPU: Intel Core i7-11700 (Rocket Lake)
Triggering device: 0000:00:00.0, Intel 8086:4c43 Firmware boot: UEFI, ACPI-basedx86_64Test results:
Linux 6.12.103: good
Linux v6.17-rc1: bad
Linux 6.18.44,CONFIG_PCI_DYNAMIC_OF_NODES=y: bad
Linux 6.18.44,CONFIG_PCI_DYNAMIC_OF_NODES=n: good
Linux 6.18.44,CONFIG_PCI_DYNAMIC_OF_NODES=y, skip invalid bridge: good Linux v6.19-rc4: bad
Linux v6.19-rc5: good
Linux4621c338d33f: bad
Linuxe55feea3a03a: goodThe first-parent boundary between the last two tests is:
e55feea3a03a("Merge tag 'soc-fixes-6.19' ...")That merge contains
ce26f588c831("misc: rp1: drop overlay support"), which removes:select
PCI_DYNAMIC_OF_NODESfrom
MISC_RP1. The generated configurations differed only by:-CONFIG_PCI_DYNAMIC_OF_NODES=y
+#CONFIG_PCI_DYNAMIC_OF_NODESis not set
CONFIG_MISC_RP1=min both. The known-bad4621c338d33fand Linux 6.18.44 both boot after disablingPCI_DYNAMIC_OF_NODES(andMISC_RP1, whoseKconfigselect otherwise forces it on).There is no RP1 device in this machine, and its driver does not probe.
MISC_RP1affects this x86 system only because itsKconfigselect enablesPCI_DYNAMIC_OF_NODESglobally.I narrowed the hang to dynamic OF node creation for 0000:00:00.0 (8086:4c43), the Intel Rocket Lake-S integrated memory controller. On this machine it reports PCI class 0604 and header type 1, but it is bound to
icl_uncoreand is not a usable forwarding bridge:Bus: primary=ff, secondary=ff, subordinate=ff
I/O and memory bridge windows: invalid/all ones
kernel: bridge configuration invalid ([bus ff-ff]), reconfiguringA minimal dynamic node for this device boots. Adding only device_type="pci" makes it hang. Full PCI dynamic OF node generation also boots when only 0000:00:00.0 is skipped.
I also tested a generic guard in
of_pci_make_dev_node(). It readsPCI_PRIMARY_BUSand skips node creation if the primary bus does not matchpdev->bus->number, the secondary bus is not greater than the primary bus, or the secondary bus is greater than the subordinate bus. Linux 6.18.44 boots withCONFIG_PCI_DYNAMIC_OF_NODES=yand logs:pci 0000:00:00.0: skipping dynamic OF node for invalid bridge
The regression was introduced by
49d63971f963in v6.17-rc1. Commitce26f588c831made v6.19-rc5 boot by removing MISC_RP1's select ofPCI_DYNAMIC_OF_NODES. That avoids the failing path in the tested configuration but does not changeof_pci_make_dev_node().I do not have a log from the failed boots. No output appeared with earlyprintk=efi,keep,
keep_bootcon,ignore_loglevel, loglevel=8,initcall_debug, and EFI pstore enabled. Blacklisting both GPU drivers and disabling the Intel IOMMU did not make the bad kernel boot.Should
of_pci_make_dev_node()reject devices with invalid bridge bus configuration, or should 8086:4c43 use a device-specific quirk? I can prepare and test a patch for either approach. For Linux 6.18 stable, would that fix be preferable to backportingce26f588c831and its dependencies?#regzbot introduced:
49d63971f963
#regzbot title:PCI_DYNAMIC_OF_NODESearly boot hang on ACPI x86Thanks,
Angel J
[+to Herve, Lizhi for PCI dynamic OF node stuff]
Quoted 7 lines · Angel J
Hello,
This regression was introduced in v6.17-rc1 and remains in the dynamic PCI OF node code. Linux 6.18 fails very early during boot on my Dell XPS 8940 when
CONFIG_PCI_DYNAMIC_OF_NODES=y. The display goes black before any useful console or pstore output appears, and the machine remains hung.
Oof, sorry, that's a terrible failure to debug. Thanks for your persistence in chasing it.
I don't think 49d63971f963 ("misc: rp1: RaspberryPi RP1 misc driver") is a likely culprit by itself because there's just nothing there that looks like it would relate to a Dell XPS 8940.
Quoted 76 lines
Disabling
CONFIG_PCI_DYNAMIC_OF_NODESmakes the same kernel boot normally. Linux v6.19-rc5 also boots because the RP1 driver stopped selecting that option, not because the dynamic PCI OF node code changed.Hardware:
System: Dell XPS 8940, board 0K3CM7, BIOS 2.27.1 (2025-04-03)
CPU: Intel Core i7-11700 (Rocket Lake)
Triggering device: 0000:00:00.0, Intel 8086:4c43 Firmware boot: UEFI, ACPI-basedx86_64Test results:
Linux 6.12.103: good
Linux v6.17-rc1: bad
Linux 6.18.44,CONFIG_PCI_DYNAMIC_OF_NODES=y: bad
Linux 6.18.44,CONFIG_PCI_DYNAMIC_OF_NODES=n: good
Linux 6.18.44,CONFIG_PCI_DYNAMIC_OF_NODES=y, skip invalid bridge: good Linux v6.19-rc4: bad
Linux v6.19-rc5: good
Linux4621c338d33f: bad
Linuxe55feea3a03a: goodThe first-parent boundary between the last two tests is:
e55feea3a03a("Merge tag 'soc-fixes-6.19' ...")That merge contains
ce26f588c831("misc: rp1: drop overlay support"), which removes:select
PCI_DYNAMIC_OF_NODESfrom
MISC_RP1. The generated configurations differed only by:-CONFIG_PCI_DYNAMIC_OF_NODES=y
+#CONFIG_PCI_DYNAMIC_OF_NODESis not set
CONFIG_MISC_RP1=min both. The known-bad4621c338d33fand Linux 6.18.44 both boot after disablingPCI_DYNAMIC_OF_NODES(andMISC_RP1, whoseKconfigselect otherwise forces it on).There is no RP1 device in this machine, and its driver does not probe.
MISC_RP1affects this x86 system only because itsKconfigselect enablesPCI_DYNAMIC_OF_NODESglobally.I narrowed the hang to dynamic OF node creation for 0000:00:00.0 (8086:4c43), the Intel Rocket Lake-S integrated memory controller. On this machine it reports PCI class 0604 and header type 1, but it is bound to
icl_uncoreand is not a usable forwarding bridge:Bus: primary=ff, secondary=ff, subordinate=ff
I/O and memory bridge windows: invalid/all ones
kernel: bridge configuration invalid ([bus ff-ff]), reconfiguringA minimal dynamic node for this device boots. Adding only device_type="pci" makes it hang. Full PCI dynamic OF node generation also boots when only 0000:00:00.0 is skipped.
I also tested a generic guard in
of_pci_make_dev_node(). It readsPCI_PRIMARY_BUSand skips node creation if the primary bus does not matchpdev->bus->number, the secondary bus is not greater than the primary bus, or the secondary bus is greater than the subordinate bus. Linux 6.18.44 boots withCONFIG_PCI_DYNAMIC_OF_NODES=yand logs:pci 0000:00:00.0: skipping dynamic OF node for invalid bridge
The regression was introduced by
49d63971f963in v6.17-rc1. Commitce26f588c831made v6.19-rc5 boot by removing MISC_RP1's select ofPCI_DYNAMIC_OF_NODES. That avoids the failing path in the tested configuration but does not changeof_pci_make_dev_node().I do not have a log from the failed boots. No output appeared with earlyprintk=efi,keep,
keep_bootcon,ignore_loglevel, loglevel=8,initcall_debug, and EFI pstore enabled. Blacklisting both GPU drivers and disabling the Intel IOMMU did not make the bad kernel boot.
Quoted 5 lines
Should
of_pci_make_dev_node()reject devices with invalid bridge bus configuration, or should 8086:4c43 use a device-specific quirk? I can prepare and test a patch for either approach. For Linux 6.18 stable, would that fix be preferable to backportingce26f588c831and its dependencies?
A quirk doesn't sound right because AFAICS there isn't any hardware defect with the 00:00.0 bridge.
Quoted 10 lines
#regzbot introduced:
49d63971f963
#regzbot title:PCI_DYNAMIC_OF_NODESearly boot hang on ACPI x86Thanks,
Angel J
Hi Angel, Bjorn,
Quoted 11 lines · On Thu, 3 Sep 2026 18:17:44 -0500 Bjorn Helgaas <[email protected]> wrote:
[+to Herve, Lizhi for PCI dynamic OF node stuff]
Quoted 7 lines · Angel J
Hello,
This regression was introduced in v6.17-rc1 and remains in the dynamic PCI OF node code. Linux 6.18 fails very early during boot on my Dell XPS 8940 when
CONFIG_PCI_DYNAMIC_OF_NODES=y. The display goes black before any useful console or pstore output appears, and the machine remains hung.
Quoted 60 lines
Oof, sorry, that's a terrible failure to debug. Thanks for your persistence in chasing it.
I don't think
49d63971f963("misc: rp1: RaspberryPi RP1 misc driver") is a likely culprit by itself because there's just nothing there that looks like it would relate to a Dell XPS 8940.Quoted 53 lines
Disabling
CONFIG_PCI_DYNAMIC_OF_NODESmakes the same kernel boot normally. Linux v6.19-rc5 also boots because the RP1 driver stopped selecting that option, not because the dynamic PCI OF node code changed.Hardware:
System: Dell XPS 8940, board 0K3CM7, BIOS 2.27.1 (2025-04-03)
CPU: Intel Core i7-11700 (Rocket Lake)
Triggering device: 0000:00:00.0, Intel 8086:4c43 Firmware boot: UEFI, ACPI-basedx86_64Test results:
Linux 6.12.103: good
Linux v6.17-rc1: bad
Linux 6.18.44,CONFIG_PCI_DYNAMIC_OF_NODES=y: bad
Linux 6.18.44,CONFIG_PCI_DYNAMIC_OF_NODES=n: good
Linux 6.18.44,CONFIG_PCI_DYNAMIC_OF_NODES=y, skip invalid bridge: good Linux v6.19-rc4: bad
Linux v6.19-rc5: good
Linux4621c338d33f: bad
Linuxe55feea3a03a: goodThe first-parent boundary between the last two tests is:
e55feea3a03a("Merge tag 'soc-fixes-6.19' ...")That merge contains
ce26f588c831("misc: rp1: drop overlay support"), which removes:select
PCI_DYNAMIC_OF_NODESfrom
MISC_RP1. The generated configurations differed only by:-CONFIG_PCI_DYNAMIC_OF_NODES=y
+#CONFIG_PCI_DYNAMIC_OF_NODESis not set
CONFIG_MISC_RP1=min both. The known-bad4621c338d33fand Linux 6.18.44 both boot after disablingPCI_DYNAMIC_OF_NODES(andMISC_RP1, whoseKconfigselect otherwise forces it on).There is no RP1 device in this machine, and its driver does not probe.
MISC_RP1affects this x86 system only because itsKconfigselect enablesPCI_DYNAMIC_OF_NODESglobally.I narrowed the hang to dynamic OF node creation for 0000:00:00.0 (8086:4c43), the Intel Rocket Lake-S integrated memory controller. On this machine it reports PCI class 0604 and header type 1, but it is bound to
icl_uncoreand is not a usable forwarding bridge:Bus: primary=ff, secondary=ff, subordinate=ff
I/O and memory bridge windows: invalid/all ones
kernel: bridge configuration invalid ([bus ff-ff]), reconfiguring
Is this PCI logs reported with PCI_DYNAMIC_OF_NODES=y or PCI_DYNAMIC_OF_NODES=n or always whatever the PCI_DYNAMIC_OF_NODES Kconfig value ?
A PCI class 0604 is a PCI-to-PCI bridge.
Something in kernel code prevent the scan of this PCI-to-PCI bridge even if the kernel tries to reconfigure it. Indeed, the device is "Intel Rocket Lake-S integrated memory controller" and not a PCI-to-PCI bridge
The of_pci_make_dev_node() is called by the PCI core [1] to create OF node for bridges.
of_pci_make_dev_node() will set (device_type = "pci" in the created node).
But if the device it is not a bridge, this is obviously wrong (even if I don't understand why it hangs the system).
Maybe the test done at [1] should be improved to detect those wrong bridges. and skip the of_pci_make_dev_node() call when a wrong bridge is detected.
[1] https://elixir.bootlin.com/linux/v7.2/source/drivers/pci/bus.c#L355
Best regards,
Hervé
Hi,
Quoted 77 lines · Herve Codina
Hi Angel, Bjorn,
Quoted 11 lines · On Thu, 3 Sep 2026 18:17:44 -0500 Bjorn Helgaas <[email protected]> wrote:
[+to Herve, Lizhi for PCI dynamic OF node stuff]
Quoted 7 lines · Angel J
Hello,
This regression was introduced in v6.17-rc1 and remains in the dynamic PCI OF node code. Linux 6.18 fails very early during boot on my Dell XPS 8940 when
CONFIG_PCI_DYNAMIC_OF_NODES=y. The display goes black before any useful console or pstore output appears, and the machine remains hung.Quoted 60 lines
Oof, sorry, that's a terrible failure to debug. Thanks for your persistence in chasing it.
I don't think
49d63971f963("misc: rp1: RaspberryPi RP1 misc driver") is a likely culprit by itself because there's just nothing there that looks like it would relate to a Dell XPS 8940.Quoted 53 lines
Disabling
CONFIG_PCI_DYNAMIC_OF_NODESmakes the same kernel boot normally. Linux v6.19-rc5 also boots because the RP1 driver stopped selecting that option, not because the dynamic PCI OF node code changed.Hardware:
System: Dell XPS 8940, board 0K3CM7, BIOS 2.27.1 (2025-04-03)
CPU: Intel Core i7-11700 (Rocket Lake)
Triggering device: 0000:00:00.0, Intel 8086:4c43 Firmware boot: UEFI, ACPI-basedx86_64Test results:
Linux 6.12.103: good
Linux v6.17-rc1: bad
Linux 6.18.44,CONFIG_PCI_DYNAMIC_OF_NODES=y: bad
Linux 6.18.44,CONFIG_PCI_DYNAMIC_OF_NODES=n: good
Linux 6.18.44,CONFIG_PCI_DYNAMIC_OF_NODES=y, skip invalid bridge: good Linux v6.19-rc4: bad
Linux v6.19-rc5: good
Linux4621c338d33f: bad
Linuxe55feea3a03a: goodThe first-parent boundary between the last two tests is:
e55feea3a03a("Merge tag 'soc-fixes-6.19' ...")That merge contains
ce26f588c831("misc: rp1: drop overlay support"), which removes:select
PCI_DYNAMIC_OF_NODESfrom
MISC_RP1. The generated configurations differed only by:-CONFIG_PCI_DYNAMIC_OF_NODES=y
+#CONFIG_PCI_DYNAMIC_OF_NODESis not set
CONFIG_MISC_RP1=min both. The known-bad4621c338d33fand Linux 6.18.44 both boot after disablingPCI_DYNAMIC_OF_NODES(andMISC_RP1, whoseKconfigselect otherwise forces it on).There is no RP1 device in this machine, and its driver does not probe.
MISC_RP1affects this x86 system only because itsKconfigselect enablesPCI_DYNAMIC_OF_NODESglobally.I narrowed the hang to dynamic OF node creation for 0000:00:00.0 (8086:4c43), the Intel Rocket Lake-S integrated memory controller. On this machine it reports PCI class 0604 and header type 1, but it is bound to
icl_uncoreand is not a usable forwarding bridge:Bus: primary=ff, secondary=ff, subordinate=ff
I/O and memory bridge windows: invalid/all ones
kernel: bridge configuration invalid ([bus ff-ff]), reconfiguring
Quoted 8 lines
Is this PCI logs reported with PCI_DYNAMIC_OF_NODES=y or PCI_DYNAMIC_OF_NODES=n or always whatever the
PCI_DYNAMIC_OF_NODESKconfigvalue ?A PCI class 0604 is a PCI-to-PCI bridge.
Something in kernel code prevent the scan of this PCI-to-PCI bridge even if the kernel tries to reconfigure it. Indeed, the device is "Intel Rocket Lake-S integrated memory controller" and not a PCI-to-PCI bridge
Indeed, a Host-bridge should have 0600 class and Header 0 (or 80, if it's multi function as it seems). Angel, could you please provide the following output:
lspci -nn
setpci -s 00:00.0 HEADER_TYPE
from a running (i.e. with CONFIG_PCI_DYNAMIC_OF_NODES=n) system? Just to make sure we're talking about the correct device and that the hw is 'lying' to us...
Many thanks,
Andrea
Quoted 17 lines
The
of_pci_make_dev_node()is called by the PCI core [1] to create OF node for bridges.
of_pci_make_dev_node()will set (device_type= "pci" in the created node).But if the device it is not a bridge, this is obviously wrong (even if I don't understand why it hangs the system).
Maybe the test done at [1] should be improved to detect those wrong bridges. and skip the
of_pci_make_dev_node()call when a wrong bridge is detected.[1] https://elixir.bootlin.com/linux/v7.2/source/drivers/pci/bus.c#L355
Best regards,
Hervé
Hi Andrea, Hervé, Bjorn, Thorsten,
Thanks for the guidance, it was very useful. I went back through the tests and got some more insight into the hang.
Quoted 6 lines · Andrea
Angel, could you please provide the following output:
lspci -nn
setpci -s 00:00.0HEADER_TYPEfrom a running (i.e. with
CONFIG_PCI_DYNAMIC_OF_NODES=n) system?
On Linux 6.12.109, with CONFIG_PCI_DYNAMIC_OF_NODES disabled, the relevant output is:
$ lspci -nn 00:00.0 PCI bridge [0604]: Intel Corporation Device [8086:4c43] (rev 01)
$ setpci -s 00:00.0 HEADER_TYPE 01
$ setpci -s 00:00.0 PRIMARY_BUS SECONDARY_BUS SUBORDINATE_BUS ff ff ff
The device is bound to icl_uncore. I get the same values on the patched kernel with CONFIG_PCI_DYNAMIC_OF_NODES=y.
Quoted 2 lines · Hervé
Is this PCI logs reported with PCI_DYNAMIC_OF_NODES=y or PCI_DYNAMIC_OF_NODES=n or always whatever the
PCI_DYNAMIC_OF_NODESKconfigvalue ?
The messages appear on successful boots with either setting:
pci 0000:00:00.0: [8086:4c43] type 01 class 0x060400 conventional PCI bridge pci 0000:00:00.0: bridge configuration invalid ([bus ff-ff]), reconfiguring
I confirmed this on 6.12.107 with the option disabled and 6.12.108 with it enabled. They also appear on the patched 6.18.44 kernel.
Quoted 3 lines · Bjorn
I don't think
49d63971f963("misc: rp1: RaspberryPi RP1 misc driver") is a likely culprit by itself because there's just nothing there that looks like it would relate to a Dell XPS 8940.
That change exposed the problem by enabling PCI_DYNAMIC_OF_NODES in my configuration. I bisected again with the option enabled throughout and found an earlier boundary:
3dc8adeeefa0 PCI: of_property: Constify parameter in of_pci_get_addr_flags() 1f340724419e PCI: of: Create device tree PCI host bridge node
The first is the direct parent of the second. I boot-tested both without any guard, changing only the source commit; their generated kernel configurations are identical.
All of these tests have CONFIG_PCI_DYNAMIC_OF_NODES=y:
Source Change Result
3dc8adeeefa0 None Boots 1f340724419e None Hangs 1f340724419e Subordinate guard Boots 6.18.44 None Hangs 6.18.44 Subordinate guard Boots
Quoted 2 lines · Hervé
Maybe the test done at [1] should be improved to detect those wrong bridges. and skip the
of_pci_make_dev_node()call when a wrong bridge is detected.
I added logging to the first bad commit to check the bridge scan. It shows that 00:00.0 has no subordinate bus after either pass, despite satisfying pci_is_bridge():
pci 0000:00:00.0: PCI OF debug: scan pass 0, buses ff/ff/ff pci 0000:00:00.0: PCI OF debug: scan pass 0 done, subordinate bus absent pci 0000:00:00.0: PCI OF debug: scan pass 1, buses ff/ff/ff pci 0000:00:00.0: PCI OF debug: scan pass 1 done, subordinate bus absent
of_pci_prop_bus_range() dereferences pdev->subordinate without checking it. of_pci_prop_intr_map() also uses that pointer. Before 1f340724419e, of_pci_make_dev_node() returns because the parent OF node is missing on this ACPI system. That commit creates the parent node, allowing property generation to reach the unchecked access.
My earlier report overstated the device_type="pci" result. The minimal-node test that hung added device_type, bus-range and interrupt-map together; I haven't confirmed a hang with device_type alone.
I tested this guard in of_pci_make_dev_node(), before node creation:
if (pci_is_bridge(pdev) && !pdev->subordinate)
return;Both the first bad commit and 6.18.44 boot with it. The 6.18.44 test uses only the guard, without diagnostic logging. The host OF node and the nodes for bridges 00:01.0 and 00:1c.0 are still created; 00:00.0 is skipped.
This points to the NULL subordinate pointer as the cause of the hang, although I still don't have a crash trace from an unguarded boot. I'll send the patch as a reply to this email. Is of_pci_make_dev_node() the right place for this check?
#regzbot introduced: 1f340724419eda8ab07a20edcaf5ec8f70134231
Thanks,
Angel J
PATCH 1/1 PCI: of: Skip dynamic nodes for bridges without a subordinate bus
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.
Skip dynamic OF node creation for bridges without a subordinate bus. This allows the machine to boot while preserving node creation for the other bridges.
--- drivers/pci/of.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/pci/of.c +4 -0
@@ -765,6 +765,10 @@ void of_pci_make_dev_node(struct pci_dev *pdev)if (!ppnode)return ; +/* Bridge properties require a subordinate bus. */ +if (pci_is_bridge (pdev) && !pdev->subordinate) +return ; +if (pci_is_bridge (pdev)) pci_type ="pci" ;else
Signature · 1 line
2.54.0
[email protected]
AI reviewRe: [PATCH] PCI: of: Skip dynamic nodes for bridges without a subordinate bus
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The fix for the NULL pointer dereference is an incorrect workaround that completely skips…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The fix for the NULL pointer dereference is an incorrect workaround that completely skips creating the dynamic OF node for the bridge device. --
commit 876df8df861d1c7910e8724db8a082e07c66b879
Author: Angel J <[email protected]>
PCI: of: Skip dynamic nodes for bridges without a subordinate bus
This commit adds an early return in of_pci_make_dev_node() for bridge devices lacking a subordinate bus to prevent a boot hang on certain systems.
drivers/pci/of.c void of_pci_make_dev_node(struct pci_dev *pdev) · line 771
Quoted 12 lines
drivers/pci/of.c +4
-0@@ -765,6 +765,10 @@ void of_pci_make_dev_node(struct pci_dev *pdev)if (!ppnode)return ; +/* Bridge properties require a subordinate bus. */ +if (pci_is_bridge (pdev) && !pdev->subordinate) +return ; +
[Severity: Medium]
Does completely skipping the OF node creation for these bridges cause unintended side effects?
Since endpoint devices also lack subordinate buses but correctly get OF nodes, wouldn't it be better to let the node creation proceed for the bridge, and instead skip only the bus-range and interrupt-map properties?
The actual null pointer dereference appears to happen in of_pci_add_properties() when handling those specific properties:
drivers/pci/of_property.c:of_pci_add_properties() {
...
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;
...
}Could the subordinate check be moved there instead, so the bridge still receives its basic OF node configurations like the reg property?
Quoted 3 lines
drivers/pci/of.c +0
-0if (pci_is_bridge (pdev)) pci_type ="pci" ;else
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH v2 1/1 PCI: of_property: Omit bus properties without a subordinate bus
In reply to Angel JA 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.
---
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(-)
drivers/pci/of_property.c +8 -6
@@ -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)
Signature · 1 line
2.54.0
[email protected]
AI reviewRe: [PATCH v2] PCI: of_property: Omit bus properties without a subordinate bus
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Potential kernel panic due to unhandled kasprintf() memory allocation failure in of_pci_prop_compatible(). --
commit ad6194f8ec3f58cf7279c3746e014412e0aad530
Author: Angel J <[email protected]>
PCI: of_property: Omit bus properties without a subordinate bus
This commit updates of_pci_add_properties() to only generate bus-range and interrupt-map properties when a subordinate bus is present. This prevents an early boot hang on devices that satisfy pci_is_bridge() but lack a subordinate bus.
Quoted 16 lines
drivers/pci/of_property.c +4
-3@@ -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;
drivers/pci/of_property.c int of_pci_add_properties(struct pci_dev *pdev, struct of_changeset *ocs, · line 375
Quoted 10 lines
drivers/pci/of_property.c +4
-3- 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)
[Severity: High]
This is a pre-existing issue, but I noticed a potential problem in of_pci_prop_compatible(), which is called later in this same function.
Can kasprintf() return NULL here under memory pressure?
drivers/pci/of_property.c:of_pci_prop_compatible() {
...
compat_strs[PROP_COMPAT_PCI_VVVV_DDDD] =
kasprintf(GFP_KERNEL, "pci%x,%x", pdev->vendor, pdev->device);
...
}If this happens, the compat_strs array will contain a NULL pointer. When this array is passed to of_changeset_add_prop_string_array():
drivers/pci/of_property.c:of_pci_prop_compatible() {
...
ret = of_changeset_add_prop_string_array(ocs, np, "compatible",
compat_strs, PROP_COMPAT_NUM);
...
}Does the changeset API assume all string pointers are valid, leading to a NULL pointer dereference in strlen() when it iterates over the array?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH v2] PCI: of_property: Omit bus properties without a subordinate bus
In reply to Angel JQuoted 7 lines · Angel J
A device can satisfy
pci_is_bridge()without having a subordinate bus. The dynamic OF helpers for bus-range and interrupt-map dereferencepdev->subordinatewithout checking it.On a Dell XPS 8940, device 0000:00:00.0 [8086:4c43] has no subordinate bus, and enabling
CONFIG_PCI_DYNAMIC_OF_NODEScauses an early boot hang.
Quoted 6 lines
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 retainsdevice_type, reg and compatible. The other bridges retain their nodes and bus ranges.
I think this is the right approach, with something like this included in the commit log:
A bridge (a device with a Type 1 header) may not have a secondary bus allocated (pdev->subordinate), e.g., if there are no available bus numbers or the bridge secondary/subordinate bus numbers are not writable.
I don't think it's necessary to connect this with [8086:4c43] because I think this situation is very common, and I don't want to leave the impression that it's related to a Dell system or to that specific device. It's just a bug to assume that pci_is_bridge() implies pdev->subordinate is valid.
Quoted 24 lines
Fixes 407d1a51921e ("PCI: Create device tree node for bridge")Signed-off-by Angel J <[email protected]>---
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(-)drivers/pci/of_property.c +1
-3@@ -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) {
drivers/pci/of_property.c int of_pci_add_properties(struct pci_dev *pdev, struct of_changeset *ocs, · line 371
Quoted 10 lines
drivers/pci/of_property.c +6
-3+ 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;
I think this is the best solution, but I do think it would be a little cleaner to check for pdev->subordinate inside of_pci_prop_bus_range() and of_pci_prop_intr_map() instead of assuming things here about the internals of those functions. We could just make them return immediately without doing anything.
Quoted 7 lines
drivers/pci/of_property.c +1
-0+ } }else { ret =of_pci_prop_intr_ctrl (pdev, ocs, np);if (ret)Signature · 1 line
2.54.0
PATCH v3 1/1 PCI: of_property: Omit bus properties without a subordinate bus
Author: Angel J <[email protected]>
PCI: of_property: Omit bus properties without a subordinate bus
A bridge (a device with a Type 1 header) may not have a secondary bus allocated (pdev->subordinate), e.g., if there are no available bus numbers or the bridge secondary/subordinate bus numbers are not writable.
The dynamic OF helpers of_pci_prop_bus_range() and of_pci_prop_intr_map() dereference pdev->subordinate without checking it. When CONFIG_PCI_DYNAMIC_OF_NODES is enabled, this can cause a NULL pointer dereference and early boot hang.
Generate 'bus-range' and 'interrupt-map' properties only when a subordinate bus exists. Keep the node and its remaining properties for bridges without one.
The problem was latent since 407d1a51921e ("PCI: Create device tree node for bridge"), but wasn't reachable until 1f340724419e ("PCI: of: Create device tree PCI host bridge node"), which appeared in v6.15. Before 1f340724419e, of_pci_make_dev_node() returned early because the parent OF node was missing.
---
Changes in v3:
- Move pdev->subordinate tests to of_pci_prop_bus_range() and of_pci_prop_intr_map()
Changes in v2
(https://lore.kernel.org/all/[email protected]):
- 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.
v1
(https://lore.kernel.org/all/[email protected])
drivers/pci/of_property.c +9 -2
@@ -95,9 +95,13 @@ static int of_pci_prop_bus_range(struct pci_dev *pdev,struct of_changeset *ocs, struct device_node *np) { - u32 bus_range[] = { pdev->subordinate->busn_res.start, - pdev->subordinate->busn_res.end }; + u32 bus_range[2]; +if (!pdev->subordinate) +return 0 ; + + bus_range[0 ] = pdev->subordinate->busn_res.start; + bus_range[1 ] = pdev->subordinate->busn_res.end;return of_changeset_add_prop_u32_array (ocs, np,"bus-range" , bus_range,ARRAY_SIZE (bus_range)); }
@@ -220,6 +224,9 @@ static int of_pci_prop_intr_map(struct pci_dev *pdev, struct of_changeset *ocs,int ret;u8 pin; +if (!pdev->subordinate) +return 0 ; + pnode =pci_device_to_OF_node (pdev->bus->self);if (!pnode) pnode =pci_bus_to_OF_node (pdev->bus);
[email protected]
AI reviewRe: [PATCH v3] PCI: of_property: Omit bus properties without a subordinate bus
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 23 lines
Author: Angel J <[email protected]>
PCI:
of_property: Omit bus properties without a subordinate busA bridge (a device with a Type 1 header) may not have a secondary bus allocated (
pdev->subordinate), e.g., if there are no available bus numbers or the bridge secondary/subordinate bus numbers are not writable.The dynamic OF helpers
of_pci_prop_bus_range()andof_pci_prop_intr_map()dereferencepdev->subordinatewithout checking it. WhenCONFIG_PCI_DYNAMIC_OF_NODESis enabled, this can cause a NULL pointer dereference and early boot hang.Generate 'bus-range' and 'interrupt-map' properties only when a subordinate bus exists. Keep the node and its remaining properties for bridges without one.
The problem was latent since
407d1a51921e("PCI: Create device tree node for bridge"), but wasn't reachable until1f340724419e("PCI: of: Create device tree PCI host bridge node"), which appeared in v6.15. Before1f340724419e,of_pci_make_dev_node()returned early because the parent OF node was missing.
Quoted 4 lines
Fixes 407d1a51921e ("PCI: Create device tree node for bridge")Signed-off-by Angel J <[email protected]>[bhelgaas: move pdev->subordinate test to callees, commit log]Signed-off-by Bjorn Helgaas <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/20260918195540.GA1187209@bhelgaas?part=1
Re: [PATCH v3] PCI: of_property: Omit bus properties without a subordinate bus
In reply to Bjorn HelgaasQuoted 23 lines · Bjorn Helgaas
Author: Angel J <[email protected]>
PCI:
of_property: Omit bus properties without a subordinate busA bridge (a device with a Type 1 header) may not have a secondary bus allocated (
pdev->subordinate), e.g., if there are no available bus numbers or the bridge secondary/subordinate bus numbers are not writable.The dynamic OF helpers
of_pci_prop_bus_range()andof_pci_prop_intr_map()dereferencepdev->subordinatewithout checking it. WhenCONFIG_PCI_DYNAMIC_OF_NODESis enabled, this can cause a NULL pointer dereference and early boot hang.Generate 'bus-range' and 'interrupt-map' properties only when a subordinate bus exists. Keep the node and its remaining properties for bridges without one.
The problem was latent since
407d1a51921e("PCI: Create device tree node for bridge"), but wasn't reachable until1f340724419e("PCI: of: Create device tree PCI host bridge node"), which appeared in v6.15. Before1f340724419e,of_pci_make_dev_node()returned early because the parent OF node was missing.
Quoted 6 lines
Fixes 407d1a51921e ("PCI: Create device tree node for bridge")Signed-off-by Angel J <[email protected]>[bhelgaas: move pdev->subordinate test to callees, commit log]Signed-off-by Bjorn Helgaas <[email protected]>Cc [email protected] # v6.6+
I put this on pci/for-linus, planning to be in v7.3, but I would love to have testing reports to make sure it still works as the v2 does.
Quoted 44 lines
---
Changes in v3:
- Movepdev->subordinatetests toof_pci_prop_bus_range()andof_pci_prop_intr_map()Changes in v2
(https://lore.kernel.org/all/[email protected]):
- 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.v1
(https://lore.kernel.org/all/[email protected])drivers/pci/of_property.c +9
-2@@ -95,9 +95,13 @@ static int of_pci_prop_bus_range(struct pci_dev *pdev,struct of_changeset *ocs, struct device_node *np) { - u32 bus_range[] = { pdev->subordinate->busn_res.start, - pdev->subordinate->busn_res.end }; + u32 bus_range[2]; +if (!pdev->subordinate) +return 0 ; + + bus_range[0 ] = pdev->subordinate->busn_res.start; + bus_range[1 ] = pdev->subordinate->busn_res.end;return of_changeset_add_prop_u32_array (ocs, np,"bus-range" , bus_range,ARRAY_SIZE (bus_range)); }@@ -220,6 +224,9 @@ static int of_pci_prop_intr_map(struct pci_dev *pdev, struct of_changeset *ocs,int ret;u8 pin; +if (!pdev->subordinate) +return 0 ; + pnode =pci_device_to_OF_node (pdev->bus->self);if (!pnode) pnode =pci_bus_to_OF_node (pdev->bus);
Re: [PATCH v3] PCI: of_property: Omit bus properties without a subordinate bus
I didn't reply cuz I'm out for 3 weeks without access to that machine, so I can't test or confirm it works as expected (even though probably does)
Still, I will try to confirm as soon as I can.
Thanks
Quoted 81 lines · Bjorn Helgaas
Quoted 23 lines · Bjorn Helgaas
Author: Angel J <[email protected]>
PCI:
of_property: Omit bus properties without a subordinate busA bridge (a device with a Type 1 header) may not have a secondary bus allocated (
pdev->subordinate), e.g., if there are no available bus numbers or the bridge secondary/subordinate bus numbers are not writable.The dynamic OF helpers
of_pci_prop_bus_range()andof_pci_prop_intr_map()dereferencepdev->subordinatewithout checking it. WhenCONFIG_PCI_DYNAMIC_OF_NODESis enabled, this can cause a NULL pointer dereference and early boot hang.Generate 'bus-range' and 'interrupt-map' properties only when a subordinate bus exists. Keep the node and its remaining properties for bridges without one.
The problem was latent since
407d1a51921e("PCI: Create device tree node for bridge"), but wasn't reachable until1f340724419e("PCI: of: Create device tree PCI host bridge node"), which appeared in v6.15. Before1f340724419e,of_pci_make_dev_node()returned early because the parent OF node was missing.Quoted 6 lines
Fixes 407d1a51921e ("PCI: Create device tree node for bridge")Signed-off-by Angel J <[email protected]>[bhelgaas: move pdev->subordinate test to callees, commit log]Signed-off-by Bjorn Helgaas <[email protected]>Cc [email protected] # v6.6+I put this on pci/for-linus, planning to be in v7.3, but I would love to have testing reports to make sure it still works as the v2 does.
Quoted 44 lines
---
Changes in v3:
- Movepdev->subordinatetests toof_pci_prop_bus_range()andof_pci_prop_intr_map()Changes in v2
(https://lore.kernel.org/all/[email protected]):
- 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.v1
(https://lore.kernel.org/all/[email protected])drivers/pci/of_property.c +9
-2@@ -95,9 +95,13 @@ static int of_pci_prop_bus_range(struct pci_dev *pdev,struct of_changeset *ocs, struct device_node *np) { - u32 bus_range[] = { pdev->subordinate->busn_res.start, - pdev->subordinate->busn_res.end }; + u32 bus_range[2]; +if (!pdev->subordinate) +return 0 ; + + bus_range[0 ] = pdev->subordinate->busn_res.start; + bus_range[1 ] = pdev->subordinate->busn_res.end;return of_changeset_add_prop_u32_array (ocs, np,"bus-range" , bus_range,ARRAY_SIZE (bus_range)); }@@ -220,6 +224,9 @@ static int of_pci_prop_intr_map(struct pci_dev *pdev, struct of_changeset *ocs,int ret;u8 pin; +if (!pdev->subordinate) +return 0 ; + pnode =pci_device_to_OF_node (pdev->bus->self);if (!pnode) pnode =pci_bus_to_OF_node (pdev->bus);
Herve Codina
Tested-byRe: [PATCH v3] PCI: of_property: Omit bus properties without a subordinate bus
In reply to Bjorn HelgaasHi Bjorn,
Quoted 31 lines · On Fri, 18 Sep 2026 15:20:45 -0500 Bjorn Helgaas <[email protected]> wrote:
Quoted 23 lines · Bjorn Helgaas
Author: Angel J <[email protected]>
PCI:
of_property: Omit bus properties without a subordinate busA bridge (a device with a Type 1 header) may not have a secondary bus allocated (
pdev->subordinate), e.g., if there are no available bus numbers or the bridge secondary/subordinate bus numbers are not writable.The dynamic OF helpers
of_pci_prop_bus_range()andof_pci_prop_intr_map()dereferencepdev->subordinatewithout checking it. WhenCONFIG_PCI_DYNAMIC_OF_NODESis enabled, this can cause a NULL pointer dereference and early boot hang.Generate 'bus-range' and 'interrupt-map' properties only when a subordinate bus exists. Keep the node and its remaining properties for bridges without one.
The problem was latent since
407d1a51921e("PCI: Create device tree node for bridge"), but wasn't reachable until1f340724419e("PCI: of: Create device tree PCI host bridge node"), which appeared in v6.15. Before1f340724419e,of_pci_make_dev_node()returned early because the parent OF node was missing.Quoted 6 lines
Fixes 407d1a51921e ("PCI: Create device tree node for bridge")Signed-off-by Angel J <[email protected]>[bhelgaas: move pdev->subordinate test to callees, commit log]Signed-off-by Bjorn Helgaas <[email protected]>Cc [email protected] # v6.6+
Quoted 2 lines
I put this on pci/for-linus, planning to be in v7.3, but I would love to have testing reports to make sure it still works as the v2 does.
I know it's too late to add a tag but well, just to mention my test somewhere:
It works for the LAN966x use case. Tested with v7.4-rc1.
Best regards,
Hervé
Hi Angel,
Quoted 19 lines · Angel J
Hi Andrea, Hervé, Bjorn, Thorsten,
Thanks for the guidance, it was very useful. I went back through the tests and got some more insight into the hang.
Quoted 6 lines · Andrea
Angel, could you please provide the following output:
lspci -nn
setpci -s 00:00.0HEADER_TYPEfrom a running (i.e. with
CONFIG_PCI_DYNAMIC_OF_NODES=n) system?On Linux 6.12.109, with
CONFIG_PCI_DYNAMIC_OF_NODESdisabled, the relevant output is:$ lspci -nn 00:00.0 PCI bridge [0604]: Intel Corporation Device [8086:4c43] (rev 01)
Quoted 7 lines
$ setpci -s 00:00.0 HEADER_TYPE 01$ setpci -s 00:00.0 PRIMARY_BUS SECONDARY_BUS SUBORDINATE_BUS ff ff ff
So it seems that a device which is reported as a PCI bridge does not manage any bus underneath.
Quoted 45 lines
The device is bound to
icl_uncore. I get the same values on the patched kernel withCONFIG_PCI_DYNAMIC_OF_NODES=y.Quoted 2 lines · Hervé
Is this PCI logs reported with PCI_DYNAMIC_OF_NODES=y or PCI_DYNAMIC_OF_NODES=n or always whatever the
PCI_DYNAMIC_OF_NODESKconfigvalue ?The messages appear on successful boots with either setting:
pci 0000:00:00.0: [8086:4c43] type 01 class
0x060400conventional PCI bridge pci 0000:00:00.0: bridge configuration invalid ([bus ff-ff]), reconfiguringI confirmed this on 6.12.107 with the option disabled and 6.12.108 with it enabled. They also appear on the patched 6.18.44 kernel.
Quoted 3 lines · Bjorn
I don't think
49d63971f963("misc: rp1: RaspberryPi RP1 misc driver") is a likely culprit by itself because there's just nothing there that looks like it would relate to a Dell XPS 8940.That change exposed the problem by enabling
PCI_DYNAMIC_OF_NODESin my configuration. I bisected again with the option enabled throughout and found an earlier boundary:
3dc8adeeefa0PCI:of_property: Constify parameter inof_pci_get_addr_flags()1f340724419ePCI: of: Create device tree PCI host bridge nodeThe first is the direct parent of the second. I boot-tested both without any guard, changing only the source commit; their generated kernel configurations are identical.
All of these tests have
CONFIG_PCI_DYNAMIC_OF_NODES=y:Source Change Result
3dc8adeeefa0 None Boots 1f340724419e None Hangs 1f340724419e Subordinate guard Boots 6.18.44 None Hangs 6.18.44 Subordinate guard BootsQuoted 2 lines · Hervé
Maybe the test done at [1] should be improved to detect those wrong bridges. and skip the
of_pci_make_dev_node()call when a wrong bridge is detected.
Quoted 8 lines
I added logging to the first bad commit to check the bridge scan. It shows that 00:00.0 has no subordinate bus after either pass, despite satisfying
pci_is_bridge():pci 0000:00:00.0: PCI OF debug: scan pass 0, buses ff/ff/ff pci 0000:00:00.0: PCI OF debug: scan pass 0 done, subordinate bus absent pci 0000:00:00.0: PCI OF debug: scan pass 1, buses ff/ff/ff pci 0000:00:00.0: PCI OF debug: scan pass 1 done, subordinate bus absent
This is confirmed by the BIOS/fw not filling the bus range and by the kernel failing to reallocate the bus since the range registers are probably read-only. Apparently this is not a bridge, it should be at most a host controller.
Quoted 7 lines
of_pci_prop_bus_range()dereferencespdev->subordinatewithout checking it.of_pci_prop_intr_map()also uses that pointer. Before1f340724419e,of_pci_make_dev_node()returns because the parent OF node is missing on this ACPI system. That commit creates the parent node, allowing property generation to reach the unchecked access.
Quoted 8 lines
My earlier report overstated the device_type="pci" result. The minimal-node test that hung added
device_type, bus-range and interrupt-map together; I haven't confirmed a hang withdevice_typealone.I tested this guard in
of_pci_make_dev_node(), before node creation:if (pci_is_bridge(pdev) && !pdev->subordinate) return;
Not sure, maybe can it be considered a hw bug? If this is the case, we can maybe add a quirk for this device. Could you please test adding a quirk as PCI_FIXUP_HEADER in which you downgrade the class from 0604 to 0600 and see it works even without your proposed check in of_pci_make_dev_node()?
If this works, maybe we can just turn the body of your conditional into just an error log plus fast exit, because a bridge must have valid subordinate.
Many thanks,
Andrea
Quoted 13 lines
Both the first bad commit and 6.18.44 boot with it. The 6.18.44 test uses only the guard, without diagnostic logging. The host OF node and the nodes for bridges 00:01.0 and 00:1c.0 are still created; 00:00.0 is skipped.
This points to the NULL subordinate pointer as the cause of the hang, although I still don't have a crash trace from an unguarded boot. I'll send the patch as a reply to this email. Is
of_pci_make_dev_node()the right place for this check?#regzbot introduced:
1f340724419eda8ab07a20edcaf5ec8f70134231Thanks,
Angel J
Hi Andrea,
Quoted 3 lines
Could you please test adding a quirk as
PCI_FIXUP_HEADER
in which you downgrade the class from 0604 to 0600 and see it works even without your proposed check inof_pci_make_dev_node()?
I tested this on Linux 6.18.44 with CONFIG_PCI_DYNAMIC_OF_NODES=y. Changing only the class to 0600 still doesn't boot with both OF fixes removed.
pci_is_bridge() checks the header type. I confirmed the class quirk runs by restoring the v2 property checks, which lets it boot and log:
class=060000 header=01 is_bridge=1
I then tried changing both the class to 0600 and the header type to 00. That boots without either OF fix and logs:
class=060000 header=00 is_bridge=0
These changes affect the kernel's cached values. The raw registers still report class 0604 and header 01. With the header override, 00:00.0 no longer gets an OF node; the other bridges still do.
The v2 patch also boots without any device quirk. It keeps the node for 00:00.0 and skips only bus-range and interrupt-map when there is no subordinate bus.
Changing the header type as well made it boot here. I'll send the quirk for 8086:4c43 with both changes. I'll also keep the check in of_pci_make_dev_node() and add an error message before returning when a bridge has no subordinate bus, as you suggested.
Thanks,
Angel J
Ok, here it is...
I tested this quirk on Linux 6.18.44 with CONFIG_PCI_DYNAMIC_OF_NODES=y, and it boots without either OF fix. The diff below omits the test logging.
PCI_FIXUP_HEADER runs after the resources have been parsed using the original header type, and changing hdr_type also affects configuration restore. I don't know enough about this part of PCI to judge whether that's safe, so I'll wait for your advice before submitting it as a patch.
Thanks,
Angel J
drivers/pci/quirks.c +16 -0
@@ -291,6 +291,22 @@ static int __init pci_apply_final_quirks(void) }fs_initcall_sync (pci_apply_final_quirks); +/* +* On the Dell XPS 8940, 8086:4c43 reports a PCI-to-PCI bridge but has no +* downstream bus. Use host-bridge class and a normal header so that +* pci_is_bridge() does not send it through bridge scanning. +*/ +static void quirk_intel_4c43_host_bridge (struct pci_dev *dev) +{ +if ((dev->class >>8 ) !=PCI_CLASS_BRIDGE_PCI || + dev->hdr_type !=PCI_HEADER_TYPE_BRIDGE ) +return ; + + dev->class = (PCI_CLASS_BRIDGE_HOST <<8 ) | (dev->class &0xff ); + dev->hdr_type =PCI_HEADER_TYPE_NORMAL ; +} +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4c43 , quirk_intel_4c43_host_bridge); +/* * Decoding should be disabled for a PCI device during BAR sizing to avoid
* conflict. But doing so may cause problems on host bridge and perhaps other
Hi Angel,
Quoted 9 lines · Angel J
Ok, here it is...
I tested this quirk on Linux 6.18.44 with
CONFIG_PCI_DYNAMIC_OF_NODES=y, and it boots without either OF fix. The diff below omits the test logging.
PCI_FIXUP_HEADERruns after the resources have been parsed using the original header type, and changinghdr_typealso affects configuration restore. I don't know enough about this part of PCI to judge whether that's safe, so I'll wait for your advice before submitting it as a patch.
Thanks you for your submission!
LGTM. Maybe you can play, if you don't already, with pci=realloc,assign-busses kernel cmdline options and writing in remove/rescan under /sys/bus/pci/* (watch out: this could kill your system). But better to ask for opinions from PCI experts.
Thanks,
Andrea
Quoted 32 lines
Thanks,
Angel Jdrivers/pci/quirks.c +16
-0@@ -291,6 +291,22 @@ static int __init pci_apply_final_quirks(void) }fs_initcall_sync (pci_apply_final_quirks); +/* +* On the Dell XPS 8940, 8086:4c43 reports a PCI-to-PCI bridge but has no +* downstream bus. Use host-bridge class and a normal header so that +* pci_is_bridge() does not send it through bridge scanning. +*/ +static void quirk_intel_4c43_host_bridge (struct pci_dev *dev) +{ +if ((dev->class >>8 ) !=PCI_CLASS_BRIDGE_PCI || + dev->hdr_type !=PCI_HEADER_TYPE_BRIDGE ) +return ; + + dev->class = (PCI_CLASS_BRIDGE_HOST <<8 ) | (dev->class &0xff ); + dev->hdr_type =PCI_HEADER_TYPE_NORMAL ; +} +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4c43 , quirk_intel_4c43_host_bridge); +/* * Decoding should be disabled for a PCI device during BAR sizing to avoid * conflict. But doing so may cause problems on host bridge and perhaps other
Quoted 27 lines · Angel J
Ok, here it is...
I tested this quirk on Linux 6.18.44 with
CONFIG_PCI_DYNAMIC_OF_NODES=y, and it boots without either OF fix. The diff below omits the test logging.
PCI_FIXUP_HEADERruns after the resources have been parsed using the original header type, and changinghdr_typealso affects configuration restore. I don't know enough about this part of PCI to judge whether that's safe, so I'll wait for your advice before submitting it as a patch.Thanks,
Angel Jdrivers/pci/quirks.c +5
-0@@ -291,6 +291,22 @@ static int __init pci_apply_final_quirks(void) }fs_initcall_sync (pci_apply_final_quirks); +/* +* On the Dell XPS 8940, 8086:4c43 reports a PCI-to-PCI bridge but has no +* downstream bus. Use host-bridge class and a normal header so that +* pci_is_bridge() does not send it through bridge scanning. +*/
drivers/pci/quirks.c static int __init pci_apply_final_quirks(void) · line 309
Quoted 10 lines
drivers/pci/quirks.c +10
-0+static void quirk_intel_4c43_host_bridge (struct pci_dev *dev) +{ +if ((dev->class >>8 ) !=PCI_CLASS_BRIDGE_PCI || + dev->hdr_type !=PCI_HEADER_TYPE_BRIDGE ) +return ; + + dev->class = (PCI_CLASS_BRIDGE_HOST <<8 ) | (dev->class &0xff ); + dev->hdr_type =PCI_HEADER_TYPE_NORMAL ; +} +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4c43 , quirk_intel_4c43_host_bridge);
I think your of_property patch is better because it removes some assumptions made in the of_pci_make_dev_node() path about what things in the pci_dev are valid. It's quite legal for a device to have a Type 1 header (so pci_is_bridge() is true), but have no pci_bus below it, e.g., a bridge on bus 0 with Secondary Bus Number also being 0.
I don't know what happened in this particular case, whether the Secondary Bus Number and Subordinate Bus Numbers are hard-wired to 0xff or what (per spec, both should be read/write). Maybe the system "lspci -vv" and/or complete dmesg log would have a clue.
But I do think it's better if we don't assume that every pci_dev with a Type 1 header has a pci_bus allocated.
Hi Bjorn, Andrea,
Thanks, that clears it up. I agree the of_property fix is simpler. If a Type 1 device can legitimately have no bus below it, I don't see a reason to change its class or header just to avoid that case.
The v2 patch is already in the thread. Is there anything you'd like me to change?
Thanks,
Angel J
Quoted 56 lines · Bjorn Helgaas
Quoted 27 lines · Angel J
Ok, here it is...
I tested this quirk on Linux 6.18.44 with
CONFIG_PCI_DYNAMIC_OF_NODES=y, and it boots without either OF fix. The diff below omits the test logging.
PCI_FIXUP_HEADERruns after the resources have been parsed using the original header type, and changinghdr_typealso affects configuration restore. I don't know enough about this part of PCI to judge whether that's safe, so I'll wait for your advice before submitting it as a patch.Thanks,
Angel Jdrivers/pci/quirks.c +5
-0@@ -291,6 +291,22 @@ static int __init pci_apply_final_quirks(void) }fs_initcall_sync (pci_apply_final_quirks); +/* +* On the Dell XPS 8940, 8086:4c43 reports a PCI-to-PCI bridge but has no +* downstream bus. Use host-bridge class and a normal header so that +* pci_is_bridge() does not send it through bridge scanning. +*/ drivers/pci/quirks.c static int __init pci_apply_final_quirks(void) · line 309
Quoted 10 lines
drivers/pci/quirks.c +10
-0+static void quirk_intel_4c43_host_bridge (struct pci_dev *dev) +{ +if ((dev->class >>8 ) !=PCI_CLASS_BRIDGE_PCI || + dev->hdr_type !=PCI_HEADER_TYPE_BRIDGE ) +return ; + + dev->class = (PCI_CLASS_BRIDGE_HOST <<8 ) | (dev->class &0xff ); + dev->hdr_type =PCI_HEADER_TYPE_NORMAL ; +} +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4c43 , quirk_intel_4c43_host_bridge);I think your
of_propertypatch is better because it removes some assumptions made in theof_pci_make_dev_node()path about what things in thepci_devare valid. It's quite legal for a device to have a Type 1 header (sopci_is_bridge()is true), but have nopci_busbelow it, e.g., a bridge on bus 0 with Secondary Bus Number also being 0.I don't know what happened in this particular case, whether the Secondary Bus Number and Subordinate Bus Numbers are hard-wired to
0xffor what (per spec, both should be read/write). Maybe the system "lspci -vv" and/or complete dmesg log would have a clue.But I do think it's better if we don't assume that every
pci_devwith a Type 1 header has apci_busallocated.
Quoted 5 lines · Angel J
Hi Bjorn, Andrea,
Thanks, that clears it up. I agree the
of_propertyfix is simpler. If a Type 1 device can legitimately have no bus below it, I don't see a reason to change its class or header just to avoid that case.
Yes. And I suspect this affects more than just the [8086:4c43] device, so I think it will be easier if we don't have to list individual devices for a quirk. I think it's very common to have this kind of bridge for Intel uncore at bridge 0xff or 0x7f.
Quoted 58 lines · Bjorn Helgaas
Quoted 57 lines · Angel J
Quoted 27 lines
Ok, here it is...
I tested this quirk on Linux 6.18.44 with
CONFIG_PCI_DYNAMIC_OF_NODES=y, and it boots without either OF fix. The diff below omits the test logging.
PCI_FIXUP_HEADERruns after the resources have been parsed using the original header type, and changinghdr_typealso affects configuration restore. I don't know enough about this part of PCI to judge whether that's safe, so I'll wait for your advice before submitting it as a patch.Thanks,
Angel Jdrivers/pci/quirks.c +5
-0@@ -291,6 +291,22 @@ static int __init pci_apply_final_quirks(void) }fs_initcall_sync (pci_apply_final_quirks); +/* +* On the Dell XPS 8940, 8086:4c43 reports a PCI-to-PCI bridge but has no +* downstream bus. Use host-bridge class and a normal header so that +* pci_is_bridge() does not send it through bridge scanning. +*/ drivers/pci/quirks.c static int __init pci_apply_final_quirks(void) · line 309
Quoted 10 lines
drivers/pci/quirks.c +10
-0+static void quirk_intel_4c43_host_bridge (struct pci_dev *dev) +{ +if ((dev->class >>8 ) !=PCI_CLASS_BRIDGE_PCI || + dev->hdr_type !=PCI_HEADER_TYPE_BRIDGE ) +return ; + + dev->class = (PCI_CLASS_BRIDGE_HOST <<8 ) | (dev->class &0xff ); + dev->hdr_type =PCI_HEADER_TYPE_NORMAL ; +} +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4c43 , quirk_intel_4c43_host_bridge);I think your
of_propertypatch is better because it removes some assumptions made in theof_pci_make_dev_node()path about what things in thepci_devare valid. It's quite legal for a device to have a Type 1 header (sopci_is_bridge()is true), but have nopci_busbelow it, e.g., a bridge on bus 0 with Secondary Bus Number also being 0.I don't know what happened in this particular case, whether the Secondary Bus Number and Subordinate Bus Numbers are hard-wired to
0xffor what (per spec, both should be read/write). Maybe the system "lspci -vv" and/or complete dmesg log would have a clue.But I do think it's better if we don't assume that every
pci_devwith a Type 1 header has apci_busallocated.
Sasha Levin
maintainerQuoted 2 lines
The v2 patch is already in the thread. Is there anything you'd like me to change?
From the stable side, 6.18 is the only active tree that exposes this hang, and I would rather carry the real fix than a stable only patch for it. Once your v2 is merged, please tag it Cc: stable and it will reach 6.18 through the normal queue.
Signature · 2 lines
Thanks, Sasha