]>
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 | 28 | struct nvkm_vm { |
806a7335 | 29 | const struct nvkm_vmm_func *func; |
42594600 | 30 | struct nvkm_mmu *mmu; |
806a7335 BS |
31 | const char *name; |
32 | struct kref kref; | |
1de68568 | 33 | struct mutex mutex; |
806a7335 BS |
34 | |
35 | u64 start; | |
36 | u64 limit; | |
37 | ||
38 | struct nvkm_vmm_pt *pd; | |
39 | u16 pd_offset; | |
40 | struct list_head join; | |
41 | ||
42594600 | 42 | struct nvkm_mm mm; |
e0bacd2f | 43 | struct kref refcount; |
a11c3198 | 44 | struct list_head pgd_list; |
42594600 | 45 | struct nvkm_vm_pgt *pgt; |
a11c3198 BS |
46 | u32 fpde; |
47 | u32 lpde; | |
5e075fde BS |
48 | |
49 | bool bootstrapped; | |
806a7335 | 50 | atomic_t engref[NVKM_SUBDEV_NR]; |
03b0ba7b BS |
51 | |
52 | dma_addr_t null; | |
53 | void *nullp; | |
3863c9bc BS |
54 | }; |
55 | ||
42594600 | 56 | int nvkm_vm_new(struct nvkm_device *, u64 offset, u64 length, u64 mm_offset, |
1de68568 | 57 | struct lock_class_key *, struct nvkm_vm **); |
42594600 | 58 | int nvkm_vm_ref(struct nvkm_vm *, struct nvkm_vm **, struct nvkm_gpuobj *pgd); |
d8e83994 | 59 | int nvkm_vm_boot(struct nvkm_vm *, u64 size); |
42594600 BS |
60 | int nvkm_vm_get(struct nvkm_vm *, u64 size, u32 page_shift, u32 access, |
61 | struct nvkm_vma *); | |
62 | void nvkm_vm_put(struct nvkm_vma *); | |
63 | void nvkm_vm_map(struct nvkm_vma *, struct nvkm_mem *); | |
64 | void nvkm_vm_map_at(struct nvkm_vma *, u64 offset, struct nvkm_mem *); | |
65 | void nvkm_vm_unmap(struct nvkm_vma *); | |
66 | void nvkm_vm_unmap_at(struct nvkm_vma *, u64 offset, u64 length); | |
c9582455 BS |
67 | |
68 | struct nvkm_mmu { | |
69 | const struct nvkm_mmu_func *func; | |
70 | struct nvkm_subdev subdev; | |
71 | ||
72 | u64 limit; | |
73 | u8 dma_bits; | |
74 | u8 lpg_shift; | |
0b11b30d BS |
75 | |
76 | struct nvkm_vmm *vmm; | |
9a45ddaa BS |
77 | |
78 | struct { | |
79 | struct mutex mutex; | |
80 | struct list_head list; | |
f1280394 | 81 | } ptc, ptp; |
c9582455 BS |
82 | }; |
83 | ||
84 | int nv04_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); | |
85 | int nv41_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); | |
86 | int nv44_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); | |
87 | int nv50_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); | |
0f43715f | 88 | int g84_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
c9582455 | 89 | int gf100_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
db018585 | 90 | int gk104_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
d1f6c8d2 | 91 | int gk20a_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
e1e33c79 | 92 | int gm200_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
cedc4d57 | 93 | int gm20b_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
b86a4587 | 94 | int gp100_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
6359c982 | 95 | int gp10b_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
a11c3198 | 96 | #endif |