From ef9de9e9925573b691d78760e42334ad24c5797f Mon Sep 17 00:00:00 2001 From: Debarshi Dutta Date: Tue, 27 Nov 2018 11:05:56 +0530 Subject: gpu: nvgpu: replace input parameter tsgid with pointer to struct tsg_gk20a gv11b_fifo_preempt_tsg needs to access the runlist_id of the tsg as well as pass the tsg pointer to other public functions such as gk20a_fifo_disable_tsg_sched. This qualifies the preempt_tsg to use a pointer to a struct tsg_gk20a instead of just using the tsgid. Jira NVGPU-1461 Change-Id: I01fbd2370b5746c2a597a0351e0301b0f7d25175 Signed-off-by: Debarshi Dutta Reviewed-on: https://git-master.nvidia.com/r/1959068 (cherry picked from commit 1e78d47f15ff050edbb10a88550012178d353288 in rel-32) Reviewed-on: https://git-master.nvidia.com/r/2013725 Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 26 +++++++++++++------------- drivers/gpu/nvgpu/gk20a/fifo_gk20a.h | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a') diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index 9ed78640..a2ebb720 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c @@ -1562,7 +1562,7 @@ void gk20a_fifo_abort_tsg(struct gk20a *g, struct tsg_gk20a *tsg, bool preempt) g->ops.fifo.disable_tsg(tsg); if (preempt) { - g->ops.fifo.preempt_tsg(g, tsg->tsgid); + g->ops.fifo.preempt_tsg(g, tsg); } nvgpu_rwsem_down_read(&tsg->ch_list_lock); @@ -2194,8 +2194,8 @@ int gk20a_fifo_tsg_unbind_channel(struct channel_gk20a *ch) /* Disable TSG and examine status before unbinding channel */ g->ops.fifo.disable_tsg(tsg); - err = g->ops.fifo.preempt_tsg(g, tsg->tsgid); - if (err) { + err = g->ops.fifo.preempt_tsg(g, tsg); + if (err != 0) { goto fail_enable_tsg; } @@ -3000,7 +3000,7 @@ int gk20a_fifo_preempt_channel(struct gk20a *g, u32 chid) return ret; } -int gk20a_fifo_preempt_tsg(struct gk20a *g, u32 tsgid) +int gk20a_fifo_preempt_tsg(struct gk20a *g, struct tsg_gk20a *tsg) { struct fifo_gk20a *f = &g->fifo; u32 ret = 0; @@ -3008,10 +3008,7 @@ int gk20a_fifo_preempt_tsg(struct gk20a *g, u32 tsgid) u32 mutex_ret = 0; u32 i; - nvgpu_log_fn(g, "tsgid: %d", tsgid); - if (tsgid == FIFO_INVAL_TSG_ID) { - return 0; - } + nvgpu_log_fn(g, "tsgid: %d", tsg->tsgid); /* we have no idea which runlist we are using. lock all */ for (i = 0; i < g->fifo.max_runlists; i++) { @@ -3020,7 +3017,7 @@ int gk20a_fifo_preempt_tsg(struct gk20a *g, u32 tsgid) mutex_ret = nvgpu_pmu_mutex_acquire(&g->pmu, PMU_MUTEX_ID_FIFO, &token); - ret = __locked_fifo_preempt(g, tsgid, true); + ret = __locked_fifo_preempt(g, tsg->tsgid, true); if (!mutex_ret) { nvgpu_pmu_mutex_release(&g->pmu, PMU_MUTEX_ID_FIFO, &token); @@ -3033,9 +3030,11 @@ int gk20a_fifo_preempt_tsg(struct gk20a *g, u32 tsgid) if (ret) { if (nvgpu_platform_is_silicon(g)) { nvgpu_err(g, "preempt timed out for tsgid: %u, " - "ctxsw timeout will trigger recovery if needed", tsgid); + "ctxsw timeout will trigger recovery if needed", + tsg->tsgid); } else { - gk20a_fifo_preempt_timeout_rc(g, tsgid, true); + gk20a_fifo_preempt_timeout_rc(g, + tsg->tsgid, ID_TYPE_TSG); } } @@ -3045,9 +3044,10 @@ int gk20a_fifo_preempt_tsg(struct gk20a *g, u32 tsgid) int gk20a_fifo_preempt(struct gk20a *g, struct channel_gk20a *ch) { int err; + struct tsg_gk20a *tsg = tsg_gk20a_from_ch(ch); - if (gk20a_is_channel_marked_as_tsg(ch)) { - err = g->ops.fifo.preempt_tsg(ch->g, ch->tsgid); + if (tsg != NULL) { + err = g->ops.fifo.preempt_tsg(ch->g, tsg); } else { err = g->ops.fifo.preempt_channel(ch->g, ch->chid); } diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h index f3c1b362..2d1c9cc3 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h @@ -231,7 +231,7 @@ void gk20a_fifo_isr(struct gk20a *g); u32 gk20a_fifo_nonstall_isr(struct gk20a *g); int gk20a_fifo_preempt_channel(struct gk20a *g, u32 chid); -int gk20a_fifo_preempt_tsg(struct gk20a *g, u32 tsgid); +int gk20a_fifo_preempt_tsg(struct gk20a *g, struct tsg_gk20a *tsg); int gk20a_fifo_preempt(struct gk20a *g, struct channel_gk20a *ch); int gk20a_fifo_enable_engine_activity(struct gk20a *g, -- cgit v1.2.2