diff options
author | Lakshmanan M <lm@nvidia.com> | 2016-08-03 10:55:03 -0400 |
---|---|---|
committer | Terje Bergstrom <tbergstrom@nvidia.com> | 2016-08-10 16:37:47 -0400 |
commit | 394da0f2210ad298b3ecdfddc7ab0c57124cd7d0 (patch) | |
tree | 3cd29ce0f360951236c8644599ece3da97f83d48 /drivers/gpu/nvgpu/gk20a/semaphore_gk20a.c | |
parent | 59a115f3fe6076de4c9af69de836cc82d6430544 (diff) |
gpu: nvgpu: Free the channel used semaphore index
Free the channel used semaphore index during gk20a_free_channel().
Bug 1793819
Change-Id: I4215d05f7f3ba0636e2abb1803011711c8a38301
Signed-off-by: Lakshmanan M <lm@nvidia.com>
Reviewed-on: http://git-master/r/1196877
(cherry picked from commit 2c5720de506caac29629f6a1c578e6da80b1a135)
Reviewed-on: http://git-master/r/1198883
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/semaphore_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/semaphore_gk20a.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/semaphore_gk20a.c b/drivers/gpu/nvgpu/gk20a/semaphore_gk20a.c index d513fa84..396e7419 100644 --- a/drivers/gpu/nvgpu/gk20a/semaphore_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/semaphore_gk20a.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * GK20A Semaphores | 4 | * GK20A Semaphores |
5 | * | 5 | * |
6 | * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. | 6 | * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms and conditions of the GNU General Public License, | 9 | * under the terms and conditions of the GNU General Public License, |
@@ -364,6 +364,27 @@ fail: | |||
364 | } | 364 | } |
365 | 365 | ||
366 | /* | 366 | /* |
367 | * Free the channel used semaphore index | ||
368 | */ | ||
369 | void gk20a_semaphore_free_hw_sema(struct channel_gk20a *ch) | ||
370 | { | ||
371 | struct gk20a_semaphore_pool *p = ch->vm->sema_pool; | ||
372 | |||
373 | BUG_ON(!p); | ||
374 | |||
375 | mutex_lock(&p->pool_lock); | ||
376 | |||
377 | clear_bit(ch->hw_sema->idx, p->semas_alloced); | ||
378 | |||
379 | /* Make sure that when the ch is re-opened it will get a new HW sema. */ | ||
380 | list_del(&ch->hw_sema->hw_sema_list); | ||
381 | kfree(ch->hw_sema); | ||
382 | ch->hw_sema = NULL; | ||
383 | |||
384 | mutex_unlock(&p->pool_lock); | ||
385 | } | ||
386 | |||
387 | /* | ||
367 | * Allocate a semaphore from the passed pool. | 388 | * Allocate a semaphore from the passed pool. |
368 | * | 389 | * |
369 | * Since semaphores are ref-counted there's no explicit free for external code | 390 | * Since semaphores are ref-counted there's no explicit free for external code |
@@ -377,7 +398,7 @@ struct gk20a_semaphore *gk20a_semaphore_alloc(struct channel_gk20a *ch) | |||
377 | if (!ch->hw_sema) { | 398 | if (!ch->hw_sema) { |
378 | ret = __gk20a_init_hw_sema(ch); | 399 | ret = __gk20a_init_hw_sema(ch); |
379 | if (ret) | 400 | if (ret) |
380 | return ERR_PTR(ret); | 401 | return NULL; |
381 | } | 402 | } |
382 | 403 | ||
383 | s = kzalloc(sizeof(*s), GFP_KERNEL); | 404 | s = kzalloc(sizeof(*s), GFP_KERNEL); |