From 31fa6773ef124a4e779e0972e87d4fb681217f19 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Tue, 31 May 2016 17:55:20 +0530 Subject: gpu: nvgpu: use correct APIs for disable and preempt In gr_gk20a_ctx_zcull_setup(), gr_gk20a_update_smpc_ctxsw_mode(), and in gk20a_channel_suspend(), we call channel specific APIs to disable/preempt/enable channel But we do not consider TSGs in this case Hence use correct (below) APIs in above functions which will handle channel or TSG internally : gk20a_disable_channel_tsg() gk20a_fifo_preempt() gk20a_enable_channel_tsg() Bug 200205041 Change-Id: Ieed378dac4ad2322b35f9102706176ec326d386c Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1157189 GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 4 ++-- drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 28 ++++++++++++++++++---------- 2 files changed, 20 insertions(+), 12 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 64a14f8e..b1d9fa55 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -2772,9 +2772,9 @@ int gk20a_channel_suspend(struct gk20a *g) if (gk20a_channel_get(ch)) { gk20a_dbg_info("suspend channel %d", chid); /* disable channel */ - g->ops.fifo.disable_channel(ch); + gk20a_disable_channel_tsg(g, ch); /* preempt the channel */ - g->ops.fifo.preempt_channel(g, chid); + gk20a_fifo_preempt(g, ch); gk20a_channel_cancel_job_clean_up(ch, true); /* wait for channel update notifiers */ if (ch->update_fn) diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 2d88ac53..7e0bd7ce 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c @@ -764,12 +764,15 @@ static int gr_gk20a_ctx_zcull_setup(struct gk20a *g, struct channel_gk20a *c) va_hi = u64_hi32(ch_ctx->zcull_ctx.gpu_va); va = ((va_lo >> 8) & 0x00FFFFFF) | ((va_hi << 24) & 0xFF000000); - c->g->ops.fifo.disable_channel(c); - ret = c->g->ops.fifo.preempt_channel(c->g, c->hw_chid); + ret = gk20a_disable_channel_tsg(g, c); if (ret) { - c->g->ops.fifo.enable_channel(c); - gk20a_err(dev_from_gk20a(g), - "failed to disable gr engine activity\n"); + gk20a_err(dev_from_gk20a(g), "failed to disable channel/TSG\n"); + goto clean_up; + } + ret = gk20a_fifo_preempt(g, c); + if (ret) { + gk20a_enable_channel_tsg(g, c); + gk20a_err(dev_from_gk20a(g), "failed to preempt channel/TSG\n"); goto clean_up; } @@ -780,7 +783,7 @@ static int gr_gk20a_ctx_zcull_setup(struct gk20a *g, struct channel_gk20a *c) gk20a_mem_wr(g, mem, ctxsw_prog_main_image_zcull_ptr_o(), va); - c->g->ops.fifo.enable_channel(c); + gk20a_enable_channel_tsg(g, c); clean_up: gk20a_mem_end(g, mem); @@ -1617,10 +1620,15 @@ int gr_gk20a_update_smpc_ctxsw_mode(struct gk20a *g, mem = &ch_ctx->gr_ctx->mem; - c->g->ops.fifo.disable_channel(c); - ret = c->g->ops.fifo.preempt_channel(c->g, c->hw_chid); + ret = gk20a_disable_channel_tsg(g, c); if (ret) { - gk20a_err(dev_from_gk20a(g), "failed to preempt channel"); + gk20a_err(dev_from_gk20a(g), "failed to disable channel/TSG\n"); + goto out; + } + ret = gk20a_fifo_preempt(g, c); + if (ret) { + gk20a_enable_channel_tsg(g, c); + gk20a_err(dev_from_gk20a(g), "failed to preempt channel/TSG\n"); goto out; } @@ -1646,7 +1654,7 @@ int gr_gk20a_update_smpc_ctxsw_mode(struct gk20a *g, gk20a_mem_end(g, mem); out: - c->g->ops.fifo.enable_channel(c); + gk20a_enable_channel_tsg(g, c); return ret; } -- cgit v1.2.2