From 5b8ecbc51fe2e94a233c2c42d497b05c2eccdaf5 Mon Sep 17 00:00:00 2001 From: Debarshi Dutta Date: Fri, 23 Nov 2018 09:30:17 +0530 Subject: gpu: nvgpu: replace tsgid input variable with pointer to a struct tsg_gk20a replace tsgid with a pointer to a struct tsg_gk20a in the function gk20a_fifo_tsg_abort(). gk20a_fifo_tsg_abort needs to enumerate through all the channels within the tsg as well as pass the tsg pointer to other functions, qualifying the need to use a pointer instead as an input parameter. Jira NVGPU-1461 Change-Id: I59cec05d5d778f733d0c3e9ffadf46e74e249080 Signed-off-by: Debarshi Dutta Reviewed-on: https://git-master.nvidia.com/r/1956567 (cherry picked from commit e5bebd880f28fe719c5e01e165fb189e7cafee01 in dev-kernel) Reviewed-on: https://git-master.nvidia.com/r/2013724 Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/fifo/channel.c | 6 ++++-- drivers/gpu/nvgpu/common/fifo/tsg.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'drivers/gpu/nvgpu/common/fifo') diff --git a/drivers/gpu/nvgpu/common/fifo/channel.c b/drivers/gpu/nvgpu/common/fifo/channel.c index 45c02a75..6ac8e508 100644 --- a/drivers/gpu/nvgpu/common/fifo/channel.c +++ b/drivers/gpu/nvgpu/common/fifo/channel.c @@ -214,10 +214,12 @@ void gk20a_channel_abort_clean_up(struct channel_gk20a *ch) void gk20a_channel_abort(struct channel_gk20a *ch, bool channel_preempt) { + struct tsg_gk20a *tsg = tsg_gk20a_from_ch(ch); + nvgpu_log_fn(ch->g, " "); - if (gk20a_is_channel_marked_as_tsg(ch)) { - return gk20a_fifo_abort_tsg(ch->g, ch->tsgid, channel_preempt); + if (tsg != NULL) { + return gk20a_fifo_abort_tsg(ch->g, tsg, channel_preempt); } /* make sure new kickoffs are prevented */ diff --git a/drivers/gpu/nvgpu/common/fifo/tsg.c b/drivers/gpu/nvgpu/common/fifo/tsg.c index 0892e8bf..9790553f 100644 --- a/drivers/gpu/nvgpu/common/fifo/tsg.c +++ b/drivers/gpu/nvgpu/common/fifo/tsg.c @@ -20,6 +20,7 @@ * DEALINGS IN THE SOFTWARE. */ +#include #include #include #include @@ -149,18 +150,23 @@ int gk20a_tsg_bind_channel(struct tsg_gk20a *tsg, return 0; } +/* The caller must ensure that channel belongs to a tsg */ int gk20a_tsg_unbind_channel(struct channel_gk20a *ch) { struct gk20a *g = ch->g; - struct tsg_gk20a *tsg = &g->fifo.tsg[ch->tsgid]; + struct tsg_gk20a *tsg = tsg_gk20a_from_ch(ch); int err; + if (tsg == NULL) { + return -EINVAL; + } + err = g->ops.fifo.tsg_unbind_channel(ch); if (err) { nvgpu_err(g, "Channel %d unbind failed, tearing down TSG %d", ch->chid, tsg->tsgid); - gk20a_fifo_abort_tsg(ch->g, ch->tsgid, true); + gk20a_fifo_abort_tsg(ch->g, tsg, true); /* If channel unbind fails, channel is still part of runlist */ channel_gk20a_update_runlist(ch, false); -- cgit v1.2.2