]>
Commit | Line | Data |
---|---|---|
42594600 BS |
1 | #ifndef __NVKM_MMU_H__ |
2 | #define __NVKM_MMU_H__ | |
3863c9bc | 3 | #include <core/subdev.h> |
02a841d4 | 4 | #include <core/mm.h> |
4246b92c | 5 | struct nvkm_gpuobj; |
42594600 | 6 | struct nvkm_mem; |
a11c3198 | 7 | |
42594600 | 8 | struct nvkm_vm_pgt { |
d0659d32 | 9 | struct nvkm_memory *mem[2]; |
3ee01281 | 10 | u32 refcount[2]; |
a11c3198 BS |
11 | }; |
12 | ||
42594600 | 13 | struct nvkm_vm_pgd { |
a11c3198 | 14 | struct list_head head; |
42594600 | 15 | struct nvkm_gpuobj *obj; |
a11c3198 | 16 | }; |
3863c9bc | 17 | |
42594600 | 18 | struct nvkm_vma { |
42594600 BS |
19 | struct nvkm_vm *vm; |
20 | struct nvkm_mm_node *node; | |
9ce523cc BS |
21 | union { |
22 | u64 offset; | |
23 | u64 addr; | |
24 | }; | |
a11c3198 BS |
25 | u32 access; |
26 | }; | |
27 | ||
42594600 BS |
28 | struct nvkm_vm { |
29 | struct nvkm_mmu *mmu; | |
1de68568 BS |
30 | |
31 | struct mutex mutex; | |
42594600 | 32 | struct nvkm_mm mm; |
e0bacd2f | 33 | struct kref refcount; |
a11c3198 BS |
34 | |
35 | struct list_head pgd_list; | |
68f3f702 | 36 | atomic_t engref[NVKM_SUBDEV_NR]; |
a11c3198 | 37 | |
42594600 | 38 | struct nvkm_vm_pgt *pgt; |
a11c3198 BS |
39 | u32 fpde; |
40 | u32 lpde; | |
5e075fde BS |
41 | |
42 | bool bootstrapped; | |
3863c9bc BS |
43 | }; |
44 | ||
42594600 | 45 | int nvkm_vm_new(struct nvkm_device *, u64 offset, u64 length, u64 mm_offset, |
1de68568 | 46 | struct lock_class_key *, struct nvkm_vm **); |
42594600 | 47 | int nvkm_vm_ref(struct nvkm_vm *, struct nvkm_vm **, struct nvkm_gpuobj *pgd); |
d8e83994 | 48 | int nvkm_vm_boot(struct nvkm_vm *, u64 size); |
42594600 BS |
49 | int nvkm_vm_get(struct nvkm_vm *, u64 size, u32 page_shift, u32 access, |
50 | struct nvkm_vma *); | |
51 | void nvkm_vm_put(struct nvkm_vma *); | |
52 | void nvkm_vm_map(struct nvkm_vma *, struct nvkm_mem *); | |
53 | void nvkm_vm_map_at(struct nvkm_vma *, u64 offset, struct nvkm_mem *); | |
54 | void nvkm_vm_unmap(struct nvkm_vma *); | |
55 | void nvkm_vm_unmap_at(struct nvkm_vma *, u64 offset, u64 length); | |
c9582455 BS |
56 | |
57 | struct nvkm_mmu { | |
58 | const struct nvkm_mmu_func *func; | |
59 | struct nvkm_subdev subdev; | |
60 | ||
61 | u64 limit; | |
62 | u8 dma_bits; | |
63 | u8 lpg_shift; | |
0b11b30d BS |
64 | |
65 | struct nvkm_vmm *vmm; | |
c9582455 BS |
66 | }; |
67 | ||
68 | int nv04_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); | |
69 | int nv41_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); | |
70 | int nv44_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); | |
71 | int nv50_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); | |
0f43715f | 72 | int g84_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
c9582455 | 73 | int gf100_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
db018585 | 74 | int gk104_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
d1f6c8d2 | 75 | int gk20a_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
e1e33c79 | 76 | int gm200_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
cedc4d57 | 77 | int gm20b_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
b86a4587 | 78 | int gp100_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
6359c982 | 79 | int gp10b_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
a11c3198 | 80 | #endif |