xref: /linux/drivers/gpu/drm/nouveau/include/nvif/vmm.h (revision a4eb44a6435d6d8f9e642407a4a06f65eb90ca04)
1 #ifndef __NVIF_VMM_H__
2 #define __NVIF_VMM_H__
3 #include <nvif/object.h>
4 struct nvif_mem;
5 struct nvif_mmu;
6 
7 enum nvif_vmm_get {
8 	ADDR,
9 	PTES,
10 	LAZY
11 };
12 
13 struct nvif_vma {
14 	u64 addr;
15 	u64 size;
16 };
17 
18 struct nvif_vmm {
19 	struct nvif_object object;
20 	u64 start;
21 	u64 limit;
22 
23 	struct {
24 		u8 shift;
25 		bool sparse:1;
26 		bool vram:1;
27 		bool host:1;
28 		bool comp:1;
29 	} *page;
30 	int page_nr;
31 };
32 
33 int nvif_vmm_ctor(struct nvif_mmu *, const char *name, s32 oclass, bool managed,
34 		  u64 addr, u64 size, void *argv, u32 argc, struct nvif_vmm *);
35 void nvif_vmm_dtor(struct nvif_vmm *);
36 int nvif_vmm_get(struct nvif_vmm *, enum nvif_vmm_get, bool sparse,
37 		 u8 page, u8 align, u64 size, struct nvif_vma *);
38 void nvif_vmm_put(struct nvif_vmm *, struct nvif_vma *);
39 int nvif_vmm_map(struct nvif_vmm *, u64 addr, u64 size, void *argv, u32 argc,
40 		 struct nvif_mem *, u64 offset);
41 int nvif_vmm_unmap(struct nvif_vmm *, u64);
42 #endif
43