]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h
drm/nouveau/imem: use fast-path for resume restore
[mirror_ubuntu-bionic-kernel.git] / drivers / gpu / drm / nouveau / include / nvkm / subdev / mmu.h
CommitLineData
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 5struct nvkm_gpuobj;
42594600 6struct nvkm_mem;
a11c3198 7
42594600 8struct nvkm_vm_pgt {
d0659d32 9 struct nvkm_memory *mem[2];
3ee01281 10 u32 refcount[2];
a11c3198
BS
11};
12
42594600 13struct nvkm_vm_pgd {
a11c3198 14 struct list_head head;
42594600 15 struct nvkm_gpuobj *obj;
a11c3198 16};
3863c9bc 17
42594600 18struct nvkm_vma {
fd2871af 19 struct list_head head;
2fd3db6f 20 int refcount;
42594600
BS
21 struct nvkm_vm *vm;
22 struct nvkm_mm_node *node;
a11c3198
BS
23 u64 offset;
24 u32 access;
25};
26
42594600
BS
27struct nvkm_vm {
28 struct nvkm_mmu *mmu;
1de68568
BS
29
30 struct mutex mutex;
42594600 31 struct nvkm_mm mm;
e0bacd2f 32 struct kref refcount;
a11c3198
BS
33
34 struct list_head pgd_list;
68f3f702 35 atomic_t engref[NVKM_SUBDEV_NR];
a11c3198 36
42594600 37 struct nvkm_vm_pgt *pgt;
a11c3198
BS
38 u32 fpde;
39 u32 lpde;
3863c9bc
BS
40};
41
42594600 42int nvkm_vm_new(struct nvkm_device *, u64 offset, u64 length, u64 mm_offset,
1de68568 43 struct lock_class_key *, struct nvkm_vm **);
42594600 44int nvkm_vm_ref(struct nvkm_vm *, struct nvkm_vm **, struct nvkm_gpuobj *pgd);
d8e83994 45int nvkm_vm_boot(struct nvkm_vm *, u64 size);
42594600
BS
46int nvkm_vm_get(struct nvkm_vm *, u64 size, u32 page_shift, u32 access,
47 struct nvkm_vma *);
48void nvkm_vm_put(struct nvkm_vma *);
49void nvkm_vm_map(struct nvkm_vma *, struct nvkm_mem *);
50void nvkm_vm_map_at(struct nvkm_vma *, u64 offset, struct nvkm_mem *);
51void nvkm_vm_unmap(struct nvkm_vma *);
52void nvkm_vm_unmap_at(struct nvkm_vma *, u64 offset, u64 length);
c9582455
BS
53
54struct nvkm_mmu {
55 const struct nvkm_mmu_func *func;
56 struct nvkm_subdev subdev;
57
58 u64 limit;
59 u8 dma_bits;
60 u8 lpg_shift;
61};
62
63int nv04_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **);
64int nv41_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **);
65int nv44_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **);
66int nv50_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **);
67int gf100_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **);
a11c3198 68#endif