Skip to content

Conversation

@yishaih
Copy link
Member

@yishaih yishaih commented Jan 8, 2026

This series adds support for exporting dma-buf file descriptors for both ibv_dm and mlx5dv_devx_uar objects.

This allows PCI device memory to be shared with other kernel subsystems (e.g., graphics or media) or between userspace processes, via the standard dma-buf interface, avoiding unnecessary copies and enabling efficient peer-to-peer (P2P) DMA transfers. See [1] for background on dma-buf.

For that the below APIs were exposed:
ibv_dm_export_dmabuf_fd() - for exporting an fd for ib_dm.
mlx5dv_devx_uar_export_dmabuf_fd() - for exporting an fd for mlx5dv_devx_uar.

Detailed man pages exist as part of the series.

The matching kernel code was sent to rdma-next.

[1] https://docs.kernel.org/driver-api/dma-buf.html

To commit: b665ed7ad7cc ("RDMA/mlx5: Implement DMABUF export ops").

Signed-off-by: Yishai Hadas <[email protected]>
This API exports a dmabuf fd that is associated with a given ibv_dm.

Upon success the returned fd can be used for DMA and RDMA operations
associated with it.

Once the usage has been ended, close() should be called while supplying
the fd. This call will release the resources that were earlier allocated
using the ibv_dm_export_dmabuf_fd() API.

A detailed man page was added as well.

Signed-off-by: Yishai Hadas <[email protected]>
Expose ibv_cmd_export_dmabuf_fd() to be used by drivers to call the
kernel for executing the command.

Signed-off-by: Yishai Hadas <[email protected]>
Add support for DM export DMABUF fd.

Upon the allocation flow of the DM the driver may save the pg_off on its
internal mlx5_dm structure.

This data will be used upon exporting a DMABUF fd for the DM by calling
ibv_cmd_export_dmabuf_fd().

Signed-off-by: Yishai Hadas <[email protected]>
This API exports a dmabuf fd that is associated with a given
mlx5dv_devx_uar.

Upon success the returned fd can be used for DMA and RDMA operations
associated with it.

Once the usage has been ended, close() should be called while supplying
the fd. This call will release the resources that were earlier allocated
using the mlx5dv_devx_uar_export_dmabuf_fd() API.

A detailed man page was added as well.

Signed-off-by: Yishai Hadas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant