From 02d281d0776e2b8305b18823343a2ee972b72657 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 8 Nov 2017 02:59:31 -0800 Subject: gpu: nvgpu: remove use of linux specific powergate_mode flag In dbg_set_powergate(), we use flags NVGPU_DBG_GPU_POWERGATE_MODE_DISABLE/ENABLE which are defined in linux specific uapi header Hence we need to remove those flags from common code Update dbg_set_powergate() to receive boolean flag to disable/enable powergate instead of NVGPU_DBG_GPU_POWERGATE_MODE_DISABLE/ENABLE Also update corresponding HALs as per above change Jira NVGPU-259 Change-Id: I9c4eb30e29ea5ce0d8e25517a6a072fb9f0e92e5 Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/1594326 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/ioctl_dbg.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'drivers/gpu/nvgpu/common/linux') diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_dbg.c b/drivers/gpu/nvgpu/common/linux/ioctl_dbg.c index f8bdd19b..c8d7468e 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_dbg.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_dbg.c @@ -178,8 +178,7 @@ int gk20a_dbg_gpu_dev_release(struct inode *inode, struct file *filp) * calling powergate/timeout enable ioctl */ nvgpu_mutex_acquire(&g->dbg_sessions_lock); - g->ops.dbg_session_ops.dbg_set_powergate(dbg_s, - NVGPU_DBG_GPU_POWERGATE_MODE_ENABLE); + g->ops.dbg_session_ops.dbg_set_powergate(dbg_s, false); nvgpu_dbg_timeout_enable(dbg_s, NVGPU_DBG_GPU_IOCTL_TIMEOUT_ENABLE); /* If this session owned the perf buffer, release it */ @@ -651,7 +650,7 @@ static int nvgpu_ioctl_channel_reg_ops(struct dbg_session_gk20a *dbg_s, * disabling/enabling powergating when processing reg ops */ powergate_err = g->ops.dbg_session_ops.dbg_set_powergate(dbg_s, - NVGPU_DBG_GPU_POWERGATE_MODE_DISABLE); + true); is_pg_disabled = true; } @@ -701,7 +700,7 @@ static int nvgpu_ioctl_channel_reg_ops(struct dbg_session_gk20a *dbg_s, if (is_pg_disabled) { powergate_err = g->ops.dbg_session_ops.dbg_set_powergate(dbg_s, - NVGPU_DBG_GPU_POWERGATE_MODE_ENABLE); + false); } } @@ -725,7 +724,14 @@ static int nvgpu_ioctl_powergate_gk20a(struct dbg_session_gk20a *dbg_s, g->name, args->mode); nvgpu_mutex_acquire(&g->dbg_sessions_lock); - err = g->ops.dbg_session_ops.dbg_set_powergate(dbg_s, args->mode); + if (args->mode == NVGPU_DBG_GPU_POWERGATE_MODE_DISABLE) { + err = g->ops.dbg_session_ops.dbg_set_powergate(dbg_s, true); + } else if (args->mode == NVGPU_DBG_GPU_POWERGATE_MODE_ENABLE) { + err = g->ops.dbg_session_ops.dbg_set_powergate(dbg_s, false); + } else { + nvgpu_err(g, "invalid powergate mode"); + err = -EINVAL; + } nvgpu_mutex_release(&g->dbg_sessions_lock); return err; } -- cgit v1.2.2