drm/nouveau/mmu/gf100-: make mmu invalidate function more general

Will want to reuse this for fault replay/cancellation swmthds.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
Ben Skeggs 2019-02-12 22:28:13 +10:00
parent 8e44b987e8
commit 874c1b56f3
3 changed files with 12 additions and 9 deletions

View 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 *); void gf100_vmm_part(struct nvkm_vmm *, struct nvkm_memory *);
int gf100_vmm_aper(enum nvkm_memory_target); int gf100_vmm_aper(enum nvkm_memory_target);
int gf100_vmm_valid(struct nvkm_vmm *, void *, u32, struct nvkm_vmm_map *); 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); void gf100_vmm_flush(struct nvkm_vmm *, int);
int gk20a_vmm_aper(enum nvkm_memory_target); int gk20a_vmm_aper(enum nvkm_memory_target);

View File

@ -178,15 +178,10 @@ gf100_vmm_desc_16_16[] = {
}; };
void 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_subdev *subdev = &vmm->mmu->subdev;
struct nvkm_device *device = subdev->device; 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); mutex_lock(&subdev->mutex);
/* Looks like maybe a "free flush slots" counter, the /* Looks like maybe a "free flush slots" counter, the
@ -211,7 +206,10 @@ gf100_vmm_flush_(struct nvkm_vmm *vmm, int depth)
void void
gf100_vmm_flush(struct nvkm_vmm *vmm, int depth) 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 int

View File

@ -309,7 +309,12 @@ gp100_vmm_valid(struct nvkm_vmm *vmm, void *argv, u32 argc,
void void
gp100_vmm_flush(struct nvkm_vmm *vmm, int depth) 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 int