summaryrefslogtreecommitdiff
path: root/rust/helpers
diff options
context:
space:
mode:
authorAsahi Lina <lina+kernel@asahilina.net>2026-03-20 16:08:26 +0000
committerDanilo Krummrich <dakr@kernel.org>2026-03-27 20:46:56 +0100
commit9b836641d3bfa1ab096ec6263f0fa6880cb9c5ef (patch)
tree6735a7d810e778cf7ca057efdd7634ceb1f0890c /rust/helpers
parentbdf6b22fd52954f5ac88689eeaf960ac9687b78c (diff)
downloadlwn-9b836641d3bfa1ab096ec6263f0fa6880cb9c5ef.tar.gz
lwn-9b836641d3bfa1ab096ec6263f0fa6880cb9c5ef.zip
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>
Diffstat (limited to 'rust/helpers')
-rw-r--r--rust/helpers/dma-resv.c14
-rw-r--r--rust/helpers/helpers.c1
2 files changed, 15 insertions, 0 deletions
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"