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