Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH rdma-next v2 0/2] RDMA: detect and handle CoCo DMA bounce buffering
@ 2026-05-06 11:14 Jiri Pirko
  2026-05-06 11:14 ` [PATCH rdma-next v2 1/2] RDMA/uverbs: expose CoCo DMA bounce requirement to userspace Jiri Pirko
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Jiri Pirko @ 2026-05-06 11:14 UTC (permalink / raw)
  To: linux-rdma
  Cc: jgg, leon, edwards, kees, parav, mbloch, yishaih, lirongqing,
	huangjunxian6, liuy22, jmoroni

From: Jiri Pirko <jiri@nvidia.com>

In Confidential Computing (CoCo) guests, the DMA mapping layer
redirects all device DMA through swiotlb bounce buffers to keep guest
memory encrypted. This is transparent for regular devices because the
CPU copies data between the bounce buffer and the real buffer on every
DMA map/unmap cycle.

RDMA breaks this model. Once a memory region is registered, the device
accesses the underlying pages directly for an extended period without
CPU involvement. The swiotlb layer never gets a chance to synchronize,
so the device operates on bounce buffer memory while the application
works with its own pages - the two never see each other's updates.

This series adds detection and handling of this condition. A new
IB_UVERBS_DEVICE_CC_DMA_BOUNCE flag is exposed in device_cap_flags_ex
so userspace libraries can detect the situation and switch to
dmabuf-based memory registration using "system_cc_shared" heap
where available. Plain __ib_umem_get_va() is made to fail early with
-EOPNOTSUPP to have more specific error code instead of existing -EIO
caused by DMA_ATTR_REQUIRE_COHERENT.

---
See individual patches for changelog.

v1: https://lore.kernel.org/all/20260505061149.2361536-1-jiri@resnulli.us/

based on top of:
https://lore.kernel.org/all/20260504135731.2345383-1-jiri@resnulli.us/

Jiri Pirko (2):
  RDMA/uverbs: expose CoCo DMA bounce requirement to userspace
  RDMA/umem: block plain userspace memory registration under CoCo bounce

 drivers/infiniband/core/device.c     | 6 ++++++
 drivers/infiniband/core/umem.c       | 3 +++
 drivers/infiniband/core/uverbs_cmd.c | 2 ++
 include/rdma/ib_verbs.h              | 3 +++
 include/uapi/rdma/ib_user_verbs.h    | 2 ++
 5 files changed, 16 insertions(+)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-05-12 18:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-06 11:14 [PATCH rdma-next v2 0/2] RDMA: detect and handle CoCo DMA bounce buffering Jiri Pirko
2026-05-06 11:14 ` [PATCH rdma-next v2 1/2] RDMA/uverbs: expose CoCo DMA bounce requirement to userspace Jiri Pirko
2026-05-12 13:03   ` Leon Romanovsky
2026-05-12 14:03     ` Jiri Pirko
2026-05-12 14:05       ` Jason Gunthorpe
2026-05-12 14:08         ` Jiri Pirko
2026-05-12 14:34           ` Jason Gunthorpe
2026-05-12 18:30             ` Jiri Pirko
2026-05-06 11:14 ` [PATCH rdma-next v2 2/2] RDMA/umem: block plain userspace memory registration under CoCo bounce Jiri Pirko
2026-05-12 13:05   ` Leon Romanovsky
2026-05-12 14:04     ` Jiri Pirko
2026-05-06 12:52 ` [PATCH rdma-next v2 0/2] RDMA: detect and handle CoCo DMA bounce buffering Jacob Moroni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox