On Sun, Feb 01, 2026 at 04:34:05PM +0200, Edward Srouji wrote:
From: Yishai Hadas yishaih@nvidia.com
Expose DMABUF functionality to userspace through the uverbs interface, enabling InfiniBand/RDMA devices to export PCI based memory regions (e.g. device memory) as DMABUF file descriptors. This allows zero-copy sharing of RDMA memory with other subsystems that support the dma-buf framework.
A new UVERBS_OBJECT_DMABUF object type and allocation method were introduced.
During allocation, uverbs invokes the driver to supply the rdma_user_mmap_entry associated with the given page offset (pgoff).
Based on the returned rdma_user_mmap_entry, uverbs requests the driver to provide the corresponding physical-memory details as well as the driver’s PCI provider information.
Using this information, dma_buf_export() is called; if it succeeds, uobj->object is set to the underlying file pointer returned by the dma-buf framework.
The file descriptor number follows the standard uverbs allocation flow, but the file pointer comes from the dma-buf subsystem, including its own fops and private data.
When an mmap entry is removed, uverbs iterates over its associated DMABUFs, marks them as revoked, and calls dma_buf_move_notify() so that their importers are notified.
The same procedure applies during the disassociate flow; final cleanup occurs when the application closes the file.
Signed-off-by: Yishai Hadas yishaih@nvidia.com Signed-off-by: Edward Srouji edwards@nvidia.com
When trying to build powerpc:ppc64e_defconfig:
ERROR: modpost: "dma_resv_wait_timeout" [drivers/infiniband/core/ib_core.ko] undefined! ERROR: modpost: "dma_buf_move_notify" [drivers/infiniband/core/ib_core.ko] undefined! ERROR: modpost: "dma_resv_reset_max_fences" [drivers/infiniband/core/ib_core.ko] undefined!
The code now requires CONFIG_DMA_SHARED_BUFFER which is not enabled for this platform.
Guenter
linaro-mm-sig@lists.linaro.org