diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 0b8422a6..ea69d7cb 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -465,21 +465,30 @@ static void gk20a_free_channel(struct channel_gk20a *ch, bool force) | |||
465 | 465 | ||
466 | trace_gk20a_free_channel(ch->chid); | 466 | trace_gk20a_free_channel(ch->chid); |
467 | 467 | ||
468 | /* abort channel and remove from runlist */ | 468 | /* |
469 | if (gk20a_is_channel_marked_as_tsg(ch)) { | 469 | * Disable channel/TSG and unbind here. This should not be executed if |
470 | err = g->ops.fifo.tsg_unbind_channel(ch); | 470 | * HW access is not available during shutdown/removal path as it will |
471 | if (err) | 471 | * trigger a timeout |
472 | nvgpu_err(g, "failed to unbind channel %d from TSG", ch->chid); | 472 | */ |
473 | /* | 473 | if (!nvgpu_is_enabled(g, NVGPU_DRIVER_IS_DYING)) { |
474 | * Channel is not a part of TSG this point onwards | 474 | /* abort channel and remove from runlist */ |
475 | * So stash its status and use it whenever necessary | 475 | if (gk20a_is_channel_marked_as_tsg(ch)) { |
476 | * e.g. while releasing gr_ctx in g->ops.gr.free_channel_ctx() | 476 | err = g->ops.fifo.tsg_unbind_channel(ch); |
477 | */ | 477 | if (err) |
478 | was_tsg = true; | 478 | nvgpu_err(g, |
479 | } else { | 479 | "failed to unbind channel %d from TSG", |
480 | gk20a_disable_channel(ch); | 480 | ch->chid); |
481 | /* | ||
482 | * Channel is not a part of TSG this point onwards | ||
483 | * So stash its status and use it whenever necessary | ||
484 | * e.g. while releasing gr_ctx in | ||
485 | * g->ops.gr.free_channel_ctx() | ||
486 | */ | ||
487 | was_tsg = true; | ||
488 | } else { | ||
489 | gk20a_disable_channel(ch); | ||
490 | } | ||
481 | } | 491 | } |
482 | |||
483 | /* wait until there's only our ref to the channel */ | 492 | /* wait until there's only our ref to the channel */ |
484 | if (!force) | 493 | if (!force) |
485 | gk20a_wait_until_counter_is_N( | 494 | gk20a_wait_until_counter_is_N( |