1#ifndef __NVIF_VMM_H__ 2#define __NVIF_VMM_H__ 3#include <nvif/object.h> 4struct nvif_mem; 5struct nvif_mmu; 6 7enum nvif_vmm_type { 8 UNMANAGED, 9 MANAGED, 10 RAW, 11}; 12 13enum nvif_vmm_get { 14 ADDR, 15 PTES, 16 LAZY 17}; 18 19struct nvif_vma { 20 u64 addr; 21 u64 size; 22}; 23 24struct nvif_vmm { 25 struct nvif_object object; 26 u64 start; 27 u64 limit; 28 29 struct { 30 u8 shift; 31 bool sparse:1; 32 bool vram:1; 33 bool host:1; 34 bool comp:1; 35 } *page; 36 int page_nr; 37}; 38 39int nvif_vmm_ctor(struct nvif_mmu *, const char *name, s32 oclass, 40 enum nvif_vmm_type, u64 addr, u64 size, void *argv, u32 argc, 41 struct nvif_vmm *); 42void nvif_vmm_dtor(struct nvif_vmm *); 43int nvif_vmm_get(struct nvif_vmm *, enum nvif_vmm_get, bool sparse, 44 u8 page, u8 align, u64 size, struct nvif_vma *); 45void nvif_vmm_put(struct nvif_vmm *, struct nvif_vma *); 46int nvif_vmm_map(struct nvif_vmm *, u64 addr, u64 size, void *argv, u32 argc, 47 struct nvif_mem *, u64 offset); 48int nvif_vmm_unmap(struct nvif_vmm *, u64); 49 50int nvif_vmm_raw_get(struct nvif_vmm *vmm, u64 addr, u64 size, u8 shift); 51int nvif_vmm_raw_put(struct nvif_vmm *vmm, u64 addr, u64 size, u8 shift); 52int nvif_vmm_raw_map(struct nvif_vmm *vmm, u64 addr, u64 size, u8 shift, 53 void *argv, u32 argc, struct nvif_mem *mem, u64 offset); 54int nvif_vmm_raw_unmap(struct nvif_vmm *vmm, u64 addr, u64 size, 55 u8 shift, bool sparse); 56int nvif_vmm_raw_sparse(struct nvif_vmm *vmm, u64 addr, u64 size, bool ref); 57#endif 58