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 <sanjain@nvidia.com>
Reviewed-on: http://git-master/r/395131
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Sandarbh Jain
2014-04-11 14:46:11 +05:30
committed by Dan Willemsen
parent 6107c44ecd
commit ebe7f110a1

View File

@@ -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);
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;