Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH 0/2] PCI: of: update endpoint ranges dynamically
@ 2026-08-13 22:07 Alex Elder
  2026-08-13 22:07 ` [PATCH 1/2] PCI: of: introduce of_pci_build_prop_ranges() Alex Elder
  2026-08-13 22:07 ` [PATCH 2/2] PCI: of: introduce of_pci_update_endpoint_node_ranges() Alex Elder
  0 siblings, 2 replies; 3+ messages in thread
From: Alex Elder @ 2026-08-13 22:07 UTC (permalink / raw)
  To: bhelgaas
  Cc: lizhi.hou, herve.codina, andrea.porta, daniel, mohdayaa, lbiancon,
	mani, robh, linux-pci, linux-kernel

A PCI endpoint bus is a devicetree construct that allows a PCI
endpoint (function) to have sub-devices defined that are accessible
in an SoC via the PCI endpoint's BARs.  Such a bus is represented as
a devicetree sub-node for a PCI function having the name "pci-ep-bus".
There can be one or more pci-ep-bus nodes.

A PCI function with a pci-ep-bus devicetree node must also define
"#address-cells", "#size-cells", and "ranges" properties, to specify
how endpoint bus addresses are translated to the PCI parent bus.

An endpoint bus address has three cells; the first indicates which of
the function's BARs the address is associated with, and the other two
specify a 64-bit (2 cell) offset within the BAR's region.

BAR base addresses are determined dynamically by the PCI enumeration
process, so generally it's not possible to include them in a static
devicetree file.  When this addressing scheme was introduced, this
was not a problem because the devicetree content was generated
dynamically--after booting--based on the information (including BAR
addresses) available following PCI enumeration.

It is possible (and in some cases, necessary) to define the devicetree
nodes that represent PCI devices ahead of time, in a statically-defined
devicetree file.  In order to support the PCI endpoint bus model in this
case it is necessary to dynamically update the static devicetree so that
the BAR base addresses assigned during enumeration are reflected in the
endpoint's "ranges" property.

This series implements that dynamic update, leveraging the same code
used to create the "ranges" property when PCI_DYNAMIC_OF_NODES is
enabled.  The first patch separates the code that dynamically builds
the property value into a helper function, and the second arranges for
even statically-defined devicetree nodes to have the "ranges" property
updated.

					-Alex

Note: this series is built upon these patches:
  https://lore.kernel.org/lkml/20260812172247.276554-5-elder@riscstar.com/

Alex Elder (2):
  PCI: of: introduce of_pci_build_prop_ranges()
  PCI: of: introduce of_pci_update_endpoint_node_ranges()

 drivers/pci/of.c          |  59 ++++++++++++++---
 drivers/pci/of_property.c | 129 +++++++++++++++++++++++++-------------
 drivers/pci/pci.h         |   1 +
 3 files changed, 139 insertions(+), 50 deletions(-)


base-commit: cb0a459e8259a695f4c2d179534b931399e6847f
-- 
2.53.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-13 22:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-13 22:07 [PATCH 0/2] PCI: of: update endpoint ranges dynamically Alex Elder
2026-08-13 22:07 ` [PATCH 1/2] PCI: of: introduce of_pci_build_prop_ranges() Alex Elder
2026-08-13 22:07 ` [PATCH 2/2] PCI: of: introduce of_pci_update_endpoint_node_ranges() Alex Elder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox