]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rust: helpers: Add bindings/wrappers for dma_resv_lock
authorAsahi Lina <lina+kernel@asahilina.net>
Fri, 20 Mar 2026 16:08:26 +0000 (16:08 +0000)
committerDanilo Krummrich <dakr@kernel.org>
Fri, 27 Mar 2026 19:46:56 +0000 (20:46 +0100)
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>
MAINTAINERS
rust/bindings/bindings_helper.h
rust/helpers/dma-resv.c [new file with mode: 0644]
rust/helpers/helpers.c

index 55bf6bf26107c13a63de36eac3e70b731d9a9848..b01791963e25d4f36c651bfa50e9bfbaf20863d0 100644 (file)
@@ -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
index dbb765a9fdbd48d25ccb5f34354e3291d44cf4d5..563863d96d3881a924bda45daa50373eb910cc8e 100644 (file)
@@ -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 (file)
index 0000000..71914d8
--- /dev/null
@@ -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);
+}
index a53929ce52a306628b45c2f84480b8c4e15db91b..b6b20ad2e0e6802ff36081d7a606bd7288d3f4a0 100644 (file)
@@ -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"