summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/include/nvkm
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2017-11-01 03:56:19 +1000
committerBen Skeggs <bskeggs@redhat.com>2017-11-02 13:32:27 +1000
commiteb813999f20097d24310836dfa07a97e2eb0c936 (patch)
tree1e5290cf803d532451e346e833a827a2690e88a5 /drivers/gpu/drm/nouveau/include/nvkm
parentbda9e379f61f937af7ee9b2a32d54bc50a94cd80 (diff)
drm/nouveau/mmu: implement new vmm backend
This is the common code to support a rework of the VMM backends. It adds support for more than 2 levels of page table nesting, which is required to be able to support GP100's MMU layout. Sparse mappings (that don't cause MMU faults when accessed) are now supported, where the backend provides it. Dual-PT handling had to become more sophisticated to support sparse, but this also allows us to support an optimisation the MMU provides on GK104 and newer. Certain operations can now be combined into a single page tree walk to avoid some overhead, but also enables optimsations like skipping PTE unmap writes when the PT will be destroyed anyway. The old backend has been hacked up to forward requests onto the new backend, if present, so that it's possible to bisect between issues in the backend changes vs the upcoming frontend changes. Until the new frontend has been merged, new backends will leak BAR2 page tables on module unload. This is expected, and it's not worth the effort of hacking around this as it doesn't effect runtime. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/include/nvkm')
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h
index eb6704a2fc8f..ccd87d508d04 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h
@@ -1,6 +1,7 @@
#ifndef __NVKM_MMU_H__
#define __NVKM_MMU_H__
#include <core/subdev.h>
+#include <core/memory.h>
#include <core/mm.h>
struct nvkm_gpuobj;
struct nvkm_mem;
@@ -11,6 +12,8 @@ struct nvkm_vm_pgt {
};
struct nvkm_vma {
+ struct nvkm_memory *memory;
+ struct nvkm_tags *tags;
struct nvkm_vm *vm;
struct nvkm_mm_node *node;
union {
@@ -24,6 +27,7 @@ struct nvkm_vm {
const struct nvkm_vmm_func *func;
struct nvkm_mmu *mmu;
const char *name;
+ u32 debug;
struct kref kref;
struct mutex mutex;
@@ -58,6 +62,25 @@ void nvkm_vm_map_at(struct nvkm_vma *, u64 offset, struct nvkm_mem *);
void nvkm_vm_unmap(struct nvkm_vma *);
void nvkm_vm_unmap_at(struct nvkm_vma *, u64 offset, u64 length);
+int nvkm_vmm_boot(struct nvkm_vmm *);
+
+struct nvkm_vmm_map {
+ struct nvkm_memory *memory;
+ u64 offset;
+
+ struct nvkm_mm_node *mem;
+ struct scatterlist *sgl;
+ dma_addr_t *dma;
+ u64 off;
+
+ const struct nvkm_vmm_page *page;
+
+ struct nvkm_tags *tags;
+ u64 next;
+ u64 type;
+ u64 ctag;
+};
+
struct nvkm_mmu {
const struct nvkm_mmu_func *func;
struct nvkm_subdev subdev;