]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/nouveau/mmu/gk104,gk20a: implement vmm on top of new base
authorBen Skeggs <bskeggs@redhat.com>
Tue, 31 Oct 2017 17:56:19 +0000 (03:56 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 2 Nov 2017 03:32:26 +0000 (13:32 +1000)
Adds support for:
- Selection of a 64KiB big page size (NvFbBigPage=16).
- System-memory PDs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/Kbuild
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/gk104.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/gk20a.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgk104.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgk20a.c [new file with mode: 0644]

index 908e57a2fc96c5d9b4eb8577d4fded3dc27f7316..e65daffff9bfd640bfca8a1d0a00e9298f102433 100644 (file)
@@ -18,3 +18,5 @@ nvkm-y += nvkm/subdev/mmu/vmmnv41.o
 nvkm-y += nvkm/subdev/mmu/vmmnv44.o
 nvkm-y += nvkm/subdev/mmu/vmmnv50.o
 nvkm-y += nvkm/subdev/mmu/vmmgf100.o
+nvkm-y += nvkm/subdev/mmu/vmmgk104.o
+nvkm-y += nvkm/subdev/mmu/vmmgk20a.o
index 6ab8e636feb13762b610265fbbd48aebcf64772c..1facdab4aa9e6f7f6cf10e1f1a71b78f95e8d97f 100644 (file)
@@ -19,7 +19,9 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  * OTHER DEALINGS IN THE SOFTWARE.
  */
-#include "priv.h"
+#include "vmm.h"
+
+#include <nvif/class.h>
 
 static const struct nvkm_mmu_func
 gk104_mmu = {
@@ -34,6 +36,7 @@ gk104_mmu = {
        .map_sg = gf100_vm_map_sg,
        .unmap = gf100_vm_unmap,
        .flush = gf100_vm_flush,
+       .vmm = {{ -1, -1, NVIF_CLASS_VMM_GF100}, gk104_vmm_new },
 };
 
 int
index 9ea8a91802be130ef4ed8b01a9d9b18a5e9c004e..3d699c35a181b0325eefd7c5a929729f4844c142 100644 (file)
@@ -19,7 +19,9 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  * OTHER DEALINGS IN THE SOFTWARE.
  */
-#include "priv.h"
+#include "vmm.h"
+
+#include <nvif/class.h>
 
 static const struct nvkm_mmu_func
 gk20a_mmu = {
@@ -34,6 +36,7 @@ gk20a_mmu = {
        .map_sg = gf100_vm_map_sg,
        .unmap = gf100_vm_unmap,
        .flush = gf100_vm_flush,
+       .vmm = {{ -1, -1, NVIF_CLASS_VMM_GF100}, gk20a_vmm_new },
 };
 
 int
index 1e207ce3faa8ef11484b0c55ead746922f231630..914ae3f53cca8376ee9ea7e6616ce50a80525294 100644 (file)
@@ -68,6 +68,11 @@ struct nvkm_vmm_desc {
        const struct nvkm_vmm_desc_func *func;
 };
 
+extern const struct nvkm_vmm_desc gk104_vmm_desc_16_12[];
+extern const struct nvkm_vmm_desc gk104_vmm_desc_16_16[];
+extern const struct nvkm_vmm_desc gk104_vmm_desc_17_12[];
+extern const struct nvkm_vmm_desc gk104_vmm_desc_17_17[];
+
 struct nvkm_vmm_page {
        u8 shift;
        const struct nvkm_vmm_desc *desc;
@@ -133,4 +138,8 @@ int g84_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32,
                struct lock_class_key *, const char *, struct nvkm_vmm **);
 int gf100_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32,
                  struct lock_class_key *, const char *, struct nvkm_vmm **);
+int gk104_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32,
+                 struct lock_class_key *, const char *, struct nvkm_vmm **);
+int gk20a_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32,
+                 struct lock_class_key *, const char *, struct nvkm_vmm **);
 #endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgk104.c
new file mode 100644 (file)
index 0000000..0d33700
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2017 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include "vmm.h"
+
+static const struct nvkm_vmm_desc_func
+gk104_vmm_lpt = {
+};
+
+const struct nvkm_vmm_desc
+gk104_vmm_desc_17_12[] = {
+       { SPT, 15, 8, 0x1000, &gf100_vmm_pgt },
+       { PGD, 13, 8, 0x1000, &gf100_vmm_pgd },
+       {}
+};
+
+const struct nvkm_vmm_desc
+gk104_vmm_desc_17_17[] = {
+       { LPT, 10, 8, 0x1000, &gk104_vmm_lpt },
+       { PGD, 13, 8, 0x1000, &gf100_vmm_pgd },
+       {}
+};
+
+const struct nvkm_vmm_desc
+gk104_vmm_desc_16_12[] = {
+       { SPT, 14, 8, 0x1000, &gf100_vmm_pgt },
+       { PGD, 14, 8, 0x1000, &gf100_vmm_pgd },
+       {}
+};
+
+const struct nvkm_vmm_desc
+gk104_vmm_desc_16_16[] = {
+       { LPT, 10, 8, 0x1000, &gk104_vmm_lpt },
+       { PGD, 14, 8, 0x1000, &gf100_vmm_pgd },
+       {}
+};
+
+static const struct nvkm_vmm_func
+gk104_vmm_17 = {
+       .join = gf100_vmm_join,
+       .part = gf100_vmm_part,
+       .page = {
+               { 17, &gk104_vmm_desc_17_17[0], NVKM_VMM_PAGE_xVxC },
+               { 12, &gk104_vmm_desc_17_12[0], NVKM_VMM_PAGE_xVHx },
+               {}
+       }
+};
+
+static const struct nvkm_vmm_func
+gk104_vmm_16 = {
+       .join = gf100_vmm_join,
+       .part = gf100_vmm_part,
+       .page = {
+               { 16, &gk104_vmm_desc_16_16[0], NVKM_VMM_PAGE_xVxC },
+               { 12, &gk104_vmm_desc_16_12[0], NVKM_VMM_PAGE_xVHx },
+               {}
+       }
+};
+
+int
+gk104_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc,
+             struct lock_class_key *key, const char *name,
+             struct nvkm_vmm **pvmm)
+{
+       return gf100_vmm_new_(&gk104_vmm_16, &gk104_vmm_17, mmu, addr,
+                             size, argv, argc, key, name, pvmm);
+}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgk20a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgk20a.c
new file mode 100644 (file)
index 0000000..e000c3d
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2017 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include "vmm.h"
+
+static const struct nvkm_vmm_func
+gk20a_vmm_17 = {
+       .join = gf100_vmm_join,
+       .part = gf100_vmm_part,
+       .page = {
+               { 17, &gk104_vmm_desc_17_17[0], NVKM_VMM_PAGE_xxHC },
+               { 12, &gk104_vmm_desc_17_12[0], NVKM_VMM_PAGE_xxHx },
+               {}
+       }
+};
+
+static const struct nvkm_vmm_func
+gk20a_vmm_16 = {
+       .join = gf100_vmm_join,
+       .part = gf100_vmm_part,
+       .page = {
+               { 16, &gk104_vmm_desc_16_16[0], NVKM_VMM_PAGE_xxHC },
+               { 12, &gk104_vmm_desc_16_12[0], NVKM_VMM_PAGE_xxHx },
+               {}
+       }
+};
+
+int
+gk20a_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc,
+             struct lock_class_key *key, const char *name,
+             struct nvkm_vmm **pvmm)
+{
+       return gf100_vmm_new_(&gk20a_vmm_16, &gk20a_vmm_17, mmu, addr,
+                             size, argv, argc, key, name, pvmm);
+}