DMA Engine development
 help / color / mirror / Atom feed
* [PATCH RFC 0/3] dmaengine: Support address bus widths of 32 bytes and above
@ 2026-06-16 15:40 Nuno Sá via B4 Relay
  2026-06-16 15:40 ` [PATCH RFC 1/3] " Nuno Sá via B4 Relay
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Nuno Sá via B4 Relay @ 2026-06-16 15:40 UTC (permalink / raw)
  To: dmaengine, linux-iio
  Cc: Vinod Koul, Frank Li, Lars-Peter Clausen, Jonathan Cameron,
	David Lechner, Andy Shevchenko

The DMA engine slave capabilities advertise the supported source and
destination bus widths in src_addr_widths / dst_addr_widths. These are
plain u32 bitmasks where a set bit's position equals the corresponding
enum dma_slave_buswidth value, e.g. DMA_SLAVE_BUSWIDTH_4_BYTES sets
bit 4.

The consequence is that widths of 32 bytes and above cannot be
represented at all: DMA_SLAVE_BUSWIDTH_32/64/128_BYTES would need bits
32, 64 and 128, which simply do not fit in a u32. Hardware with wider
data paths is becoming common, so we need a representation that can
express these widths while still using enum dma_slave_buswidth.

This series switches the masks to bitmaps that span the full enum
range. Because there are many producers (DMA controllers) and a number
of consumers spread across the tree, converting everything in one go is
not realistic. To allow an incremental migration, the legacy u32 fields
are kept alongside the new bitmaps:

- producers set the bitmap via the new dma_set_{src,dst}_addr_mask()
helpers, which also mirror the low 32 bits back into the legacy u32;
- legacy producers that still assign the u32 directly keep working, and
dma_get_slave_caps() folds such a u32 into the bitmap it returns, so
new consumers always see a complete bitmap;
- consumers can read either the legacy u32 or the new bitmap during the
transition.

The axi-dmac controller and the IIO dmaengine buffer are converted as
examples of a producer and a consumer. And this actually fixes a very
open coded path to undefined behavior in the axi-dmac driver and
possibly others.

The end goal is to convert every producer and consumer, then drop the
legacy u32 src/dst_addr_widths fields and rename the *_mask members.
I cannot commit to a timeline for that conversion (it touches a lot of
drivers across several subsystems), but I do intend to see it through.

Sending as RFC mainly to agree on the approach!

I'm also not sure if the dma_slave_caps_get_{src,dst}_width_min() accessors
are worth having? Their purpose is purely to keep consumers from touching
the representation directly, so that the eventual u32 removal + mask
rename is a no-op for consumers. The alternative is to let consumers use
the bitmap directly (find_first_bit()/test_bit()/etc.) and just delete the
u32 members at the end. I mean, now we do have a bitmask so the _mask
suffix can of makes sense.

This issue was discussed before here:

https://lore.kernel.org/dmaengine/abkoXXbaxaiqbBuX@vaman/

---
Nuno Sá (3):
      dmaengine: Support address bus widths of 32 bytes and above
      dmaengine: dma-axi-dmac: Switch to bitmap-based address width masks
      iio: buffer-dmaengine: Use dma_slave_caps width accessors

 drivers/dma/dma-axi-dmac.c                         |  12 ++-
 drivers/dma/dmaengine.c                            |  18 ++++
 drivers/iio/buffer/industrialio-buffer-dmaengine.c |  15 ++--
 include/linux/dmaengine.h                          | 100 ++++++++++++++++++++-
 4 files changed, 129 insertions(+), 16 deletions(-)
---
base-commit: 7524fe142b5a772f8421aeee2132cf7e21a00103
change-id: 20260615-dmaengine-support-wider-dma-masks-5aac12497e27
--

Thanks!
- Nuno Sá



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

end of thread, other threads:[~2026-06-16 16:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-16 15:40 [PATCH RFC 0/3] dmaengine: Support address bus widths of 32 bytes and above Nuno Sá via B4 Relay
2026-06-16 15:40 ` [PATCH RFC 1/3] " Nuno Sá via B4 Relay
2026-06-16 15:55   ` sashiko-bot
2026-06-16 16:19   ` Frank Li
2026-06-16 15:40 ` [PATCH RFC 2/3] dmaengine: dma-axi-dmac: Switch to bitmap-based address width masks Nuno Sá via B4 Relay
2026-06-16 15:52   ` sashiko-bot
2026-06-16 16:23   ` Frank Li
2026-06-16 15:40 ` [PATCH RFC 3/3] iio: buffer-dmaengine: Use dma_slave_caps width accessors Nuno Sá via B4 Relay
2026-06-16 16:25   ` Frank Li

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