Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

RDMA/umem: Add helpers for umem dmabuf revoke lock

Added helpers to acquire and release the umem dmabuf revoke
lock. The intent is to avoid the need for drivers to peek
into the ib_umem_dmabuf internals to get the dma_resv_lock
and bring us one step closer to abstracting ib_umem_dmabuf
away from drivers in general.

Signed-off-by: Jacob Moroni <jmoroni@google.com>
Link: https://patch.msgid.link/20260305170826.3803155-5-jmoroni@google.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>

authored by

Jacob Moroni and committed by
Leon Romanovsky
3a0b1713 ff85a2eb

+20
+16
drivers/infiniband/core/umem_dmabuf.c
··· 334 334 } 335 335 EXPORT_SYMBOL(ib_umem_dmabuf_get_pinned); 336 336 337 + void ib_umem_dmabuf_revoke_lock(struct ib_umem_dmabuf *umem_dmabuf) 338 + { 339 + struct dma_buf *dmabuf = umem_dmabuf->attach->dmabuf; 340 + 341 + dma_resv_lock(dmabuf->resv, NULL); 342 + } 343 + EXPORT_SYMBOL(ib_umem_dmabuf_revoke_lock); 344 + 345 + void ib_umem_dmabuf_revoke_unlock(struct ib_umem_dmabuf *umem_dmabuf) 346 + { 347 + struct dma_buf *dmabuf = umem_dmabuf->attach->dmabuf; 348 + 349 + dma_resv_unlock(dmabuf->resv); 350 + } 351 + EXPORT_SYMBOL(ib_umem_dmabuf_revoke_unlock); 352 + 337 353 void ib_umem_dmabuf_revoke(struct ib_umem_dmabuf *umem_dmabuf) 338 354 { 339 355 struct dma_buf *dmabuf = umem_dmabuf->attach->dmabuf;
+4
include/rdma/ib_umem.h
··· 151 151 int ib_umem_dmabuf_map_pages(struct ib_umem_dmabuf *umem_dmabuf); 152 152 void ib_umem_dmabuf_unmap_pages(struct ib_umem_dmabuf *umem_dmabuf); 153 153 void ib_umem_dmabuf_release(struct ib_umem_dmabuf *umem_dmabuf); 154 + void ib_umem_dmabuf_revoke_lock(struct ib_umem_dmabuf *umem_dmabuf); 155 + void ib_umem_dmabuf_revoke_unlock(struct ib_umem_dmabuf *umem_dmabuf); 154 156 void ib_umem_dmabuf_revoke(struct ib_umem_dmabuf *umem_dmabuf); 155 157 156 158 #else /* CONFIG_INFINIBAND_USER_MEM */ ··· 225 223 } 226 224 static inline void ib_umem_dmabuf_unmap_pages(struct ib_umem_dmabuf *umem_dmabuf) { } 227 225 static inline void ib_umem_dmabuf_release(struct ib_umem_dmabuf *umem_dmabuf) { } 226 + static inline void ib_umem_dmabuf_revoke_lock(struct ib_umem_dmabuf *umem_dmabuf) {} 227 + static inline void ib_umem_dmabuf_revoke_unlock(struct ib_umem_dmabuf *umem_dmabuf) {} 228 228 static inline void ib_umem_dmabuf_revoke(struct ib_umem_dmabuf *umem_dmabuf) {} 229 229 230 230 #endif /* CONFIG_INFINIBAND_USER_MEM */