Commit 5e075fde authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/mmu: automatically handle "un-bootstrapping" of vmm

Removes the need to expose internals outside of MMU, and GP100 is both
different, and a lot harder to deal with.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 6359c982
...@@ -38,6 +38,8 @@ struct nvkm_vm { ...@@ -38,6 +38,8 @@ struct nvkm_vm {
struct nvkm_vm_pgt *pgt; struct nvkm_vm_pgt *pgt;
u32 fpde; u32 fpde;
u32 lpde; u32 lpde;
bool bootstrapped;
}; };
int nvkm_vm_new(struct nvkm_device *, u64 offset, u64 length, u64 mm_offset, int nvkm_vm_new(struct nvkm_device *, u64 offset, u64 length, u64 mm_offset,
......
...@@ -168,10 +168,7 @@ gf100_bar_dtor(struct nvkm_bar *base) ...@@ -168,10 +168,7 @@ gf100_bar_dtor(struct nvkm_bar *base)
nvkm_gpuobj_del(&bar->bar[1].pgd); nvkm_gpuobj_del(&bar->bar[1].pgd);
nvkm_memory_unref(&bar->bar[1].mem); nvkm_memory_unref(&bar->bar[1].mem);
if (bar->bar[0].vm) { nvkm_vm_ref(NULL, &bar->bar[0].vm, bar->bar[0].pgd);
nvkm_memory_unref(&bar->bar[0].vm->pgt[0].mem[0]);
nvkm_vm_ref(NULL, &bar->bar[0].vm, bar->bar[0].pgd);
}
nvkm_gpuobj_del(&bar->bar[0].pgd); nvkm_gpuobj_del(&bar->bar[0].pgd);
nvkm_memory_unref(&bar->bar[0].mem); nvkm_memory_unref(&bar->bar[0].mem);
return bar; return bar;
......
...@@ -200,10 +200,7 @@ nv50_bar_dtor(struct nvkm_bar *base) ...@@ -200,10 +200,7 @@ nv50_bar_dtor(struct nvkm_bar *base)
nvkm_gpuobj_del(&bar->bar1); nvkm_gpuobj_del(&bar->bar1);
nvkm_vm_ref(NULL, &bar->bar1_vm, bar->pgd); nvkm_vm_ref(NULL, &bar->bar1_vm, bar->pgd);
nvkm_gpuobj_del(&bar->bar2); nvkm_gpuobj_del(&bar->bar2);
if (bar->bar2_vm) { nvkm_vm_ref(NULL, &bar->bar2_vm, bar->pgd);
nvkm_memory_unref(&bar->bar2_vm->pgt[0].mem[0]);
nvkm_vm_ref(NULL, &bar->bar2_vm, bar->pgd);
}
nvkm_gpuobj_del(&bar->pgd); nvkm_gpuobj_del(&bar->pgd);
nvkm_gpuobj_del(&bar->pad); nvkm_gpuobj_del(&bar->pad);
nvkm_gpuobj_del(&bar->mem); nvkm_gpuobj_del(&bar->mem);
......
...@@ -357,6 +357,7 @@ nvkm_vm_boot(struct nvkm_vm *vm, u64 size) ...@@ -357,6 +357,7 @@ nvkm_vm_boot(struct nvkm_vm *vm, u64 size)
vm->pgt[0].refcount[0] = 1; vm->pgt[0].refcount[0] = 1;
vm->pgt[0].mem[0] = pgt; vm->pgt[0].mem[0] = pgt;
nvkm_memory_boot(pgt, vm); nvkm_memory_boot(pgt, vm);
vm->bootstrapped = true;
} }
return ret; return ret;
...@@ -481,6 +482,8 @@ nvkm_vm_ref(struct nvkm_vm *ref, struct nvkm_vm **ptr, struct nvkm_gpuobj *pgd) ...@@ -481,6 +482,8 @@ nvkm_vm_ref(struct nvkm_vm *ref, struct nvkm_vm **ptr, struct nvkm_gpuobj *pgd)
} }
if (*ptr) { if (*ptr) {
if ((*ptr)->bootstrapped && pgd)
nvkm_memory_unref(&(*ptr)->pgt[0].mem[0]);
nvkm_vm_unlink(*ptr, pgd); nvkm_vm_unlink(*ptr, pgd);
kref_put(&(*ptr)->refcount, nvkm_vm_del); kref_put(&(*ptr)->refcount, nvkm_vm_del);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment