18c2ecf20Sopenharmony_ci#ifndef __NVIF_VMM_H__
28c2ecf20Sopenharmony_ci#define __NVIF_VMM_H__
38c2ecf20Sopenharmony_ci#include <nvif/object.h>
48c2ecf20Sopenharmony_cistruct nvif_mem;
58c2ecf20Sopenharmony_cistruct nvif_mmu;
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_cienum nvif_vmm_get {
88c2ecf20Sopenharmony_ci	ADDR,
98c2ecf20Sopenharmony_ci	PTES,
108c2ecf20Sopenharmony_ci	LAZY
118c2ecf20Sopenharmony_ci};
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_cistruct nvif_vma {
148c2ecf20Sopenharmony_ci	u64 addr;
158c2ecf20Sopenharmony_ci	u64 size;
168c2ecf20Sopenharmony_ci};
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cistruct nvif_vmm {
198c2ecf20Sopenharmony_ci	struct nvif_object object;
208c2ecf20Sopenharmony_ci	u64 start;
218c2ecf20Sopenharmony_ci	u64 limit;
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci	struct {
248c2ecf20Sopenharmony_ci		u8 shift;
258c2ecf20Sopenharmony_ci		bool sparse:1;
268c2ecf20Sopenharmony_ci		bool vram:1;
278c2ecf20Sopenharmony_ci		bool host:1;
288c2ecf20Sopenharmony_ci		bool comp:1;
298c2ecf20Sopenharmony_ci	} *page;
308c2ecf20Sopenharmony_ci	int page_nr;
318c2ecf20Sopenharmony_ci};
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ciint nvif_vmm_ctor(struct nvif_mmu *, const char *name, s32 oclass, bool managed,
348c2ecf20Sopenharmony_ci		  u64 addr, u64 size, void *argv, u32 argc, struct nvif_vmm *);
358c2ecf20Sopenharmony_civoid nvif_vmm_dtor(struct nvif_vmm *);
368c2ecf20Sopenharmony_ciint nvif_vmm_get(struct nvif_vmm *, enum nvif_vmm_get, bool sparse,
378c2ecf20Sopenharmony_ci		 u8 page, u8 align, u64 size, struct nvif_vma *);
388c2ecf20Sopenharmony_civoid nvif_vmm_put(struct nvif_vmm *, struct nvif_vma *);
398c2ecf20Sopenharmony_ciint nvif_vmm_map(struct nvif_vmm *, u64 addr, u64 size, void *argv, u32 argc,
408c2ecf20Sopenharmony_ci		 struct nvif_mem *, u64 offset);
418c2ecf20Sopenharmony_ciint nvif_vmm_unmap(struct nvif_vmm *, u64);
428c2ecf20Sopenharmony_ci#endif
43