drm/nouveau/vm: make each vma take a reference on its parent vm
authorBen Skeggs <bskeggs@redhat.com>
Mon, 6 May 2013 22:36:33 +0000 (08:36 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 1 Jul 2013 03:45:09 +0000 (13:45 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/subdev/vm/base.c

index 6fc38916353256728244ed36705450bb5819bb8c..34d3fbfbd63196a892af82c98316a84adf5acc06 100644 (file)
@@ -320,7 +320,8 @@ nouveau_vm_get(struct nouveau_vm *vm, u64 size, u32 page_shift,
        }
        mutex_unlock(&nv_subdev(vmm)->mutex);
 
-       vma->vm     = vm;
+       vma->vm = NULL;
+       nouveau_vm_ref(vm, &vma->vm, NULL);
        vma->offset = (u64)vma->node->offset << 12;
        vma->access = access;
        return 0;
@@ -342,6 +343,8 @@ nouveau_vm_put(struct nouveau_vma *vma)
        nouveau_vm_unmap_pgt(vm, vma->node->type != vmm->spg_shift, fpde, lpde);
        nouveau_mm_free(&vm->mm, &vma->node);
        mutex_unlock(&nv_subdev(vmm)->mutex);
+
+       nouveau_vm_ref(NULL, &vma->vm, NULL);
 }
 
 int