From 45db2436c40335a91c92f95509c6741ad13f6142 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Thu, 25 Sep 2014 14:25:27 +0300 Subject: gpu: nvgpu: require bound as before gpfifo submit Channel gpfifo cannot be submitted if the channel has no vm, so add a check for it and bail out if no as is bound. Clean up other similar checks too. Change-Id: Ibb0fe08e44e34bbaaa00ebd02dce6cc4d93ca5d9 Signed-off-by: Konsta Holtta Reviewed-on: http://git-master/r/538887 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 0b3b0202..fdeb8265 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -626,7 +626,7 @@ void gk20a_free_channel(struct channel_gk20a *ch, bool finish) if (!ch->bound) return; - if (!gk20a_channel_as_bound(ch) && !ch->vm) + if (!gk20a_channel_as_bound(ch)) goto unbind; gk20a_dbg_info("freeing bound channel context, timeout=%ld", @@ -1122,12 +1122,11 @@ int gk20a_alloc_channel_gpfifo(struct channel_gk20a *c, if (args->flags & NVHOST_ALLOC_GPFIFO_FLAGS_VPR_ENABLED) c->vpr = true; - /* an address space needs to have been bound at this point. */ + /* an address space needs to have been bound at this point. */ if (!gk20a_channel_as_bound(c)) { gk20a_err(d, "not bound to an address space at time of gpfifo" - " allocation. Attempting to create and bind to" - " one..."); + " allocation."); return -EINVAL; } ch_vm = c->vm; @@ -1525,6 +1524,14 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, !fence) return -EINVAL; + /* an address space needs to have been bound at this point. */ + if (!gk20a_channel_as_bound(c)) { + gk20a_err(d, + "not bound to an address space at time of gpfifo" + " submission."); + return -EINVAL; + } + #ifdef CONFIG_DEBUG_FS /* update debug settings */ if (g->ops.ltc.sync_debugfs) -- cgit v1.2.2