From: Edward Srouji <edwards@nvidia.com>
To: "Jason Gunthorpe" <jgg@ziepe.ca>,
"Leon Romanovsky" <leon@kernel.org>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Christian König" <christian.koenig@amd.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-rdma@vger.kernel.org>,
<linux-media@vger.kernel.org>, <dri-devel@lists.freedesktop.org>,
<linaro-mm-sig@lists.linaro.org>,
Yishai Hadas <yishaih@nvidia.com>,
"Edward Srouji" <edwards@nvidia.com>
Subject: [PATCH rdma-next v3 0/3] RDMA: Add support for exporting dma-buf file descriptors
Date: Sun, 1 Feb 2026 16:34:03 +0200 [thread overview]
Message-ID: <20260201-dmabuf-export-v3-0-da238b614fe3@nvidia.com> (raw)
This patch series introduces dma-buf export support for RDMA/InfiniBand
devices, enabling userspace applications to export RDMA PCI-backed
memory regions (such as device memory or mlx5 UAR pages) as dma-buf file
descriptors.
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.
As part of this series, we introduce a new uverbs object of type FD for
dma-buf export, along with the corresponding APIs for allocation and
teardown. This object encapsulates all attributes required to export a
dma-buf.
The implementation enforces P2P-only mappings and properly manages
resource lifecycle, including:
- Cleanup during driver removal or RDMA context destruction.
- Revocation via dma_buf_move_notify() when the underlying mmap entries
are removed.
- Refactors common cleanup logic for reuse across FD uobject types.
The infrastructure is generic within uverbs, allowing individual drivers
to easily integrate and supply their vendor-specific implementation.
The mlx5 driver is the first consumer of this new API, providing:
- Initialization of PCI peer-to-peer DMA support.
- mlx5-specific implementations of the mmap_get_pfns and
pgoff_to_mmap_entry device operations required for dma-buf export.
[1] https://docs.kernel.org/driver-api/dma-buf.html
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Signed-off-by: Edward Srouji <edwards@nvidia.com>
---
Changes in v3:
- Wait for importers to complete their unmap() calls after
dma_buf_move_notify(), ensuring all mappings are properly cleaned up
before revocation
- Add unpin callback to pair with pin (both are required by dma-buf ops)
- Link to v2: https://lore.kernel.org/r/20260121-dmabuf-export-v2-0-6381183bcc3d@nvidia.com
Changes in v2:
- Split the FD uobject refactoring into a separate patch
("RDMA: Add support for exporting dma-buf file descriptors")
- Remove redundant revoked check from attach callback. It is checked
during map
- Add pin callback that returns -EOPNOTSUPP to explicitly refuse pinned
importers
- Wait for pending fences after dma_buf_move_notify() using
dma_resv_wait_timeout() to ensure hardware has completed all in-flight
operations before proceeding
- Link to v1: https://lore.kernel.org/r/20260108-dmabuf-export-v1-0-6d47d46580d3@nvidia.com
---
Yishai Hadas (3):
RDMA/uverbs: Support external FD uobjects
RDMA/uverbs: Add DMABUF object type and operations
RDMA/mlx5: Implement DMABUF export ops
drivers/infiniband/core/Makefile | 1 +
drivers/infiniband/core/device.c | 2 +
drivers/infiniband/core/ib_core_uverbs.c | 24 +++
drivers/infiniband/core/rdma_core.c | 63 ++++---
drivers/infiniband/core/rdma_core.h | 1 +
drivers/infiniband/core/uverbs.h | 21 +++
drivers/infiniband/core/uverbs_std_types_dmabuf.c | 200 ++++++++++++++++++++++
drivers/infiniband/core/uverbs_uapi.c | 1 +
drivers/infiniband/hw/mlx5/main.c | 72 ++++++++
include/rdma/ib_verbs.h | 9 +
include/rdma/uverbs_types.h | 1 +
include/uapi/rdma/ib_user_ioctl_cmds.h | 10 ++
12 files changed, 379 insertions(+), 26 deletions(-)
---
base-commit: 325e3b5431ddd27c5f93156b36838a351e3b2f72
change-id: 20260108-dmabuf-export-0d598058dd1e
Best regards,
--
Edward Srouji <edwards@nvidia.com>
next reply other threads:[~2026-02-01 14:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-01 14:34 Edward Srouji [this message]
2026-02-01 14:34 ` [PATCH rdma-next v3 1/3] RDMA/uverbs: Support external FD uobjects Edward Srouji
2026-02-01 14:34 ` [PATCH rdma-next v3 2/3] RDMA/uverbs: Add DMABUF object type and operations Edward Srouji
2026-02-23 4:59 ` Guenter Roeck
2026-02-23 15:28 ` Edward Srouji
2026-02-01 14:34 ` [PATCH rdma-next v3 3/3] RDMA/mlx5: Implement DMABUF export ops Edward Srouji
2026-02-05 12:58 ` [PATCH rdma-next v3 0/3] RDMA: Add support for exporting dma-buf file descriptors Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260201-dmabuf-export-v3-0-da238b614fe3@nvidia.com \
--to=edwards@nvidia.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=yishaih@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®