Skip to content

BCM2835 DMA mapping cleanups and fixes

Dave Stevenson dmaengine dri-devel linux-arm-kernel linux-devicetree linux-iommu linux-mmc linux-sound linux-spi lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest18 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/18dma-direct: take dma-ranges/offsets into account in resource mappingkernel/dma/direct.c+1 -12 replies
2/18dmaengine: bcm2835: Support common dma-channel-maskdrivers/dma/bcm2835-dma.c+13 -61 reply
3/18ARM: dts: bcm283x: Update to use dma-channel-maskarch/arm/boot/dts/broadcom/bcm2711.dtsi arch/arm/boot/dts/broadcom/bcm2835-common.dtsi+2 -21 reply
4/18dmaengine: bcm2835: move CB info generation into separate functiondrivers/dma/bcm2835-dma.c+32 -181 reply
5/18dmaengine: bcm2835: move CB final extra info generation into functiondrivers/dma/bcm2835-dma.c+28 -61 reply
6/18dmaengine: bcm2835: make address increment platform independentdrivers/dma/bcm2835-dma.c+22 -62 replies
7/18dmaengine: bcm2385: drop info parametersdrivers/dma/bcm2835-dma.c+40 -431 reply
8/18dmaengine: bcm2835: pass dma_chan to generic functionsdrivers/dma/bcm2835-dma.c+14 -102 replies
9/18dmaengine: bcm2835: Add function to handle DMA mappingdrivers/dma/bcm2835-dma.c+38 -82 replies
10/18dmaengine: bcm2835: Add backwards compatible handling until clients updateddrivers/dma/bcm2835-dma.c+16 -20 replies
11/18dmaengine: bcm2835: Use dma_map_resource to map addressesdrivers/dma/bcm2835-dma.c+41 -51 reply
12/18dmaengine: bcm2835: Read ranges if dma-ranges aren't mappeddrivers/dma/bcm2835-dma.c+134 -50 replies
13/18arm: dt: Add dma-ranges to the bcm283x platformsarch/arm/boot/dts/broadcom/bcm2711.dtsi arch/arm/boot/dts/broadcom/bcm2835.dtsi arch/arm/boot/dts/broadcom/bcm2836.dtsi +1 more+16 -51 reply
14/18mmc: bcm2835: Use phys addresses for slave DMA configdrivers/mmc/host/bcm2835.c+3 -140 replies
15/18spi: bcm2835: Use phys addresses for slave DMA configdrivers/spi/spi-bcm2835.c+8 -150 replies
16/18drm/vc4: Use phys addresses for slave DMA configdrivers/gpu/drm/vc4/vc4_hdmi.c+4 -111 reply
17/18ASoC: bcm2835-i2s: Use phys addresses for DAI DMAsound/soc/bcm/bcm2835-i2s.c+4 -140 replies
18/18dmaengine: bcm2835: Revert the workaround for DMA addressesdrivers/dma/bcm2835-dma.c+0 -110 replies

Reviews trailers per patch

2 of 18 patches have a Reviewed-by or Acked-by.

PatchFlorian Fainelli
1/18
2/18
3/18A-b
4/18
5/18
6/18
7/18
8/18
9/18
10/18
11/18
12/18
13/18A-b
14/18
15/18
16/18
17/18
18/18

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/18] BCM2835 DMA mapping cleanups and fixes

Hi All

This series initially cleans up the BCM2835 DMA driver in preparation for supporting the 40bit version. It then fixes up the incorrect mapping behaviour we've had to date.

The cleanups are based on Stefan Wahren's RFC [1], with a couple of minor bugs fixed, but stopping before actually adding the 40bit support. If we can sort the mapping issue, it avoids having to have workarounds in the 40bit support.

The mapping issues were discussed in [2].
Up until this point all DMA users have been passing in dma addresses rather than CPU physical addresses, and the DMA driver has been using those directly rather than using dma_map_resource() to map them.
The DT has also been missing some of the required mappings in "dma-ranges", but they have been present in "ranges". I've therefore duplicated the minimum amount of of_dma_get_range and translate_phys_to_dma to be able to use "ranges" as discussed in that thread. I'm assuming that sort of code is not desirable in the core code as it shouldn't be necessary, so keeping it contained within a driver is the better solution.

When Andrea posted our downstream patches in [3], Robin Murphy stated that dma_map_resource is the correct API, but as it currently doesn't check the dma_range_map we need Sergey Semin's patch [4].
There seemed to be no follow up over the implications of it. I've therefore included it in the series at least for discussion. If it's not acceptable then I'm not sure of the route forward in fixing this mapping issue.

I'm expecting there to be some discussion, but also acknowledge that merging this will need to be phased with the patches 1-13 needing to be merged before any of 14-17, and then 18 merged last to remove the workaround. I suspect that's the least of my worries though.

I will apologise in advance if I don't respond immediately to comments - I'm out of the office for the next week, but do appreciate any feedback.

Thanks
Dave

[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/T/
[2] https://lore.kernel.org/linux-arm-kernel/CAPY8ntBua=wPVUj+SM0WGcUL0fT56uEHo8YZUTMB8Z54X_aPRw@mail.gmail.com/T/
[3] https://lore.kernel.org/lkml/[email protected]/T/
[4] https://lore.kernel.org/linux-iommu/[email protected]/

Dave Stevenson (7):
ARM: dts: bcm283x: Update to use dma-channel-mask
dmaengine: bcm2835: Add function to handle DMA mapping
dmaengine: bcm2835: Add backwards compatible handling until clients
updated
dmaengine: bcm2835: Use dma_map_resource to map addresses
dmaengine: bcm2835: Read ranges if dma-ranges aren't mapped
arm: dt: Add dma-ranges to the bcm283x platforms
dmaengine: bcm2835: Revert the workaround for DMA addresses

Phil Elwell (4):
mmc: bcm2835: Use phys addresses for slave DMA config
spi: bcm2835: Use phys addresses for slave DMA config drm/vc4: Use phys addresses for slave DMA config
ASoC: bcm2835-i2s: Use phys addresses for DAI DMA

Serge Semin (1):
dma-direct: take dma-ranges/offsets into account in resource mapping

Stefan Wahren (6):
dmaengine: bcm2835: Support common dma-channel-mask
dmaengine: bcm2835: move CB info generation into separate function
dmaengine: bcm2835: move CB final extra info generation into function
dmaengine: bcm2835: make address increment platform independent
dmaengine: bcm2385: drop info parameters
dmaengine: bcm2835: pass dma_chan to generic functions

 arch/arm/boot/dts/broadcom/bcm2711.dtsi       |  14 +-
 .../arm/boot/dts/broadcom/bcm2835-common.dtsi |   2 +-
 arch/arm/boot/dts/broadcom/bcm2835.dtsi       |   3 +-
 arch/arm/boot/dts/broadcom/bcm2836.dtsi       |   3 +-
 arch/arm/boot/dts/broadcom/bcm2837.dtsi       |   3 +-
 drivers/dma/bcm2835-dma.c                     | 432 ++++++++++++++----
 drivers/gpu/drm/vc4/vc4_hdmi.c                |  15 +-
 drivers/mmc/host/bcm2835.c                    |  17 +-
 drivers/spi/spi-bcm2835.c                     |  23 +-
 kernel/dma/direct.c                           |   2 +-
 sound/soc/bcm/bcm2835-i2s.c                   |  18 +-
 11 files changed, 383 insertions(+), 149 deletions(-)
Signature · 1 line
2.34.1