1 #ifndef __NVKM_MMU_PRIV_H__
2 #define __NVKM_MMU_PRIV_H__
3 #define nvkm_mmu(p) container_of((p), struct nvkm_mmu, subdev)
4 #include <subdev/mmu.h>
5 
6 void nvkm_mmu_ctor(const struct nvkm_mmu_func *, struct nvkm_device *,
7 		   int index, struct nvkm_mmu *);
8 int nvkm_mmu_new_(const struct nvkm_mmu_func *, struct nvkm_device *,
9 		  int index, struct nvkm_mmu **);
10 
11 struct nvkm_mmu_func {
12 	void *(*dtor)(struct nvkm_mmu *);
13 	int (*oneinit)(struct nvkm_mmu *);
14 	void (*init)(struct nvkm_mmu *);
15 
16 	u64 limit;
17 	u8  dma_bits;
18 	u32 pgt_bits;
19 	u8  spg_shift;
20 	u8  lpg_shift;
21 
22 	int  (*create)(struct nvkm_mmu *, u64 offset, u64 length, u64 mm_offset,
23 		       struct lock_class_key *, struct nvkm_vm **);
24 
25 	void (*map_pgt)(struct nvkm_gpuobj *pgd, u32 pde,
26 			struct nvkm_memory *pgt[2]);
27 	void (*map)(struct nvkm_vma *, struct nvkm_memory *,
28 		    struct nvkm_mem *, u32 pte, u32 cnt,
29 		    u64 phys, u64 delta);
30 	void (*map_sg)(struct nvkm_vma *, struct nvkm_memory *,
31 		       struct nvkm_mem *, u32 pte, u32 cnt, dma_addr_t *);
32 	void (*unmap)(struct nvkm_vma *, struct nvkm_memory *pgt,
33 		      u32 pte, u32 cnt);
34 	void (*flush)(struct nvkm_vm *);
35 };
36 
37 int nvkm_vm_create(struct nvkm_mmu *, u64, u64, u64, u32,
38 		   struct lock_class_key *, struct nvkm_vm **);
39 #endif
40