diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r-- | drivers/gpu/nvgpu/common/fifo/channel.c | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/fifo/tsg.c | 10 |
2 files changed, 12 insertions, 4 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 | ||
215 | void gk20a_channel_abort(struct channel_gk20a *ch, bool channel_preempt) | 215 | void 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 */ | ||
152 | int gk20a_tsg_unbind_channel(struct channel_gk20a *ch) | 154 | int 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 | ||