From 56f8e5b878348d1ac7f0b133d395808e0caed769 Mon Sep 17 00:00:00 2001 From: Peter Daifuku Date: Tue, 8 Oct 2019 14:36:37 -0700 Subject: gpu: nvgpu: channel_setup_bind: must be bound to TSG In nvgpu_channel_setup_bind, return an error if the channel isn't bound to a TSG, as future operations rely on being bound. Bug 200543218 Change-Id: If33b01b8176c7488445c23080ad9d11f341bff43 Signed-off-by: Peter Daifuku Reviewed-on: https://git-master.nvidia.com/r/2215160 Reviewed-by: Thomas Fleury GVS: Gerrit_Virtual_Submit Reviewed-by: Luis Dib Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/fifo/channel.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'drivers/gpu/nvgpu/common/fifo') diff --git a/drivers/gpu/nvgpu/common/fifo/channel.c b/drivers/gpu/nvgpu/common/fifo/channel.c index 6ebeb596..0f4fe850 100644 --- a/drivers/gpu/nvgpu/common/fifo/channel.c +++ b/drivers/gpu/nvgpu/common/fifo/channel.c @@ -1136,6 +1136,7 @@ int nvgpu_channel_setup_bind(struct channel_gk20a *c, { struct gk20a *g = c->g; struct vm_gk20a *ch_vm; + struct tsg_gk20a *tsg; u32 gpfifo_size, gpfifo_entry_size; u64 gpfifo_gpu_va; int err = 0; @@ -1176,6 +1177,16 @@ int nvgpu_channel_setup_bind(struct channel_gk20a *c, err = -EINVAL; goto clean_up_idle; } + + /* The channel needs to be bound to a tsg at this point */ + tsg = tsg_gk20a_from_ch(c); + if (tsg == NULL) { + nvgpu_err(g, + "not bound to tsg at time of setup_bind"); + err = -EINVAL; + goto clean_up_idle; + } + ch_vm = c->vm; if (nvgpu_mem_is_valid(&c->gpfifo.mem) || -- cgit v1.2.2