summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2015-09-10 16:10:21 +0530
committerMatthew Pedro <mapedro@nvidia.com>2015-09-28 09:11:32 -0700
commitafcf72aa34f1575adfd26754c8c378e4ab2f1dca (patch)
tree2d1c91073ef54a691f58a113ecf065006916d20d /drivers/gpu
parent59a7c87a8083c85d85f251f73f1a07d207615289 (diff)
gpu: nvgpu: enable powergate always while releasing debug session
Currently, while releasing the debug session we enable powergate only if a channel is bound to session If a session has no channel bound to it, and has powergate disabled, then we do not enable powergate when that session is closed Fix this by calling dbg_set_powergate(POWERGATE_ENABLE) always while releasing the session Refcounting and sanity checks in dbg_set_powergate() will take care of situation if powergate was not disabled by the session in first place Bug 1679372 Change-Id: I4e027393c611d3e8ab4f20e195f31871086da736 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/796999 cherry picked from commit 671dff8cb0605f865c5da32bd889e2a6fcf133fe) Reviewed-on: http://git-master/r/801986 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
index 93d947ca8336..80ea1ffe7fe8 100644
--- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
@@ -274,12 +274,6 @@ static int dbg_unbind_channel_gk20a(struct dbg_session_gk20a *dbg_s)
--g->dbg_sessions;
- /* Powergate enable is called here as possibility of dbg_session
- * which called powergate disable ioctl, to be killed without calling
- * powergate enable ioctl
- */
- dbg_set_powergate(dbg_s, NVHOST_DBG_GPU_POWERGATE_MODE_ENABLE);
-
dbg_s->ch = NULL;
fput(dbg_s->ch_f);
dbg_s->ch_f = NULL;
@@ -295,6 +289,7 @@ static int dbg_unbind_channel_gk20a(struct dbg_session_gk20a *dbg_s)
int gk20a_dbg_gpu_dev_release(struct inode *inode, struct file *filp)
{
struct dbg_session_gk20a *dbg_s = filp->private_data;
+ struct gk20a *g = dbg_s->g;
gk20a_dbg(gpu_dbg_gpu_dbg | gpu_dbg_fn, "%s", dev_name(dbg_s->dev));
@@ -302,6 +297,14 @@ int gk20a_dbg_gpu_dev_release(struct inode *inode, struct file *filp)
if (dbg_s->ch)
dbg_unbind_channel_gk20a(dbg_s);
+ /* Powergate enable is called here as possibility of dbg_session
+ * which called powergate disable ioctl, to be killed without calling
+ * powergate enable ioctl
+ */
+ mutex_lock(&g->dbg_sessions_lock);
+ dbg_set_powergate(dbg_s, NVHOST_DBG_GPU_POWERGATE_MODE_ENABLE);
+ mutex_unlock(&g->dbg_sessions_lock);
+
kfree(dbg_s);
return 0;
}