From e00804594b83781bc9f7c17ac68cd9c5dd30953c Mon Sep 17 00:00:00 2001 From: Seema Khowala Date: Thu, 27 Dec 2018 19:23:06 -0800 Subject: gpu: nvgpu: remove gk20a_is_channel_marked_as_tsg Use tsg_gk20a_from_ch to get tsg pointer for tsgid of a channel. For invalid tsgid, tsg pointer will be NULL Bug 2092051 Bug 2429295 Bug 2484211 Change-Id: I82cd6a2dc5fab4acb147202af667ca97a2842a73 Signed-off-by: Seema Khowala Reviewed-on: https://git-master.nvidia.com/r/2006722 Signed-off-by: Debarshi Dutta (cherry picked from commit 13f37f9c70b9ae2e0d179830cded93a0a6f86494 in dev-kernel) Reviewed-on: https://git-master.nvidia.com/r/2025507 GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/fifo_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index f12c78f8..f4b96b7a 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c @@ -2154,11 +2154,15 @@ int gk20a_fifo_tsg_unbind_channel_verify_status(struct channel_gk20a *ch) int gk20a_fifo_tsg_unbind_channel(struct channel_gk20a *ch) { struct gk20a *g = ch->g; - struct fifo_gk20a *f = &g->fifo; - struct tsg_gk20a *tsg = &f->tsg[ch->tsgid]; + struct tsg_gk20a *tsg = tsg_gk20a_from_ch(ch); int err; bool tsg_timedout = false; + if (tsg == NULL) { + nvgpu_err(g, "chid: %d is not bound to tsg", ch->chid); + return 0; + } + /* If one channel in TSG times out, we disable all channels */ nvgpu_rwsem_down_write(&tsg->ch_list_lock); tsg_timedout = gk20a_channel_check_timedout(ch); @@ -2188,6 +2192,7 @@ int gk20a_fifo_tsg_unbind_channel(struct channel_gk20a *ch) /* Remove channel from TSG and re-enable rest of the channels */ nvgpu_rwsem_down_write(&tsg->ch_list_lock); nvgpu_list_del(&ch->ch_entry); + ch->tsgid = NVGPU_INVALID_TSG_ID; nvgpu_rwsem_up_write(&tsg->ch_list_lock); /* @@ -3485,9 +3490,7 @@ int gk20a_fifo_update_runlist_locked(struct gk20a *g, u32 runlist_id, Otherwise, keep active list untouched for suspend/resume. */ if (chid != FIFO_INVAL_CHANNEL_ID) { ch = &f->channel[chid]; - if (gk20a_is_channel_marked_as_tsg(ch)) { - tsg = &f->tsg[ch->tsgid]; - } + tsg = tsg_gk20a_from_ch(ch); if (add) { if (test_and_set_bit(chid, -- cgit v1.2.2