Skip to content

of: dma-ranges fixes and improvements

Rob Herring linux-arm-kernel linux-devicetree linux-pci linux-tegra lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest11 patches 24 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11of: Remove unused of_find_matching_node_by_address()drivers/of/address.c include/linux/of_address.h+0 -312 replies
2/11of: Make of_dma_get_range() privatedrivers/of/address.c drivers/of/of_private.h include/linux/of_address.h+11 -92 replies
3/11of: address: Report of_dma_get_range() errors meaningfullydrivers/of/address.c+2 -22 replies
4/11of/unittest: Add dma-ranges address translation testsdrivers/of/unittest-data/testcases.dts drivers/of/unittest-data/tests-address.dtsi drivers/of/unittest.c+141 -00 replies
5/11of: Ratify of_dma_configure() interfacedrivers/of/device.c include/linux/of_device.h+12 -46 replies
6/11of/address: Introduce of_get_next_dma_parent() helperdrivers/of/address.c+10 -01 reply
7/11of: address: Follow DMA parent for "dma-coherent"drivers/of/address.c+1 -10 replies
8/11of: Factor out #{addr,size}-cells parsingdrivers/of/address.c drivers/of/base.c drivers/of/of_private.h+27 -101 reply
9/11of: Make of_dma_get_range() work on bus nodesdrivers/of/address.c+5 -190 replies
10/11of/address: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'drivers/of/address.c+5 -10 replies
11/11of/address: Fix of_pci_range_parser_one translation of DMA addressesdrivers/of/address.c include/linux/of_address.h+13 -30 replies

Reviews trailers per patch

5 of 11 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchGeert UytterhoevenNicolas Saenz JulienneMarek VasutChristoph Hellwig
SeriesT-b R-b T-b
1/11R-b R-b
2/11R-b R-b
3/11R-b R-b
4/11
5/11
6/11R-b
7/11
8/11R-b
9/11
10/11
11/11

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v1 thread

Cover letter [PATCH 00/11] of: dma-ranges fixes and improvements

This series fixes several issues related to 'dma-ranges'. Primarily, 'dma-ranges' in a PCI bridge node does correctly set dma masks for PCI devices not described in the DT. A common case needing dma-ranges is a 32-bit PCIe bridge on a 64-bit system. This affects several platforms including Broadcom, NXP, Renesas, and Arm Juno. There's been several attempts to fix these issues, most recently earlier this week[1].

In the process, I found several bugs in the address translation. It appears that things have happened to work as various DTs happen to use 1:1 addresses.

First 3 patches are just some clean-up. The 4th patch adds a unittest exhibiting the issues. Patches 5-9 rework how of_dma_configure() works making it work on either a struct device child node or a struct device_node parent node so that it works on bus leaf nodes like PCI bridges. Patches 10 and 11 fix 2 issues with address translation for dma-ranges.

My testing on this has been with QEMU virt machine hacked up to set PCI dma-ranges and the unittest. Nicolas reports this series resolves the issues on Rpi4 and NXP Layerscape platforms.

Rob

[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/

Rob Herring (5):
of: Remove unused of_find_matching_node_by_address()
of: Make of_dma_get_range() private
of/unittest: Add dma-ranges address translation tests of/address: Translate 'dma-ranges' for parent nodes missing
'dma-ranges'
of/address: Fix of_pci_range_parser_one translation of DMA addresses

Robin Murphy (6):
of: address: Report of_dma_get_range() errors meaningfully
of: Ratify of_dma_configure() interface of/address: Introduce of_get_next_dma_parent() helper
of: address: Follow DMA parent for "dma-coherent"
of: Factor out #{addr,size}-cells parsing
of: Make of_dma_get_range() work on bus nodes

 drivers/of/address.c                        | 83 +++++++++----------
 drivers/of/base.c                           | 32 ++++---
 drivers/of/device.c                         | 12 ++-
 drivers/of/of_private.h                     | 14 ++++
 drivers/of/unittest-data/testcases.dts      |  1 +
 drivers/of/unittest-data/tests-address.dtsi | 48 +++++++++++
 drivers/of/unittest.c                       | 92 +++++++++++++++++++++
 include/linux/of_address.h                  | 21 +----
 include/linux/of_device.h                   |  4 +-
 9 files changed, 227 insertions(+), 80 deletions(-)
 create mode 100644 drivers/of/unittest-data/tests-address.dtsi

--
2.20.1