diff --git a/drivers/gpu/nvgpu/common/fifo/channel.c b/drivers/gpu/nvgpu/common/fifo/channel.c index 0fe9f0fbc..61d7fc5c9 100644 --- a/drivers/gpu/nvgpu/common/fifo/channel.c +++ b/drivers/gpu/nvgpu/common/fifo/channel.c @@ -2201,6 +2201,7 @@ int nvgpu_channel_setup_bind(struct nvgpu_channel *c, struct nvgpu_setup_bind_args *args) { struct gk20a *g = c->g; + struct nvgpu_tsg *tsg; int err = 0; #ifdef CONFIG_NVGPU_VPR @@ -2240,6 +2241,15 @@ int nvgpu_channel_setup_bind(struct nvgpu_channel *c, goto clean_up_idle; } + /* The channel needs to be bound to a tsg at this point */ + tsg = nvgpu_tsg_from_ch(c); + if (tsg == NULL) { + nvgpu_err(g, + "not bound to tsg at time of setup_bind"); + err = -EINVAL; + goto clean_up_idle; + } + if (c->usermode_submit_enabled) { nvgpu_err(g, "channel %d : " "usermode buffers allocated", c->chid); diff --git a/userspace/units/fifo/channel/nvgpu-channel.c b/userspace/units/fifo/channel/nvgpu-channel.c index 344db5fa8..cae6b8ebc 100644 --- a/userspace/units/fifo/channel/nvgpu-channel.c +++ b/userspace/units/fifo/channel/nvgpu-channel.c @@ -653,6 +653,9 @@ int test_channel_setup_bind(struct unit_module *m, privileged, getpid(), getpid()); assert(ch != NULL); + err = nvgpu_tsg_bind_channel(tsg, ch); + assert(err == 0); + g->ops.gr.intr.flush_channel_tlb = stub_gr_intr_flush_channel_tlb; g->ops.mm.cache.l2_flush = stub_mm_l2_flush; /* bug 2621189 */