From ebe7f110a1d6ebb714354e2739e84e3799ca4b3b Mon Sep 17 00:00:00 2001 From: Sandarbh Jain Date: Fri, 11 Apr 2014 14:46:11 +0530 Subject: gpu: nvgpu: gk20a: Control powergating on regops Enable/disable powergating around regops so that the user need not call the powergating IOCTLs with the regops IOCTL. If the user does call the powergating IOCTL then the ref-counting will ensure the correct behavior. Bug 1451949 Change-Id: I1746f7d7cd1d2c0c497c213939df44a59d5d2834 Signed-off-by: Sandarbh Jain Reviewed-on: http://git-master/r/395131 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 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 d1dbf1b6..77806a5e 100644 --- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c @@ -460,7 +460,9 @@ static bool gr_context_info_available(struct dbg_session_gk20a *dbg_s, static int nvhost_ioctl_channel_reg_ops(struct dbg_session_gk20a *dbg_s, struct nvhost_dbg_gpu_exec_reg_ops_args *args) { - int err; + int err = 0, powergate_err = 0; + bool is_pg_disabled = false; + struct device *dev = dbg_s->dev; struct gk20a *g = get_gk20a(dbg_s->pdev); struct nvhost_dbg_gpu_reg_op *ops; @@ -503,10 +505,26 @@ static int nvhost_ioctl_channel_reg_ops(struct dbg_session_gk20a *dbg_s, * on other channels */ mutex_lock(&g->dbg_sessions_lock); - err = dbg_s->ops->exec_reg_ops(dbg_s, ops, args->num_ops); + if (!dbg_s->is_pg_disabled) { + powergate_err = dbg_set_powergate(dbg_s, + NVHOST_DBG_GPU_POWERGATE_MODE_DISABLE); + is_pg_disabled = true; + } + + if (!powergate_err) { + err = dbg_s->ops->exec_reg_ops(dbg_s, ops, args->num_ops); + /* enable powergate, if previously disabled */ + if (is_pg_disabled) { + powergate_err = dbg_set_powergate(dbg_s, + NVHOST_DBG_GPU_POWERGATE_MODE_ENABLE); + } + } mutex_unlock(&g->dbg_sessions_lock); + if (!err && powergate_err) + err = powergate_err; + if (err) { gk20a_err(dev, "dbg regops failed"); goto clean_up; -- cgit v1.2.2