summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsahi Lina <lina+kernel@asahilina.net>2026-03-20 19:08:26 +0300
committerDanilo Krummrich <dakr@kernel.org>2026-03-27 22:46:56 +0300
commit9b836641d3bfa1ab096ec6263f0fa6880cb9c5ef (patch)
tree6735a7d810e778cf7ca057efdd7634ceb1f0890c
parentbdf6b22fd52954f5ac88689eeaf960ac9687b78c (diff)
downloadlinux-9b836641d3bfa1ab096ec6263f0fa6880cb9c5ef.tar.xz
rust: helpers: Add bindings/wrappers for dma_resv_lock
This is just for basic usage in the DRM shmem abstractions for implied locking, not intended as a full DMA Reservation abstraction yet. Cc: Sumit Semwal <sumit.semwal@linaro.org> Cc: Christian König <christian.koenig@amd.com> Signed-off-by: Asahi Lina <lina+kernel@asahilina.net> Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Janne Grunau <j@jannau.net> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Acked-by: David Airlie <airlied@gmail.com> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Link: https://patch.msgid.link/20260320-gpuvm-rust-v5-2-76fd44f17a87@google.com Signed-off-by: Danilo Krummrich <dakr@kernel.org>
-rw-r--r--MAINTAINERS1
-rw-r--r--rust/bindings/bindings_helper.h1
-rw-r--r--rust/helpers/dma-resv.c14
-rw-r--r--rust/helpers/helpers.c1
4 files changed, 17 insertions, 0 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 55bf6bf26107..b01791963e25 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7534,6 +7534,7 @@ F: include/linux/*fence.h
F: include/linux/dma-buf.h
F: include/linux/dma-buf/
F: include/linux/dma-resv.h
+F: rust/helpers/dma-resv.c
K: \bdma_(?:buf|fence|resv)\b
DMA GENERIC OFFLOAD ENGINE SUBSYSTEM
diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h
index dbb765a9fdbd..563863d96d38 100644
--- a/rust/bindings/bindings_helper.h
+++ b/rust/bindings/bindings_helper.h
@@ -52,6 +52,7 @@
#include <linux/device/faux.h>
#include <linux/dma-direction.h>
#include <linux/dma-mapping.h>
+#include <linux/dma-resv.h>
#include <linux/errname.h>
#include <linux/ethtool.h>
#include <linux/fdtable.h>
diff --git a/rust/helpers/dma-resv.c b/rust/helpers/dma-resv.c
new file mode 100644
index 000000000000..71914d8241e2
--- /dev/null
+++ b/rust/helpers/dma-resv.c
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/dma-resv.h>
+
+__rust_helper
+int rust_helper_dma_resv_lock(struct dma_resv *obj, struct ww_acquire_ctx *ctx)
+{
+ return dma_resv_lock(obj, ctx);
+}
+
+__rust_helper void rust_helper_dma_resv_unlock(struct dma_resv *obj)
+{
+ dma_resv_unlock(obj);
+}
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index a53929ce52a3..b6b20ad2e0e6 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -28,6 +28,7 @@
#include "cred.c"
#include "device.c"
#include "dma.c"
+#include "dma-resv.c"
#include "drm.c"
#include "err.c"
#include "irq.c"