summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/common/mm/vm.c5
-rw-r--r--drivers/gpu/nvgpu/common/mm/vm_area.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/vm.c b/drivers/gpu/nvgpu/common/mm/vm.c
index 13fd641e..3d9dd174 100644
--- a/drivers/gpu/nvgpu/common/mm/vm.c
+++ b/drivers/gpu/nvgpu/common/mm/vm.c
@@ -1094,6 +1094,11 @@ static void __nvgpu_vm_unmap(struct nvgpu_mapped_buf *mapped_buffer,
1094 nvgpu_kfree(g, mapped_buffer); 1094 nvgpu_kfree(g, mapped_buffer);
1095} 1095}
1096 1096
1097/*
1098 * Note: the update_gmmu_lock of the VM that owns this buffer must be locked
1099 * before calling nvgpu_ref_put() with this function as the unref function
1100 * argument since this can modify the tree of maps.
1101 */
1097void __nvgpu_vm_unmap_ref(struct nvgpu_ref *ref) 1102void __nvgpu_vm_unmap_ref(struct nvgpu_ref *ref)
1098{ 1103{
1099 struct nvgpu_mapped_buf *mapped_buffer = 1104 struct nvgpu_mapped_buf *mapped_buffer =
diff --git a/drivers/gpu/nvgpu/common/mm/vm_area.c b/drivers/gpu/nvgpu/common/mm/vm_area.c
index 663d8999..5d3b0526 100644
--- a/drivers/gpu/nvgpu/common/mm/vm_area.c
+++ b/drivers/gpu/nvgpu/common/mm/vm_area.c
@@ -199,7 +199,6 @@ int nvgpu_vm_area_free(struct vm_gk20a *vm, u64 addr)
199 return 0; 199 return 0;
200 } 200 }
201 nvgpu_list_del(&vm_area->vm_area_list); 201 nvgpu_list_del(&vm_area->vm_area_list);
202 nvgpu_mutex_release(&vm->update_gmmu_lock);
203 202
204 nvgpu_log(g, gpu_dbg_map, 203 nvgpu_log(g, gpu_dbg_map,
205 "DEL vm_area: pgsz=%#-8x pages=%-9llu " 204 "DEL vm_area: pgsz=%#-8x pages=%-9llu "
@@ -219,6 +218,8 @@ int nvgpu_vm_area_free(struct vm_gk20a *vm, u64 addr)
219 nvgpu_ref_put(&buffer->ref, __nvgpu_vm_unmap_ref); 218 nvgpu_ref_put(&buffer->ref, __nvgpu_vm_unmap_ref);
220 } 219 }
221 220
221 nvgpu_mutex_release(&vm->update_gmmu_lock);
222
222 /* if this was a sparse mapping, free the va */ 223 /* if this was a sparse mapping, free the va */
223 if (vm_area->sparse) 224 if (vm_area->sparse)
224 g->ops.mm.gmmu_unmap(vm, 225 g->ops.mm.gmmu_unmap(vm,