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 <kholtta@nvidia.com>
Reviewed-on: http://git-master/r/538887
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Konsta Holtta
2014-09-25 14:25:27 +03:00
committed by Dan Willemsen
parent 73720d2429
commit 45db2436c4

View File

@@ -626,7 +626,7 @@ void gk20a_free_channel(struct channel_gk20a *ch, bool finish)
if (!ch->bound) if (!ch->bound)
return; return;
if (!gk20a_channel_as_bound(ch) && !ch->vm) if (!gk20a_channel_as_bound(ch))
goto unbind; goto unbind;
gk20a_dbg_info("freeing bound channel context, timeout=%ld", gk20a_dbg_info("freeing bound channel context, timeout=%ld",
@@ -1126,8 +1126,7 @@ int gk20a_alloc_channel_gpfifo(struct channel_gk20a *c,
if (!gk20a_channel_as_bound(c)) { if (!gk20a_channel_as_bound(c)) {
gk20a_err(d, gk20a_err(d,
"not bound to an address space at time of gpfifo" "not bound to an address space at time of gpfifo"
" allocation. Attempting to create and bind to" " allocation.");
" one...");
return -EINVAL; return -EINVAL;
} }
ch_vm = c->vm; ch_vm = c->vm;
@@ -1525,6 +1524,14 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
!fence) !fence)
return -EINVAL; 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 #ifdef CONFIG_DEBUG_FS
/* update debug settings */ /* update debug settings */
if (g->ops.ltc.sync_debugfs) if (g->ops.ltc.sync_debugfs)