From f78918fd6c34cf7c73fd8dc98408a33bdd55ad1b Mon Sep 17 00:00:00 2001 From: Seema Khowala Date: Wed, 17 Oct 2018 14:23:38 -0700 Subject: gpu: nvgpu: do not suspend/resume recovered channel Already torn down channels should not be suspended or resumed. A channel reference could still be available even if it is recovered but not closed. Use ch_timedout status to check if channel is already recovered/aborted. Bug 2404865 Change-Id: I718eab6032ee94a9322da7a239a978b388de2b01 Signed-off-by: Seema Khowala Reviewed-on: https://git-master.nvidia.com/r/1929338 Signed-off-by: Debarshi Dutta (cherry picked from commit 88cff206ae31999240945a870683e8a10be584d7 in dev-kernel) Reviewed-on: https://git-master.nvidia.com/r/2016994 GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: Bibek Basu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/fifo/channel.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'drivers/gpu/nvgpu') diff --git a/drivers/gpu/nvgpu/common/fifo/channel.c b/drivers/gpu/nvgpu/common/fifo/channel.c index b5ae42d4..2ada3911 100644 --- a/drivers/gpu/nvgpu/common/fifo/channel.c +++ b/drivers/gpu/nvgpu/common/fifo/channel.c @@ -2291,7 +2291,13 @@ int gk20a_channel_suspend(struct gk20a *g) for (chid = 0; chid < f->num_channels; chid++) { struct channel_gk20a *ch = gk20a_channel_from_id(g, chid); - if (ch != NULL) { + if (ch == NULL) { + continue; + } + if (gk20a_channel_check_timedout(ch)) { + nvgpu_log_info(g, "do not suspend recovered " + "channel %d", chid); + } else { nvgpu_log_info(g, "suspend channel %d", chid); /* disable channel */ gk20a_disable_channel_tsg(g, ch); @@ -2304,10 +2310,9 @@ int gk20a_channel_suspend(struct gk20a *g) channels_in_use = true; - active_runlist_ids |= BIT(ch->runlist_id); - - gk20a_channel_put(ch); + active_runlist_ids |= (u32) BIT64(ch->runlist_id); } + gk20a_channel_put(ch); } if (channels_in_use) { @@ -2317,7 +2322,13 @@ int gk20a_channel_suspend(struct gk20a *g) struct channel_gk20a *ch = gk20a_channel_from_id(g, chid); if (ch != NULL) { - g->ops.fifo.unbind_channel(ch); + if (gk20a_channel_check_timedout(ch)) { + nvgpu_log_info(g, "do not unbind " + "recovered channel %d", + chid); + } else { + g->ops.fifo.unbind_channel(ch); + } gk20a_channel_put(ch); } } @@ -2339,13 +2350,19 @@ int gk20a_channel_resume(struct gk20a *g) for (chid = 0; chid < f->num_channels; chid++) { struct channel_gk20a *ch = gk20a_channel_from_id(g, chid); - if (ch != NULL) { + if (ch == NULL) { + continue; + } + if (gk20a_channel_check_timedout(ch)) { + nvgpu_log_info(g, "do not resume recovered " + "channel %d", chid); + } else { nvgpu_log_info(g, "resume channel %d", chid); g->ops.fifo.bind_channel(ch); channels_in_use = true; - active_runlist_ids |= BIT(f->channel[chid].runlist_id); - gk20a_channel_put(ch); + active_runlist_ids |= (u32) BIT64(ch->runlist_id); } + gk20a_channel_put(ch); } if (channels_in_use) { -- cgit v1.2.2