From 219eb3d26bbcbede22c59e313c797e1854b12f2f Mon Sep 17 00:00:00 2001 From: Arto Merilainen Date: Tue, 6 May 2014 18:05:31 +0300 Subject: gpu: nvgpu: Fixes to static offset mappings This patch addresses two issues in fixes offset mappings: - VA unmapping did not use lists safely. This caused an application hang if the application did not free all (fixed offset) buffers before quiting. - GPU was not powered closing AS node. If the address space had areas that were not freed, the driver tried to access hw without powering it up first. Change-Id: Ida526d222ea4e03b8d765eca16574ddc1823e60d Signed-off-by: Arto Merilainen Reviewed-on: http://git-master/r/405872 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/as_gk20a.c | 4 ++++ drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/gk20a/as_gk20a.c b/drivers/gpu/nvgpu/gk20a/as_gk20a.c index 1d604b83..42fa2167 100644 --- a/drivers/gpu/nvgpu/gk20a/as_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/as_gk20a.c @@ -73,6 +73,7 @@ static int gk20a_as_alloc_share(struct gk20a_as *as, */ int gk20a_as_release_share(struct gk20a_as_share *as_share) { + struct gk20a *g = as_share->vm->mm->g; int err; gk20a_dbg_fn(""); @@ -80,7 +81,10 @@ int gk20a_as_release_share(struct gk20a_as_share *as_share) if (atomic_dec_return(&as_share->ref_cnt) > 0) return 0; + gk20a_busy(g->dev); err = gk20a_vm_release_share(as_share); + gk20a_idle(g->dev); + release_as_share_id(as_share->as, as_share->id); kfree(as_share); return err; diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index d2174f37..624eec94 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c @@ -2350,14 +2350,15 @@ int gk20a_vm_free_space(struct gk20a_as_share *as_share, mutex_lock(&vm->update_gmmu_lock); va_node = addr_to_reservation(vm, args->offset); if (va_node) { - struct mapped_buffer_node *buffer; + struct mapped_buffer_node *buffer, *n; /* there is no need to unallocate the buffers in va. Just * convert them into normal buffers */ - list_for_each_entry(buffer, - &va_node->va_buffers_list, va_buffers_list) + list_for_each_entry_safe(buffer, n, + &va_node->va_buffers_list, va_buffers_list) { list_del_init(&buffer->va_buffers_list); + } list_del(&va_node->reserved_va_list); -- cgit v1.2.2