File Index
Files and directories
Sign in
FILE

nouveau_uvmm.h

File preview with syntax highlighting.

linux-6.19.14/drivers/gpu/drm/nouveau/nouveau_uvmm.h C
 1/* SPDX-License-Identifier: MIT */
 2
 3#ifndef __NOUVEAU_UVMM_H__
 4#define __NOUVEAU_UVMM_H__
 5
 6#include <drm/drm_gpuvm.h>
 7
 8#include "nouveau_drv.h"
 9
10struct nouveau_uvmm {
11	struct drm_gpuvm base;
12	struct nouveau_vmm vmm;
13	struct maple_tree region_mt;
14	struct mutex mutex;
15};
16
17struct nouveau_uvma_region {
18	struct nouveau_uvmm *uvmm;
19
20	struct {
21		u64 addr;
22		u64 range;
23	} va;
24
25	struct kref kref;
26
27	struct completion complete;
28	bool dirty;
29};
30
31struct nouveau_uvma {
32	struct drm_gpuva va;
33
34	struct nouveau_uvma_region *region;
35	u8 kind;
36	u8 page_shift;
37};
38
39#define uvmm_from_gpuvm(x) container_of((x), struct nouveau_uvmm, base)
40#define uvma_from_va(x) container_of((x), struct nouveau_uvma, va)
41
42#define to_uvmm(x) uvmm_from_gpuvm((x)->va.vm)
43
44struct nouveau_uvmm_bind_job {
45	struct nouveau_job base;
46
47	struct kref kref;
48	struct completion complete;
49
50	/* struct bind_job_op */
51	struct list_head ops;
52};
53
54struct nouveau_uvmm_bind_job_args {
55	struct drm_file *file_priv;
56	struct nouveau_sched *sched;
57
58	unsigned int flags;
59
60	struct {
61		struct drm_nouveau_sync *s;
62		u32 count;
63	} in_sync;
64
65	struct {
66		struct drm_nouveau_sync *s;
67		u32 count;
68	} out_sync;
69
70	struct {
71		struct drm_nouveau_vm_bind_op *s;
72		u32 count;
73	} op;
74};
75
76#define to_uvmm_bind_job(job) container_of((job), struct nouveau_uvmm_bind_job, base)
77
78void nouveau_uvmm_fini(struct nouveau_uvmm *uvmm);
79
80void nouveau_uvmm_bo_map_all(struct nouveau_bo *nvbov, struct nouveau_mem *mem);
81void nouveau_uvmm_bo_unmap_all(struct nouveau_bo *nvbo);
82
83int nouveau_uvmm_ioctl_vm_init(struct drm_device *dev, void *data,
84			       struct drm_file *file_priv);
85
86int nouveau_uvmm_ioctl_vm_bind(struct drm_device *dev, void *data,
87			       struct drm_file *file_priv);
88
89static inline void nouveau_uvmm_lock(struct nouveau_uvmm *uvmm)
90{
91	mutex_lock(&uvmm->mutex);
92}
93
94static inline void nouveau_uvmm_unlock(struct nouveau_uvmm *uvmm)
95{
96	mutex_unlock(&uvmm->mutex);
97}
98
99#endif
~/ Read-only file preview.