summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/fifo/channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/fifo/channel.c')
-rw-r--r--drivers/gpu/nvgpu/common/fifo/channel.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/drivers/gpu/nvgpu/common/fifo/channel.c b/drivers/gpu/nvgpu/common/fifo/channel.c
index cbffb6de..4b76dcdd 100644
--- a/drivers/gpu/nvgpu/common/fifo/channel.c
+++ b/drivers/gpu/nvgpu/common/fifo/channel.c
@@ -164,28 +164,26 @@ int gk20a_enable_channel_tsg(struct gk20a *g, struct channel_gk20a *ch)
164{ 164{
165 struct tsg_gk20a *tsg; 165 struct tsg_gk20a *tsg;
166 166
167 if (gk20a_is_channel_marked_as_tsg(ch)) { 167 tsg = tsg_gk20a_from_ch(ch);
168 tsg = &g->fifo.tsg[ch->tsgid]; 168 if (tsg != NULL) {
169 g->ops.fifo.enable_tsg(tsg); 169 g->ops.fifo.enable_tsg(tsg);
170 return 0;
170 } else { 171 } else {
171 g->ops.fifo.enable_channel(ch); 172 return -EINVAL;
172 } 173 }
173
174 return 0;
175} 174}
176 175
177int gk20a_disable_channel_tsg(struct gk20a *g, struct channel_gk20a *ch) 176int gk20a_disable_channel_tsg(struct gk20a *g, struct channel_gk20a *ch)
178{ 177{
179 struct tsg_gk20a *tsg; 178 struct tsg_gk20a *tsg;
180 179
181 if (gk20a_is_channel_marked_as_tsg(ch)) { 180 tsg = tsg_gk20a_from_ch(ch);
182 tsg = &g->fifo.tsg[ch->tsgid]; 181 if (tsg != NULL) {
183 g->ops.fifo.disable_tsg(tsg); 182 g->ops.fifo.disable_tsg(tsg);
183 return 0;
184 } else { 184 } else {
185 g->ops.fifo.disable_channel(ch); 185 return -EINVAL;
186 } 186 }
187
188 return 0;
189} 187}
190 188
191void gk20a_channel_abort_clean_up(struct channel_gk20a *ch) 189void gk20a_channel_abort_clean_up(struct channel_gk20a *ch)
@@ -238,19 +236,8 @@ void gk20a_channel_abort(struct channel_gk20a *ch, bool channel_preempt)
238 236
239 if (tsg != NULL) { 237 if (tsg != NULL) {
240 return gk20a_fifo_abort_tsg(ch->g, tsg, channel_preempt); 238 return gk20a_fifo_abort_tsg(ch->g, tsg, channel_preempt);
241 } 239 } else {
242 240 nvgpu_err(ch->g, "chid: %d is not bound to tsg", ch->chid);
243 /* make sure new kickoffs are prevented */
244 gk20a_channel_set_timedout(ch);
245
246 ch->g->ops.fifo.disable_channel(ch);
247
248 if (channel_preempt) {
249 ch->g->ops.fifo.preempt_channel(ch->g, ch);
250 }
251
252 if (ch->g->ops.fifo.ch_abort_clean_up) {
253 ch->g->ops.fifo.ch_abort_clean_up(ch);
254 } 241 }
255} 242}
256 243