[PATCH v4 0/2] PCI: of: update endpoint ranges dynamically
From: Alex Elder
Date: Thu Nov 05 2026 - 16:35:38 EST
This series fixes a bug in PCI devicetree handling code.
If a PCI endpoint function is represented in devicetree, and it
implements a PCI endpoint bus, its ranges property must be created
dynamically. This is because the PCI function's BAR addresses are
assigned during PCI enumeration, and a static ranges property cannot
assume a particular static BAR address matches what was assigned.
The solution is to dynamically generate a ranges property for PCI
functions defined in devicetree that implement a PCI endpoint bus.
-Alex
Note: this series depends on the patch "PCI: of: drop the reg_num
argument to of_pci_set_address()" found in this series:
https://lore.kernel.org/lkml/20261105153801.435566-5-elder@xxxxxxxxxxxx/
The entire series (based on v7.4-rc1 and including that series as
prerequisite) is available here:
https://github.com/riscstar/linux/tree/outgoing/dynamic_ranges-v4
Version 3 is available here:
https://lore.kernel.org/lkml/20260924222444.1351466-1-elder@xxxxxxxxxxxx/
Between version 3 and version 4:
- Dramatically simplified the description in this cover letter. See
earlier versions for a more lengthy explanation.
- Dropped the first patch, which allowed a null pointer for the flags
argument to of_pci_get_addr_flags(). This wasn't really necessary
and didn't really add value.
- Indicated clearly that Andrea della Porta has tested this series on
the Raspberry Pi 5, which uses PCI endpoint bus for its RP1 chip.
The current statically-defined ranges property works for this system,
and when the necessary PCI quirk is enabled, the dynamically generated
ranges property works correctly as well.
Between version 2 and version 3:
- The ranges property for a PCI endpoint with an existing devicetree node
is only updated if its ranges property has an empty value (i.e., it is
"ranges;", or is not defined)
Version 2 is available here:
https://lore.kernel.org/lkml/20260910021919.3421449-1-elder@xxxxxxxxxxxx/
Between version 1 and version 2:
- Included the first patch (which was previously posted in a different
series)
- Modified the last patch so the ranges property is updated only for
PCI endpoints having at least one "pci-ep-bus" node
- Rebased on v7.3-rc2 (and the prerequisite series)
Version 1 is available here:
https://lore.kernel.org/lkml/20260813220717.1394644-1-elder@xxxxxxxxxxxx/
Alex Elder (2):
PCI: of: introduce of_pci_build_prop_ranges()
PCI: of: introduce of_pci_update_endpoint_node_ranges()
drivers/pci/of.c | 97 ++++++++++++++++++++++++++---
drivers/pci/of_property.c | 126 +++++++++++++++++++++++++-------------
drivers/pci/pci.h | 1 +
3 files changed, 173 insertions(+), 51 deletions(-)
base-commit: 8c786803613eb0d3352417509611d1db877c65af
--
2.53.0