Skip to content

Commit 72d456a

Browse files
asahilinajannau
authored andcommitted
rust: drm: Add GPUVM Manager abstraction
Signed-off-by: Asahi Lina <[email protected]>
1 parent 5c59860 commit 72d456a

File tree

5 files changed

+706
-0
lines changed

5 files changed

+706
-0
lines changed

rust/bindings/bindings_helper.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88

99
#include <drm/drm_device.h>
1010
#include <drm/drm_drv.h>
11+
#include <drm/drm_exec.h>
1112
#include <drm/drm_file.h>
1213
#include <drm/drm_gem.h>
1314
#include <drm/drm_gem_shmem_helper.h>
15+
#include <drm/drm_gpuvm.h>
1416
#include <drm/drm_ioctl.h>
1517
#include <drm/drm_syncobj.h>
1618
#include <drm/gpu_scheduler.h>
@@ -64,6 +66,8 @@ const gfp_t RUST_CONST_HELPER___GFP_NOWARN = ___GFP_NOWARN;
6466
const blk_features_t RUST_CONST_HELPER_BLK_FEAT_ROTATIONAL = BLK_FEAT_ROTATIONAL;
6567
const fop_flags_t RUST_CONST_HELPER_FOP_UNSIGNED_OFFSET = FOP_UNSIGNED_OFFSET;
6668

69+
const uint32_t BINDINGS_DRM_EXEC_INTERRUPTIBLE_WAIT = DRM_EXEC_INTERRUPTIBLE_WAIT;
70+
6771
const gfp_t BINDINGS_XA_FLAGS_LOCK_IRQ = XA_FLAGS_LOCK_IRQ;
6872
const gfp_t BINDINGS_XA_FLAGS_LOCK_BH = XA_FLAGS_LOCK_BH;
6973
const gfp_t BINDINGS_XA_FLAGS_TRACK_FREE = XA_FLAGS_TRACK_FREE;

rust/helpers/drm_gpuvm.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
3+
#include <drm/drm_gpuvm.h>
4+
5+
#ifdef CONFIG_DRM
6+
#ifdef CONFIG_DRM_GPUVM
7+
8+
struct drm_gpuvm *rust_helper_drm_gpuvm_get(struct drm_gpuvm *obj)
9+
{
10+
return drm_gpuvm_get(obj);
11+
}
12+
13+
void rust_helper_drm_gpuvm_exec_unlock(struct drm_gpuvm_exec *vm_exec)
14+
{
15+
return drm_gpuvm_exec_unlock(vm_exec);
16+
}
17+
18+
void rust_helper_drm_gpuva_init_from_op(struct drm_gpuva *va, struct drm_gpuva_op_map *op)
19+
{
20+
drm_gpuva_init_from_op(va, op);
21+
}
22+
23+
struct drm_gpuvm_bo *rust_helper_drm_gpuvm_bo_get(struct drm_gpuvm_bo *vm_bo)
24+
{
25+
return drm_gpuvm_bo_get(vm_bo);
26+
}
27+
28+
bool rust_helper_drm_gpuvm_is_extobj(struct drm_gpuvm *gpuvm, struct drm_gem_object *obj)
29+
{
30+
return drm_gpuvm_is_extobj(gpuvm, obj);
31+
}
32+
33+
#endif
34+
#endif

rust/helpers/helpers.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "dma-mapping.c"
1717
#include "dma-resv.c"
1818
#include "drm.c"
19+
#include "drm_gpuvm.c"
1920
#include "drm_syncobj.c"
2021
#include "err.c"
2122
#include "io.c"

0 commit comments

Comments
 (0)