summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDebarshi Dutta <ddutta@nvidia.com>2018-11-22 23:00:17 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2019-02-11 11:18:33 -0500
commit5b8ecbc51fe2e94a233c2c42d497b05c2eccdaf5 (patch)
treebce75e5e83f4370d763478587acca0faba786cbd /drivers
parent7e8ba851a826f398fb722b9ff26d6fd40f3226ce (diff)
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 <ddutta@nvidia.com> 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 <svc-mobile-coverity@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/common/fifo/channel.c6
-rw-r--r--drivers/gpu/nvgpu/common/fifo/tsg.c10
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.c11
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.h2
-rw-r--r--drivers/gpu/nvgpu/gv11b/fifo_gv11b.c4
5 files changed, 20 insertions, 13 deletions
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)
214 214
215void gk20a_channel_abort(struct channel_gk20a *ch, bool channel_preempt) 215void gk20a_channel_abort(struct channel_gk20a *ch, bool channel_preempt)
216{ 216{
217 struct tsg_gk20a *tsg = tsg_gk20a_from_ch(ch);
218
217 nvgpu_log_fn(ch->g, " "); 219 nvgpu_log_fn(ch->g, " ");
218 220
219 if (gk20a_is_channel_marked_as_tsg(ch)) { 221 if (tsg != NULL) {
220 return gk20a_fifo_abort_tsg(ch->g, ch->tsgid, channel_preempt); 222 return gk20a_fifo_abort_tsg(ch->g, tsg, channel_preempt);
221 } 223 }
222 224
223 /* make sure new kickoffs are prevented */ 225 /* 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 @@
20 * DEALINGS IN THE SOFTWARE. 20 * DEALINGS IN THE SOFTWARE.
21 */ 21 */
22 22
23#include <nvgpu/bug.h>
23#include <nvgpu/kmem.h> 24#include <nvgpu/kmem.h>
24#include <nvgpu/log.h> 25#include <nvgpu/log.h>
25#include <nvgpu/os_sched.h> 26#include <nvgpu/os_sched.h>
@@ -149,18 +150,23 @@ int gk20a_tsg_bind_channel(struct tsg_gk20a *tsg,
149 return 0; 150 return 0;
150} 151}
151 152
153/* The caller must ensure that channel belongs to a tsg */
152int gk20a_tsg_unbind_channel(struct channel_gk20a *ch) 154int gk20a_tsg_unbind_channel(struct channel_gk20a *ch)
153{ 155{
154 struct gk20a *g = ch->g; 156 struct gk20a *g = ch->g;
155 struct tsg_gk20a *tsg = &g->fifo.tsg[ch->tsgid]; 157 struct tsg_gk20a *tsg = tsg_gk20a_from_ch(ch);
156 int err; 158 int err;
157 159
160 if (tsg == NULL) {
161 return -EINVAL;
162 }
163
158 err = g->ops.fifo.tsg_unbind_channel(ch); 164 err = g->ops.fifo.tsg_unbind_channel(ch);
159 if (err) { 165 if (err) {
160 nvgpu_err(g, "Channel %d unbind failed, tearing down TSG %d", 166 nvgpu_err(g, "Channel %d unbind failed, tearing down TSG %d",
161 ch->chid, tsg->tsgid); 167 ch->chid, tsg->tsgid);
162 168
163 gk20a_fifo_abort_tsg(ch->g, ch->tsgid, true); 169 gk20a_fifo_abort_tsg(ch->g, tsg, true);
164 /* If channel unbind fails, channel is still part of runlist */ 170 /* If channel unbind fails, channel is still part of runlist */
165 channel_gk20a_update_runlist(ch, false); 171 channel_gk20a_update_runlist(ch, false);
166 172
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
index 5e794a55..9ed78640 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
@@ -1553,17 +1553,16 @@ void gk20a_fifo_set_ctx_mmu_error_tsg(struct gk20a *g,
1553 1553
1554} 1554}
1555 1555
1556void gk20a_fifo_abort_tsg(struct gk20a *g, u32 tsgid, bool preempt) 1556void gk20a_fifo_abort_tsg(struct gk20a *g, struct tsg_gk20a *tsg, bool preempt)
1557{ 1557{
1558 struct tsg_gk20a *tsg = &g->fifo.tsg[tsgid]; 1558 struct channel_gk20a *ch = NULL;
1559 struct channel_gk20a *ch;
1560 1559
1561 nvgpu_log_fn(g, " "); 1560 nvgpu_log_fn(g, " ");
1562 1561
1563 g->ops.fifo.disable_tsg(tsg); 1562 g->ops.fifo.disable_tsg(tsg);
1564 1563
1565 if (preempt) { 1564 if (preempt) {
1566 g->ops.fifo.preempt_tsg(g, tsgid); 1565 g->ops.fifo.preempt_tsg(g, tsg->tsgid);
1567 } 1566 }
1568 1567
1569 nvgpu_rwsem_down_read(&tsg->ch_list_lock); 1568 nvgpu_rwsem_down_read(&tsg->ch_list_lock);
@@ -1809,7 +1808,7 @@ static bool gk20a_fifo_handle_mmu_fault_locked(
1809 tsg); 1808 tsg);
1810 } 1809 }
1811 verbose = gk20a_fifo_error_tsg(g, tsg); 1810 verbose = gk20a_fifo_error_tsg(g, tsg);
1812 gk20a_fifo_abort_tsg(g, tsg->tsgid, false); 1811 gk20a_fifo_abort_tsg(g, tsg, false);
1813 } 1812 }
1814 1813
1815 /* put back the ref taken early above */ 1814 /* put back the ref taken early above */
@@ -1998,7 +1997,7 @@ void gk20a_fifo_recover_tsg(struct gk20a *g, u32 tsgid, bool verbose,
1998 gk20a_debug_dump(g); 1997 gk20a_debug_dump(g);
1999 } 1998 }
2000 1999
2001 gk20a_fifo_abort_tsg(g, tsgid, false); 2000 gk20a_fifo_abort_tsg(g, tsg, false);
2002 } 2001 }
2003 2002
2004 gr_gk20a_enable_ctxsw(g); 2003 gr_gk20a_enable_ctxsw(g);
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h
index 2b646a7b..f3c1b362 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h
@@ -287,7 +287,7 @@ u32 gk20a_fifo_get_failing_engine_data(struct gk20a *g,
287 int *__id, bool *__is_tsg); 287 int *__id, bool *__is_tsg);
288void gk20a_fifo_set_ctx_mmu_error_tsg(struct gk20a *g, 288void gk20a_fifo_set_ctx_mmu_error_tsg(struct gk20a *g,
289 struct tsg_gk20a *tsg); 289 struct tsg_gk20a *tsg);
290void gk20a_fifo_abort_tsg(struct gk20a *g, u32 tsgid, bool preempt); 290void gk20a_fifo_abort_tsg(struct gk20a *g, struct tsg_gk20a *tsg, bool preempt);
291void gk20a_fifo_set_ctx_mmu_error_ch(struct gk20a *g, 291void gk20a_fifo_set_ctx_mmu_error_ch(struct gk20a *g,
292 struct channel_gk20a *refch); 292 struct channel_gk20a *refch);
293bool gk20a_fifo_error_tsg(struct gk20a *g, struct tsg_gk20a *tsg); 293bool gk20a_fifo_error_tsg(struct gk20a *g, struct tsg_gk20a *tsg);
diff --git a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c
index 34e9cd5f..b0b752af 100644
--- a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c
@@ -974,7 +974,7 @@ static void gv11b_fifo_locked_abort_runlist_active_tsgs(struct gk20a *g,
974 rlid); 974 rlid);
975 } 975 }
976 976
977 gk20a_fifo_abort_tsg(g, tsg->tsgid, false); 977 gk20a_fifo_abort_tsg(g, tsg, false);
978 978
979 nvgpu_log(g, gpu_dbg_info, "aborted tsg id %d", tsgid); 979 nvgpu_log(g, gpu_dbg_info, "aborted tsg id %d", tsgid);
980 } 980 }
@@ -1183,7 +1183,7 @@ void gv11b_fifo_teardown_ch_tsg(struct gk20a *g, u32 act_eng_bitmask,
1183 gk20a_fifo_set_ctx_mmu_error_tsg(g, tsg); 1183 gk20a_fifo_set_ctx_mmu_error_tsg(g, tsg);
1184 } 1184 }
1185 1185
1186 gk20a_fifo_abort_tsg(g, tsg->tsgid, false); 1186 gk20a_fifo_abort_tsg(g, tsg, false);
1187 } 1187 }
1188 } else { 1188 } else {
1189 gv11b_fifo_locked_abort_runlist_active_tsgs(g, rc_type, 1189 gv11b_fifo_locked_abort_runlist_active_tsgs(g, rc_type,