Skip to content

Commit

Permalink
rust: helpers: Add bindings/wrappers for dma_resv
Browse files Browse the repository at this point in the history
This is just for basic usage in the DRM shmem abstractions for implied
locking, not intended as a full DMA Reservation abstraction yet.

Signed-off-by: Asahi Lina <[email protected]>
  • Loading branch information
asahilina committed Nov 22, 2023
1 parent 23a2ffd commit 36c9bfe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions rust/bindings/bindings_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <linux/dma-fence.h>
#include <linux/dma-fence-chain.h>
#include <linux/dma-mapping.h>
#include <linux/dma-resv.h>
#include <linux/errname.h>
#include <linux/slab.h>
#include <linux/fs.h>
Expand Down
13 changes: 13 additions & 0 deletions rust/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <linux/dma-fence.h>
#include <linux/dma-fence-chain.h>
#include <linux/dma-mapping.h>
#include <linux/dma-resv.h>
#include <linux/err.h>
#include <linux/errname.h>
#include <linux/instruction_pointer.h>
Expand Down Expand Up @@ -488,6 +489,18 @@ void rust_helper_dma_fence_set_error(struct dma_fence *fence, int error)
}
EXPORT_SYMBOL_GPL(rust_helper_dma_fence_set_error);

int rust_helper_dma_resv_lock(struct dma_resv *obj, struct ww_acquire_ctx *ctx)
{
return dma_resv_lock(obj, ctx);
}
EXPORT_SYMBOL_GPL(rust_helper_dma_resv_lock);

void rust_helper_dma_resv_unlock(struct dma_resv *obj)
{
dma_resv_unlock(obj);
}
EXPORT_SYMBOL_GPL(rust_helper_dma_resv_unlock);

#endif

#ifdef CONFIG_DRM
Expand Down

0 comments on commit 36c9bfe

Please sign in to comment.