Skip to content

PCI: dwc: .cpu_addr_fixup() sketch

Bjorn Helgaas imx linux-arm-kernel linux-devicetree linux-pci lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4PCI: dwc: Move cfg0 setup to dw_pcie_cfg0_setup()drivers/pci/controller/dwc/pcie-designware-host.c+23 -110 replies
2/4PCI: dwc: Delay cfg0 setup until after discovering bridge windowsdrivers/pci/controller/dwc/pcie-designware-host.c+4 -40 replies
3/4PCI: dwc: Look up 'config' addressdrivers/pci/controller/dwc/pcie-designware-host.c drivers/pci/controller/dwc/pcie-designware.h+43 -00 replies
4/4PCI: dwc: Use parent_bus_offsetdrivers/pci/controller/dwc/pcie-designware-host.c drivers/pci/controller/dwc/pcie-designware.c+6 -90 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] PCI: dwc: .cpu_addr_fixup() sketch

From: Bjorn Helgaas <[email protected]>

This is not complete or ready to merge at all. It's just a sketch to see if this approach to moving away from the .cpu_addr_fixup() approach is feasible.

This is based on Frank's series at
https://lore.kernel.org/r/[email protected],
and these apply on top of these patches from that series, which applies on v6.15-rc1:

PCI: dwc: Use resource start as iomap() input in dw_pcie_pme_turn_off()
PCI: dwc: Rename cpu_addr to parent_bus_addr for ATU configuration
PCI: Add parent_bus_offset to resource_entry

The idea is that on some systems the PCI controller lives in a different address space (an "intermediate" address space) than the CPU physical address space. Frank has a beautiful picture of this at
https://lore.kernel.org/r/[email protected]

The devicetree *should* describe the fabric address translation between the CPU and intermediate address spaces, but historically we haven't taken advantage of that and have used .cpu_addr_fixup() functions to convert CPU to intermediate addresses each time we program the ATU.

What I tried to do here was to:

- Try to extract the offset from devicetree using the 'reg' property (this is from Frank's patch at the link above)

- If a .cpu_addr_fixup() function exists, run that as well and compare with the offset from devicetree

- Save the offset in struct dw_pcie_rp and apply that instead of calling .cpu_addr_fixup() in the future

- Emit messages about devicetree offsets that don't match what .cpu_addr_fixup() did, or about .cpu_addr_fixup() methods that are superfluous because they *do* match the devicetree offset

I only looked at the RC side and didn't do anything at all with the EP side.

Bjorn Helgaas (4):
PCI: dwc: Move cfg0 setup to dw_pcie_cfg0_setup()
PCI: dwc: Delay cfg0 setup until after discovering bridge windows
PCI: dwc: Look up 'config' address
PCI: dwc: Use parent_bus_offset

 .../pci/controller/dwc/pcie-designware-host.c | 88 +++++++++++++++----
 drivers/pci/controller/dwc/pcie-designware.c  |  3 -
 drivers/pci/controller/dwc/pcie-designware.h  |  1 +
 3 files changed, 72 insertions(+), 20 deletions(-)
Signature · 1 line
2.34.1