From 619031ef03d570319e69545aba200f5b4684913a Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Thu, 10 Sep 2015 16:10:21 +0530 Subject: 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 Reviewed-on: http://git-master/r/796999 Tested-by: Sandarbh Jain Reviewed-by: Sandarbh Jain Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c index c1cca445..4a175a3c 100644 --- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c @@ -282,12 +282,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, NVGPU_DBG_GPU_POWERGATE_MODE_ENABLE); - dbg_s->ch = NULL; fput(dbg_s->ch_f); dbg_s->ch_f = NULL; @@ -303,6 +297,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)); @@ -310,6 +305,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, NVGPU_DBG_GPU_POWERGATE_MODE_ENABLE); + mutex_unlock(&g->dbg_sessions_lock); + kfree(dbg_s); return 0; } -- cgit v1.2.2