summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-09-13 08:41:52 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-09-15 15:48:20 -0400
commit460951ed092aad787bacd0ebb0646b799d3463a1 (patch)
treeb7fae8084b76106d77a8af6efea470e595175f17 /drivers/gpu
parent7d6d0405311337456f50d6fa032963c18d2c9f9f (diff)
gpu: nvgpu: fix TSG enable sequence
Due to a h/w bug in Maxwell and Pascal we first need to enable all channels with NEXT and CTX_RELOAD set in a TSG, and then rest of the channels should be enabled Add this sequence to gk20a_tsg_enable() Add new APIs to enable/disable scheduling of TSG runlist gk20a_fifo_enable_tsg_sched() gk20a_fifo_disble_tsg_sched() Add new APIs to check if channel has NEXT or CTX_RELOAD set gk20a_fifo_channel_status_is_next() gk20a_fifo_channel_status_is_ctx_reload() Bug 1739362 Change-Id: I4891cbd7f22ebc1e0bf32c52801002cdc259dbe1 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1560636 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.c36
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.h6
-rw-r--r--drivers/gpu/nvgpu/gk20a/tsg_gk20a.c24
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/hw/gk20a/hw_ccsr_gk20a.h38
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/hw/gm20b/hw_ccsr_gm20b.h38
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/hw/gp106/hw_ccsr_gp106.h34
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/hw/gp10b/hw_ccsr_gp10b.h38
7 files changed, 208 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
index 88ce6a83..2cc5e4cd 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
@@ -2671,6 +2671,21 @@ void gk20a_fifo_set_runlist_state(struct gk20a *g, u32 runlists_mask,
2671 gk20a_dbg_fn("done"); 2671 gk20a_dbg_fn("done");
2672} 2672}
2673 2673
2674void gk20a_fifo_enable_tsg_sched(struct gk20a *g, struct tsg_gk20a *tsg)
2675{
2676 gk20a_fifo_set_runlist_state(g, fifo_sched_disable_runlist_m(
2677 tsg->runlist_id), RUNLIST_ENABLED,
2678 !RUNLIST_INFO_MUTEX_LOCKED);
2679
2680}
2681
2682void gk20a_fifo_disable_tsg_sched(struct gk20a *g, struct tsg_gk20a *tsg)
2683{
2684 gk20a_fifo_set_runlist_state(g, fifo_sched_disable_runlist_m(
2685 tsg->runlist_id), RUNLIST_DISABLED,
2686 !RUNLIST_INFO_MUTEX_LOCKED);
2687}
2688
2674int gk20a_fifo_enable_engine_activity(struct gk20a *g, 2689int gk20a_fifo_enable_engine_activity(struct gk20a *g,
2675 struct fifo_engine_info_gk20a *eng_info) 2690 struct fifo_engine_info_gk20a *eng_info)
2676{ 2691{
@@ -3413,6 +3428,27 @@ const char *gk20a_decode_pbdma_chan_eng_ctx_status(u32 index)
3413 return pbdma_chan_eng_ctx_status_str[index]; 3428 return pbdma_chan_eng_ctx_status_str[index];
3414} 3429}
3415 3430
3431bool gk20a_fifo_channel_status_is_next(struct gk20a *g, u32 chid)
3432{
3433 u32 channel = gk20a_readl(g, ccsr_channel_r(chid));
3434
3435 return ccsr_channel_next_v(channel) == ccsr_channel_next_true_v();
3436}
3437
3438bool gk20a_fifo_channel_status_is_ctx_reload(struct gk20a *g, u32 chid)
3439{
3440 u32 channel = gk20a_readl(g, ccsr_channel_r(chid));
3441 u32 status = ccsr_channel_status_v(channel);
3442
3443 return (status == ccsr_channel_status_pending_ctx_reload_v() ||
3444 status == ccsr_channel_status_pending_acq_ctx_reload_v() ||
3445 status == ccsr_channel_status_on_pbdma_ctx_reload_v() ||
3446 status == ccsr_channel_status_on_pbdma_and_eng_ctx_reload_v() ||
3447 status == ccsr_channel_status_on_eng_ctx_reload_v() ||
3448 status == ccsr_channel_status_on_eng_pending_ctx_reload_v() ||
3449 status == ccsr_channel_status_on_eng_pending_acq_ctx_reload_v());
3450}
3451
3416void gk20a_dump_channel_status_ramfc(struct gk20a *g, 3452void gk20a_dump_channel_status_ramfc(struct gk20a *g,
3417 struct gk20a_debug_output *o, 3453 struct gk20a_debug_output *o,
3418 u32 chid, 3454 u32 chid,
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h
index d5b686f0..70c70931 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h
@@ -248,6 +248,9 @@ int gk20a_fifo_disable_engine_activity(struct gk20a *g,
248 bool wait_for_idle); 248 bool wait_for_idle);
249int gk20a_fifo_disable_all_engine_activity(struct gk20a *g, 249int gk20a_fifo_disable_all_engine_activity(struct gk20a *g,
250 bool wait_for_idle); 250 bool wait_for_idle);
251void gk20a_fifo_enable_tsg_sched(struct gk20a *g, struct tsg_gk20a *tsg);
252void gk20a_fifo_disable_tsg_sched(struct gk20a *g, struct tsg_gk20a *tsg);
253
251u32 gk20a_fifo_engines_on_ch(struct gk20a *g, u32 chid); 254u32 gk20a_fifo_engines_on_ch(struct gk20a *g, u32 chid);
252 255
253int gk20a_fifo_reschedule_runlist(struct gk20a *g, u32 runlist_id); 256int gk20a_fifo_reschedule_runlist(struct gk20a *g, u32 runlist_id);
@@ -362,6 +365,9 @@ const char *gk20a_decode_pbdma_chan_eng_ctx_status(u32 index);
362void gk20a_fifo_enable_channel(struct channel_gk20a *ch); 365void gk20a_fifo_enable_channel(struct channel_gk20a *ch);
363void gk20a_fifo_disable_channel(struct channel_gk20a *ch); 366void gk20a_fifo_disable_channel(struct channel_gk20a *ch);
364 367
368bool gk20a_fifo_channel_status_is_next(struct gk20a *g, u32 chid);
369bool gk20a_fifo_channel_status_is_ctx_reload(struct gk20a *g, u32 chid);
370
365struct channel_gk20a *gk20a_refch_from_inst_ptr(struct gk20a *g, u64 inst_ptr); 371struct channel_gk20a *gk20a_refch_from_inst_ptr(struct gk20a *g, u64 inst_ptr);
366void gk20a_fifo_channel_unbind(struct channel_gk20a *ch_gk20a); 372void gk20a_fifo_channel_unbind(struct channel_gk20a *ch_gk20a);
367 373
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
index f3e87a13..eabb98ea 100644
--- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
@@ -29,13 +29,37 @@ int gk20a_enable_tsg(struct tsg_gk20a *tsg)
29{ 29{
30 struct gk20a *g = tsg->g; 30 struct gk20a *g = tsg->g;
31 struct channel_gk20a *ch; 31 struct channel_gk20a *ch;
32 bool is_next, is_ctx_reload;
32 33
34 gk20a_fifo_disable_tsg_sched(g, tsg);
35
36 /*
37 * Due to h/w bug that exists in Maxwell and Pascal,
38 * we first need to enable all channels with NEXT and CTX_RELOAD set,
39 * and then rest of the channels should be enabled
40 */
33 down_read(&tsg->ch_list_lock); 41 down_read(&tsg->ch_list_lock);
34 nvgpu_list_for_each_entry(ch, &tsg->ch_list, channel_gk20a, ch_entry) { 42 nvgpu_list_for_each_entry(ch, &tsg->ch_list, channel_gk20a, ch_entry) {
43 is_next = gk20a_fifo_channel_status_is_next(g, ch->chid);
44 is_ctx_reload = gk20a_fifo_channel_status_is_ctx_reload(g, ch->chid);
45
46 if (is_next || is_ctx_reload)
47 g->ops.fifo.enable_channel(ch);
48 }
49
50 nvgpu_list_for_each_entry(ch, &tsg->ch_list, channel_gk20a, ch_entry) {
51 is_next = gk20a_fifo_channel_status_is_next(g, ch->chid);
52 is_ctx_reload = gk20a_fifo_channel_status_is_ctx_reload(g, ch->chid);
53
54 if (is_next || is_ctx_reload)
55 continue;
56
35 g->ops.fifo.enable_channel(ch); 57 g->ops.fifo.enable_channel(ch);
36 } 58 }
37 up_read(&tsg->ch_list_lock); 59 up_read(&tsg->ch_list_lock);
38 60
61 gk20a_fifo_enable_tsg_sched(g, tsg);
62
39 return 0; 63 return 0;
40} 64}
41 65
diff --git a/drivers/gpu/nvgpu/include/nvgpu/hw/gk20a/hw_ccsr_gk20a.h b/drivers/gpu/nvgpu/include/nvgpu/hw/gk20a/hw_ccsr_gk20a.h
index 4877e4a8..c6f792e7 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/hw/gk20a/hw_ccsr_gk20a.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/hw/gk20a/hw_ccsr_gk20a.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2012-2016, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2012-2017, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -114,6 +114,42 @@ static inline u32 ccsr_channel_status_v(u32 r)
114{ 114{
115 return (r >> 24) & 0xf; 115 return (r >> 24) & 0xf;
116} 116}
117static inline u32 ccsr_channel_status_pending_ctx_reload_v(void)
118{
119 return 0x00000002;
120}
121static inline u32 ccsr_channel_status_pending_acq_ctx_reload_v(void)
122{
123 return 0x00000004;
124}
125static inline u32 ccsr_channel_status_on_pbdma_ctx_reload_v(void)
126{
127 return 0x0000000a;
128}
129static inline u32 ccsr_channel_status_on_pbdma_and_eng_ctx_reload_v(void)
130{
131 return 0x0000000b;
132}
133static inline u32 ccsr_channel_status_on_eng_ctx_reload_v(void)
134{
135 return 0x0000000c;
136}
137static inline u32 ccsr_channel_status_on_eng_pending_ctx_reload_v(void)
138{
139 return 0x0000000d;
140}
141static inline u32 ccsr_channel_status_on_eng_pending_acq_ctx_reload_v(void)
142{
143 return 0x0000000e;
144}
145static inline u32 ccsr_channel_next_v(u32 r)
146{
147 return (r >> 1) & 0x1;
148}
149static inline u32 ccsr_channel_next_true_v(void)
150{
151 return 0x00000001;
152}
117static inline u32 ccsr_channel_busy_v(u32 r) 153static inline u32 ccsr_channel_busy_v(u32 r)
118{ 154{
119 return (r >> 28) & 0x1; 155 return (r >> 28) & 0x1;
diff --git a/drivers/gpu/nvgpu/include/nvgpu/hw/gm20b/hw_ccsr_gm20b.h b/drivers/gpu/nvgpu/include/nvgpu/hw/gm20b/hw_ccsr_gm20b.h
index 2fdf73ae..3f5d312f 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/hw/gm20b/hw_ccsr_gm20b.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/hw/gm20b/hw_ccsr_gm20b.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -110,6 +110,42 @@ static inline u32 ccsr_channel_status_v(u32 r)
110{ 110{
111 return (r >> 24) & 0xf; 111 return (r >> 24) & 0xf;
112} 112}
113static inline u32 ccsr_channel_status_pending_ctx_reload_v(void)
114{
115 return 0x00000002;
116}
117static inline u32 ccsr_channel_status_pending_acq_ctx_reload_v(void)
118{
119 return 0x00000004;
120}
121static inline u32 ccsr_channel_status_on_pbdma_ctx_reload_v(void)
122{
123 return 0x0000000a;
124}
125static inline u32 ccsr_channel_status_on_pbdma_and_eng_ctx_reload_v(void)
126{
127 return 0x0000000b;
128}
129static inline u32 ccsr_channel_status_on_eng_ctx_reload_v(void)
130{
131 return 0x0000000c;
132}
133static inline u32 ccsr_channel_status_on_eng_pending_ctx_reload_v(void)
134{
135 return 0x0000000d;
136}
137static inline u32 ccsr_channel_status_on_eng_pending_acq_ctx_reload_v(void)
138{
139 return 0x0000000e;
140}
141static inline u32 ccsr_channel_next_v(u32 r)
142{
143 return (r >> 1) & 0x1;
144}
145static inline u32 ccsr_channel_next_true_v(void)
146{
147 return 0x00000001;
148}
113static inline u32 ccsr_channel_busy_v(u32 r) 149static inline u32 ccsr_channel_busy_v(u32 r)
114{ 150{
115 return (r >> 28) & 0x1; 151 return (r >> 28) & 0x1;
diff --git a/drivers/gpu/nvgpu/include/nvgpu/hw/gp106/hw_ccsr_gp106.h b/drivers/gpu/nvgpu/include/nvgpu/hw/gp106/hw_ccsr_gp106.h
index 65146d39..13bd4251 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/hw/gp106/hw_ccsr_gp106.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/hw/gp106/hw_ccsr_gp106.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -114,12 +114,40 @@ static inline u32 ccsr_channel_status_pending_ctx_reload_v(void)
114{ 114{
115 return 0x00000002; 115 return 0x00000002;
116} 116}
117static inline u32 ccsr_channel_busy_v(u32 r) 117static inline u32 ccsr_channel_status_pending_acq_ctx_reload_v(void)
118{ 118{
119 return (r >> 28) & 0x1; 119 return 0x00000004;
120}
121static inline u32 ccsr_channel_status_on_pbdma_ctx_reload_v(void)
122{
123 return 0x0000000a;
124}
125static inline u32 ccsr_channel_status_on_pbdma_and_eng_ctx_reload_v(void)
126{
127 return 0x0000000b;
128}
129static inline u32 ccsr_channel_status_on_eng_ctx_reload_v(void)
130{
131 return 0x0000000c;
132}
133static inline u32 ccsr_channel_status_on_eng_pending_ctx_reload_v(void)
134{
135 return 0x0000000d;
136}
137static inline u32 ccsr_channel_status_on_eng_pending_acq_ctx_reload_v(void)
138{
139 return 0x0000000e;
120} 140}
121static inline u32 ccsr_channel_next_v(u32 r) 141static inline u32 ccsr_channel_next_v(u32 r)
122{ 142{
123 return (r >> 1) & 0x1; 143 return (r >> 1) & 0x1;
124} 144}
145static inline u32 ccsr_channel_next_true_v(void)
146{
147 return 0x00000001;
148}
149static inline u32 ccsr_channel_busy_v(u32 r)
150{
151 return (r >> 28) & 0x1;
152}
125#endif 153#endif
diff --git a/drivers/gpu/nvgpu/include/nvgpu/hw/gp10b/hw_ccsr_gp10b.h b/drivers/gpu/nvgpu/include/nvgpu/hw/gp10b/hw_ccsr_gp10b.h
index 99398961..33c83c80 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/hw/gp10b/hw_ccsr_gp10b.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/hw/gp10b/hw_ccsr_gp10b.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -110,6 +110,42 @@ static inline u32 ccsr_channel_status_v(u32 r)
110{ 110{
111 return (r >> 24) & 0xf; 111 return (r >> 24) & 0xf;
112} 112}
113static inline u32 ccsr_channel_status_pending_ctx_reload_v(void)
114{
115 return 0x00000002;
116}
117static inline u32 ccsr_channel_status_pending_acq_ctx_reload_v(void)
118{
119 return 0x00000004;
120}
121static inline u32 ccsr_channel_status_on_pbdma_ctx_reload_v(void)
122{
123 return 0x0000000a;
124}
125static inline u32 ccsr_channel_status_on_pbdma_and_eng_ctx_reload_v(void)
126{
127 return 0x0000000b;
128}
129static inline u32 ccsr_channel_status_on_eng_ctx_reload_v(void)
130{
131 return 0x0000000c;
132}
133static inline u32 ccsr_channel_status_on_eng_pending_ctx_reload_v(void)
134{
135 return 0x0000000d;
136}
137static inline u32 ccsr_channel_status_on_eng_pending_acq_ctx_reload_v(void)
138{
139 return 0x0000000e;
140}
141static inline u32 ccsr_channel_next_v(u32 r)
142{
143 return (r >> 1) & 0x1;
144}
145static inline u32 ccsr_channel_next_true_v(void)
146{
147 return 0x00000001;
148}
113static inline u32 ccsr_channel_busy_v(u32 r) 149static inline u32 ccsr_channel_busy_v(u32 r)
114{ 150{
115 return (r >> 28) & 0x1; 151 return (r >> 28) & 0x1;