From 510cf2d2f39a4776db4cd162c7e7525dbe17c3eb Mon Sep 17 00:00:00 2001 From: Sachit Kadle Date: Thu, 25 Aug 2016 17:15:32 -0700 Subject: gpu: nvpgu: free hw_sema before as binding Free the hw_sema before releasing a channel's address space binding when freeing a channel. Since the semaphore pool can be freed after releasing the address space, we need to do this earlier on. Bug 1795076 Change-Id: Ic8ae7510af7be862feb6694130c6ce8fc0b8e411 Signed-off-by: Sachit Kadle Reviewed-on: http://git-master/r/1208071 (cherry picked from commit 82a52fb6789b1c9361c1567f082ca36135287294) Reviewed-on: http://git-master/r/1209165 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 79d449e6..795c7910 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -951,6 +951,14 @@ static void gk20a_free_channel(struct channel_gk20a *ch) } mutex_unlock(&ch->sync_lock); + /* + * free the channel used semaphore index. + * we need to do this before releasing the address space, + * as the semaphore pool might get freed after that point. + */ + if (ch->hw_sema) + gk20a_semaphore_free_hw_sema(ch); + /* release channel binding to the as_share */ if (ch_vm->as_share) gk20a_as_release_share(ch_vm->as_share); @@ -974,10 +982,6 @@ unbind: g->ops.fifo.unbind_channel(ch); g->ops.fifo.free_inst(g, ch); - /* free the channel used semaphore index */ - if (ch->hw_sema) - gk20a_semaphore_free_hw_sema(ch); - ch->vpr = false; ch->vm = NULL; -- cgit v1.2.2