From: Shunsuke Mie <mie@igel.co.jp>
To: Zhu Yanjun <zyjzyj2000@gmail.com>
Cc: "Shunsuke Mie" <mie@igel.co.jp>,
"Christian König" <christian.koenig@amd.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Daniel Vetter" <daniel.vetter@ffwll.ch>,
"Doug Ledford" <dledford@redhat.com>,
"Jason Gunthorpe" <jgg@ziepe.ca>,
"Jianxin Xiong" <jianxin.xiong@intel.com>,
"Leon Romanovsky" <leon@kernel.org>,
"Maor Gottlieb" <maorg@nvidia.com>,
"Sean Hefty" <sean.hefty@intel.com>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-rdma@vger.kernel.org, dhobsong@igel.co.jp, taki@igel.co.jp,
etom@igel.co.jp
Subject: [RFC PATCH v2 1/1] Providers/rxe: Add dma-buf support
Date: Thu, 30 Sep 2021 15:20:14 +0900 [thread overview]
Message-ID: <20210930062014.38200-2-mie@igel.co.jp> (raw)
In-Reply-To: <20210930062014.38200-1-mie@igel.co.jp>
Implement a new provider method for dma-buf base memory registration.
Signed-off-by: Shunsuke Mie <mie@igel.co.jp>
---
providers/rxe/rxe.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/providers/rxe/rxe.c b/providers/rxe/rxe.c
index 3c3ea8bb..84e00e60 100644
--- a/providers/rxe/rxe.c
+++ b/providers/rxe/rxe.c
@@ -239,6 +239,26 @@ static struct ibv_mr *rxe_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
return &vmr->ibv_mr;
}
+static struct ibv_mr *rxe_reg_dmabuf_mr(struct ibv_pd *pd, uint64_t offset,
+ size_t length, uint64_t iova, int fd,
+ int access)
+{
+ struct verbs_mr *vmr;
+ int ret;
+
+ vmr = malloc(sizeof(*vmr));
+ if (!vmr)
+ return NULL;
+
+ ret = ibv_cmd_reg_dmabuf_mr(pd, offset, length, iova, fd, access, vmr);
+ if (ret) {
+ free(vmr);
+ return NULL;
+ }
+
+ return &vmr->ibv_mr;
+}
+
static int rxe_dereg_mr(struct verbs_mr *vmr)
{
int ret;
@@ -1706,6 +1726,7 @@ static const struct verbs_context_ops rxe_ctx_ops = {
.alloc_pd = rxe_alloc_pd,
.dealloc_pd = rxe_dealloc_pd,
.reg_mr = rxe_reg_mr,
+ .reg_dmabuf_mr = rxe_reg_dmabuf_mr,
.dereg_mr = rxe_dereg_mr,
.alloc_mw = rxe_alloc_mw,
.dealloc_mw = rxe_dealloc_mw,
--
2.17.1
next prev parent reply other threads:[~2021-09-30 6:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-30 6:20 [RFC PATCH v2 0/1] Providers/rxe: Add dma-buf support Shunsuke Mie
2021-09-30 6:20 ` Shunsuke Mie [this message]
2021-09-30 6:37 ` [RFC PATCH v2 1/1] " Zhu Yanjun
2021-09-30 6:58 ` Shunsuke Mie
2021-09-30 7:23 ` Zhu Yanjun
2021-09-30 11:06 ` Shunsuke Mie
2021-09-30 11:17 ` Zhu Yanjun
2021-09-30 11:24 ` Shunsuke Mie
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=20210930062014.38200-2-mie@igel.co.jp \
--to=mie@igel.co.jp \
--cc=alexander.deucher@amd.com \
--cc=christian.koenig@amd.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dhobsong@igel.co.jp \
--cc=dledford@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=etom@igel.co.jp \
--cc=jgg@ziepe.ca \
--cc=jianxin.xiong@intel.com \
--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=maorg@nvidia.com \
--cc=sean.hefty@intel.com \
--cc=sumit.semwal@linaro.org \
--cc=taki@igel.co.jp \
--cc=zyjzyj2000@gmail.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