drm/nouveau/mmu/gf100-: make mmu invalidate function more general
authorBen Skeggs <bskeggs@redhat.com>
Tue, 12 Feb 2019 12:28:13 +0000 (22:28 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 19 Feb 2019 23:00:00 +0000 (09:00 +1000)
Will want to reuse this for fault replay/cancellation swmthds.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgf100.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgp100.c

index e6a02b568c1bd2b681cb5ec911f051ab6b391111..734e58c1b860209aaedca9d8fe64052c2e1090d7 100644 (file)
@@ -186,7 +186,7 @@ int gf100_vmm_join(struct nvkm_vmm *, struct nvkm_memory *);
 void gf100_vmm_part(struct nvkm_vmm *, struct nvkm_memory *);
 int gf100_vmm_aper(enum nvkm_memory_target);
 int gf100_vmm_valid(struct nvkm_vmm *, void *, u32, struct nvkm_vmm_map *);
-void gf100_vmm_flush_(struct nvkm_vmm *, int);
+void gf100_vmm_invalidate(struct nvkm_vmm *, u32 type);
 void gf100_vmm_flush(struct nvkm_vmm *, int);
 
 int gk20a_vmm_aper(enum nvkm_memory_target);
index faf5a7e9265ee0dd112fb7ce904c52511ad4adc1..fc8ef801d0fe52168b54681a4839e287185ab81f 100644 (file)
@@ -178,15 +178,10 @@ gf100_vmm_desc_16_16[] = {
 };
 
 void
-gf100_vmm_flush_(struct nvkm_vmm *vmm, int depth)
+gf100_vmm_invalidate(struct nvkm_vmm *vmm, u32 type)
 {
        struct nvkm_subdev *subdev = &vmm->mmu->subdev;
        struct nvkm_device *device = subdev->device;
-       u32 type = depth << 24;
-
-       type = 0x00000001; /* PAGE_ALL */
-       if (atomic_read(&vmm->engref[NVKM_SUBDEV_BAR]))
-               type |= 0x00000004; /* HUB_ONLY */
 
        mutex_lock(&subdev->mutex);
        /* Looks like maybe a "free flush slots" counter, the
@@ -211,7 +206,10 @@ gf100_vmm_flush_(struct nvkm_vmm *vmm, int depth)
 void
 gf100_vmm_flush(struct nvkm_vmm *vmm, int depth)
 {
-       gf100_vmm_flush_(vmm, 0);
+       u32 type = 0x00000001; /* PAGE_ALL */
+       if (atomic_read(&vmm->engref[NVKM_SUBDEV_BAR]))
+               type |= 0x00000004; /* HUB_ONLY */
+       gf100_vmm_invalidate(vmm, type);
 }
 
 int
index 059fafe0e771a6c38830d8b43a3cd7a5a8812bb8..d44653acca8e8d394aaf7c3a4026fefabb5d59d2 100644 (file)
@@ -309,7 +309,12 @@ gp100_vmm_valid(struct nvkm_vmm *vmm, void *argv, u32 argc,
 void
 gp100_vmm_flush(struct nvkm_vmm *vmm, int depth)
 {
-       gf100_vmm_flush_(vmm, 5 /* CACHE_LEVEL_UP_TO_PDE3 */ - depth);
+       u32 type = (5 /* CACHE_LEVEL_UP_TO_PDE3 */ - depth) << 24;
+       type = 0; /*XXX: need to confirm stuff works with depth enabled... */
+       if (atomic_read(&vmm->engref[NVKM_SUBDEV_BAR]))
+               type |= 0x00000004; /* HUB_ONLY */
+       type |= 0x00000001; /* PAGE_ALL */
+       gf100_vmm_invalidate(vmm, type);
 }
 
 int