public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] uio/dma-buf: Give UIO users access to DMA addresses.
@ 2025-04-10 14:53 Bastien Curutchet
  2025-04-10 14:53 ` [PATCH 1/3] dma-buf: Allow heap that doesn't provide map_buf/unmap_buf Bastien Curutchet
                   ` (4 more replies)
  0 siblings, 5 replies; 24+ messages in thread
From: Bastien Curutchet @ 2025-04-10 14:53 UTC (permalink / raw)
  To: Sumit Semwal, Christian König, Greg Kroah-Hartman
  Cc: Thomas Petazzoni, linux-media, dri-devel, linaro-mm-sig,
	linux-kernel, Bastien Curutchet

Hi all,

Many UIO users performing DMA from their UIO device need to access the
DMA addresses of the allocated buffers. There are out-of-tree drivers
that allow to do it but nothing in the mainline.

I know DMA shouldn't be handled by userspace but, IMHO, since UIO
drivers exist, it would be better if they offered a way of doing this.

This patch series use the dma-heap framework which already allows
userspace to allocate DMA buffers. I tried to avoid 'polluting' the
existing heaps to prevent inappropriate uses of this new feature by
introducing a new UIO heap, which is the only one implementing this
behavior.

PATCH 1 allows the creation of heaps that don't implement map/unmap_buf
operations as UIO heap doesn't use them.
PATCH 2 adds the DMA_BUF_IOCTL_GET_DMA_ADDR which transmits the DMA
addresses to userspace.
PATCH 3 implements the UIO heap.

It has been tested with the uio_pci_generic driver on a PowerPC.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
---
Bastien Curutchet (3):
      dma-buf: Allow heap that doesn't provide map_buf/unmap_buf
      dma-buf: Add DMA_BUF_IOCTL_GET_DMA_ADDR
      uio: Add UIO_DMABUF_HEAP

 drivers/dma-buf/dma-buf.c    |  29 +++++++++--
 drivers/uio/Kconfig          |   9 ++++
 drivers/uio/Makefile         |   1 +
 drivers/uio/uio.c            |   4 ++
 drivers/uio/uio_heap.c       | 120 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/dma-buf.h      |   1 +
 include/linux/uio_driver.h   |   2 +
 include/uapi/linux/dma-buf.h |   1 +
 8 files changed, 164 insertions(+), 3 deletions(-)
---
base-commit: 5f13fa25acaa4f586aaed12efcf7436e004eeaf2
change-id: 20250408-uio-dma-9b011e9e7f0b

Best regards,
-- 
Bastien Curutchet <bastien.curutchet@bootlin.com>


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

end of thread, other threads:[~2025-04-29  8:12 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-10 14:53 [PATCH 0/3] uio/dma-buf: Give UIO users access to DMA addresses Bastien Curutchet
2025-04-10 14:53 ` [PATCH 1/3] dma-buf: Allow heap that doesn't provide map_buf/unmap_buf Bastien Curutchet
2025-04-10 14:53 ` [PATCH 2/3] dma-buf: Add DMA_BUF_IOCTL_GET_DMA_ADDR Bastien Curutchet
2025-04-11 18:34   ` Nicolas Dufresne
2025-04-29  6:39     ` Simona Vetter
2025-04-29  8:12       ` Christian König
2025-04-10 14:53 ` [PATCH 3/3] uio: Add UIO_DMABUF_HEAP Bastien Curutchet
2025-04-11 18:41   ` Nicolas Dufresne
2025-04-10 16:29 ` [PATCH 0/3] uio/dma-buf: Give UIO users access to DMA addresses Christian König
2025-04-10 19:43   ` Thomas Petazzoni
     [not found]     ` <b596c9af-c0e3-4557-b45a-462a33179235@amd.com>
2025-04-11  8:14       ` Bastien Curutchet
2025-04-11 12:41         ` Christian König
2025-04-14  8:17           ` Thomas Petazzoni
2025-04-14  8:59             ` Christian König
2025-04-14  5:55 ` Christoph Hellwig
2025-04-14  8:24   ` Thomas Petazzoni
2025-04-14  9:11     ` Christian König
2025-04-14 11:52       ` Thomas Petazzoni
2025-04-14 11:24     ` Christoph Hellwig
2025-04-14 11:48       ` Thomas Petazzoni
2025-04-14 17:08         ` Andrew Davis
2025-04-14 19:21           ` Thomas Petazzoni
2025-04-14 20:13             ` Andrew Davis
2025-04-22 18:16             ` Jason Gunthorpe

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