From a8f0cb89f423093c334202dcfe43cb5729efca85 Mon Sep 17 00:00:00 2001 From: Debarshi Dutta Date: Fri, 30 Nov 2018 09:55:03 +0530 Subject: gpu: nvgpu: replace input param chid with pointer to channel gk20a_fifo_recover_channel takes a reference to the channel via its chid before passing the channel pointer to other public functions such as gk20a_channel_abort and gk20a_fifo_error_ch. This qualifies the gk20a_fifo_recover_channel to take a pointer to a channel instead of only chid. Jira NVGPU-1461 Change-Id: I338a12a05e5ccee785a202fea7848db5201a3a39 Signed-off-by: Debarshi Dutta Reviewed-on: https://git-master.nvidia.com/r/1963199 (cherry picked from commit 99acb8011a8627a2433d31e6e0c8ab833ab3317d in dev-kernel) Reviewed-on: https://git-master.nvidia.com/r/2013727 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 | 25 ++++++++++--------------- drivers/gpu/nvgpu/gk20a/fifo_gk20a.h | 6 +++--- 2 files changed, 13 insertions(+), 18 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index 710313bf..382744c7 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c @@ -1943,7 +1943,8 @@ static u32 gk20a_fifo_engines_on_id(struct gk20a *g, u32 id, bool is_tsg) return engines; } -void gk20a_fifo_recover_ch(struct gk20a *g, u32 chid, bool verbose, int rc_type) +void gk20a_fifo_recover_ch(struct gk20a *g, struct channel_gk20a *ch, + bool verbose, u32 rc_type) { u32 engines; @@ -1952,22 +1953,16 @@ void gk20a_fifo_recover_ch(struct gk20a *g, u32 chid, bool verbose, int rc_type) nvgpu_mutex_acquire(&g->dbg_sessions_lock); gr_gk20a_disable_ctxsw(g); - engines = gk20a_fifo_engines_on_id(g, chid, false); + engines = gk20a_fifo_engines_on_id(g, ch->chid, false); if (engines) { - gk20a_fifo_recover(g, engines, chid, false, true, verbose, + gk20a_fifo_recover(g, engines, ch->chid, false, true, verbose, rc_type); } else { - struct channel_gk20a *ch = gk20a_channel_from_id(g, chid); - - if (ch != NULL) { - gk20a_channel_abort(ch, false); - - if (gk20a_fifo_error_ch(g, ch)) { - gk20a_debug_dump(g); - } + gk20a_channel_abort(ch, false); - gk20a_channel_put(ch); + if (gk20a_fifo_error_ch(g, ch)) { + gk20a_debug_dump(g); } } @@ -2148,7 +2143,7 @@ int gk20a_fifo_force_reset_ch(struct channel_gk20a *ch, RC_TYPE_FORCE_RESET); } else { g->ops.fifo.set_error_notifier(ch, err_code); - gk20a_fifo_recover_ch(g, ch->chid, verbose, + gk20a_fifo_recover_ch(g, ch, verbose, RC_TYPE_FORCE_RESET); } @@ -2711,7 +2706,7 @@ static void gk20a_fifo_pbdma_fault_rc(struct gk20a *g, if (ch != NULL) { g->ops.fifo.set_error_notifier(ch, error_notifier); - gk20a_fifo_recover_ch(g, id, true, RC_TYPE_PBDMA_FAULT); + gk20a_fifo_recover_ch(g, ch, true, RC_TYPE_PBDMA_FAULT); gk20a_channel_put(ch); } } else if (fifo_pbdma_status_id_type_v(status) @@ -2926,7 +2921,7 @@ void gk20a_fifo_preempt_timeout_rc(struct gk20a *g, u32 chid) if (ch != NULL) { g->ops.fifo.set_error_notifier(ch, NVGPU_ERR_NOTIFIER_FIFO_ERROR_IDLE_TIMEOUT); - gk20a_fifo_recover_ch(g, chid, true, + gk20a_fifo_recover_ch(g, ch, true, RC_TYPE_PREEMPT_TIMEOUT); gk20a_channel_put(ch); } diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h index 12970558..330929f6 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h @@ -264,10 +264,10 @@ bool gk20a_fifo_mmu_fault_pending(struct gk20a *g); void gk20a_fifo_recover(struct gk20a *g, u32 engine_ids, /* if zero, will be queried from HW */ u32 hw_id, /* if ~0, will be queried from HW */ - bool hw_id_is_tsg, /* ignored if hw_id == ~0 */ + bool id_is_tsg, /* ignored if hw_id == ~0 */ bool id_is_known, bool verbose, int rc_type); -void gk20a_fifo_recover_ch(struct gk20a *g, u32 chid, bool verbose, - int rc_type); +void gk20a_fifo_recover_ch(struct gk20a *g, struct channel_gk20a *ch, + bool verbose, u32 rc_type); void gk20a_fifo_recover_tsg(struct gk20a *g, struct tsg_gk20a *tsg, bool verbose, u32 rc_type); int gk20a_fifo_force_reset_ch(struct channel_gk20a *ch, -- cgit v1.2.2