Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: linux-rdma@vger.kernel.org
Cc: jgg@ziepe.ca, leon@kernel.org, edwards@nvidia.com,
	kees@kernel.org, parav@nvidia.com, mbloch@nvidia.com,
	yishaih@nvidia.com, lirongqing@baidu.com,
	huangjunxian6@hisilicon.com, liuy22@mails.tsinghua.edu.cn
Subject: [PATCH rdma-next 2/2] RDMA/umem: block plain userspace memory registration under CoCo bounce
Date: Tue,  5 May 2026 08:11:49 +0200	[thread overview]
Message-ID: <20260505061149.2361536-3-jiri@resnulli.us> (raw)
In-Reply-To: <20260505061149.2361536-1-jiri@resnulli.us>

From: Jiri Pirko <jiri@nvidia.com>

When a device requires DMA bounce buffering inside a Confidential
Computing guest, __ib_umem_get_va() cannot work. The DMA mapping layer
redirects all mappings through swiotlb bounce buffers, so the device
receives DMA addresses pointing to bounce buffer memory rather than
the user's pages. Since RDMA devices access registered memory directly
without CPU involvement, there is no opportunity for swiotlb to
synchronize between the bounce buffer and the original pages.

Fail early with -EOPNOTSUPP to let the user know instead of a silent
misfunction.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
 drivers/infiniband/core/umem.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index 611d693eb9a2..b1877b83b021 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -167,6 +167,9 @@ static struct ib_umem *__ib_umem_get_va(struct ib_device *device,
 	int pinned, ret;
 	unsigned int gup_flags = FOLL_LONGTERM;
 
+	if (device->cc_dma_bounce)
+		return ERR_PTR(-EOPNOTSUPP);
+
 	/*
 	 * If the combination of the addr and size requested for this memory
 	 * region causes an integer overflow, return error.
-- 
2.53.0


  parent reply	other threads:[~2026-05-05  6:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-05  6:11 [PATCH rdma-next 0/2] RDMA: detect and handle CoCo DMA bounce buffering Jiri Pirko
2026-05-05  6:11 ` [PATCH rdma-next 1/2] RDMA/uverbs: expose CoCo DMA bounce requirement to userspace Jiri Pirko
2026-05-05  6:11 ` Jiri Pirko [this message]
2026-05-05 13:20   ` [PATCH rdma-next 2/2] RDMA/umem: block plain userspace memory registration under CoCo bounce Jacob Moroni
2026-05-05 16:02     ` Jason Gunthorpe
2026-05-05 18:17       ` Jacob Moroni
2026-05-06  9:20         ` Jiri Pirko
2026-05-06  9:17       ` Jiri Pirko
2026-05-06  9:25       ` Jiri Pirko
2026-05-06  9:49         ` Jason Gunthorpe
2026-05-06 10:54           ` Jiri Pirko
2026-05-06 13:39             ` Jacob Moroni
2026-05-06 14:54               ` Jiri Pirko

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=20260505061149.2361536-3-jiri@resnulli.us \
    --to=jiri@resnulli.us \
    --cc=edwards@nvidia.com \
    --cc=huangjunxian6@hisilicon.com \
    --cc=jgg@ziepe.ca \
    --cc=kees@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=lirongqing@baidu.com \
    --cc=liuy22@mails.tsinghua.edu.cn \
    --cc=mbloch@nvidia.com \
    --cc=parav@nvidia.com \
    --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