1 /* SPDX-License-Identifier: MIT */
3 #ifndef __NOUVEAU_UVMM_H__
4 #define __NOUVEAU_UVMM_H__
6 #include <drm/drm_gpuvm.h>
8 #include "nouveau_drv.h"
11 struct drm_gpuvm base;
12 struct nouveau_vmm vmm;
13 struct maple_tree region_mt;
17 struct nouveau_uvma_region {
18 struct nouveau_uvmm *uvmm;
27 struct completion complete;
34 struct nouveau_uvma_region *region;
38 #define uvmm_from_gpuvm(x) container_of((x), struct nouveau_uvmm, base)
39 #define uvma_from_va(x) container_of((x), struct nouveau_uvma, va)
41 #define to_uvmm(x) uvmm_from_gpuvm((x)->va.vm)
43 struct nouveau_uvmm_bind_job {
44 struct nouveau_job base;
47 struct completion complete;
49 /* struct bind_job_op */
53 struct nouveau_uvmm_bind_job_args {
54 struct drm_file *file_priv;
55 struct nouveau_sched *sched;
60 struct drm_nouveau_sync *s;
65 struct drm_nouveau_sync *s;
70 struct drm_nouveau_vm_bind_op *s;
75 #define to_uvmm_bind_job(job) container_of((job), struct nouveau_uvmm_bind_job, base)
77 void nouveau_uvmm_fini(struct nouveau_uvmm *uvmm);
79 void nouveau_uvmm_bo_map_all(struct nouveau_bo *nvbov, struct nouveau_mem *mem);
80 void nouveau_uvmm_bo_unmap_all(struct nouveau_bo *nvbo);
82 int nouveau_uvmm_ioctl_vm_init(struct drm_device *dev, void *data,
83 struct drm_file *file_priv);
85 int nouveau_uvmm_ioctl_vm_bind(struct drm_device *dev, void *data,
86 struct drm_file *file_priv);
88 static inline void nouveau_uvmm_lock(struct nouveau_uvmm *uvmm)
90 mutex_lock(&uvmm->mutex);
93 static inline void nouveau_uvmm_unlock(struct nouveau_uvmm *uvmm)
95 mutex_unlock(&uvmm->mutex);