diff options
Diffstat (limited to 'drivers/gpu/nvgpu/os')
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/ioctl_dbg.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_dbg.c b/drivers/gpu/nvgpu/os/linux/ioctl_dbg.c index 31e7e2cb..76ff25c0 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_dbg.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_dbg.c | |||
@@ -181,7 +181,9 @@ int gk20a_dbg_gpu_dev_release(struct inode *inode, struct file *filp) | |||
181 | * calling powergate/timeout enable ioctl | 181 | * calling powergate/timeout enable ioctl |
182 | */ | 182 | */ |
183 | nvgpu_mutex_acquire(&g->dbg_sessions_lock); | 183 | nvgpu_mutex_acquire(&g->dbg_sessions_lock); |
184 | g->ops.dbg_session_ops.dbg_set_powergate(dbg_s, false); | 184 | if (dbg_s->is_pg_disabled) { |
185 | nvgpu_set_powergate_locked(dbg_s, false); | ||
186 | } | ||
185 | nvgpu_dbg_timeout_enable(dbg_s, NVGPU_DBG_GPU_IOCTL_TIMEOUT_ENABLE); | 187 | nvgpu_dbg_timeout_enable(dbg_s, NVGPU_DBG_GPU_IOCTL_TIMEOUT_ENABLE); |
186 | 188 | ||
187 | /* If this session owned the perf buffer, release it */ | 189 | /* If this session owned the perf buffer, release it */ |
@@ -867,9 +869,10 @@ static int nvgpu_ioctl_channel_reg_ops(struct dbg_session_gk20a *dbg_s, | |||
867 | /* In the virtual case, the server will handle | 869 | /* In the virtual case, the server will handle |
868 | * disabling/enabling powergating when processing reg ops | 870 | * disabling/enabling powergating when processing reg ops |
869 | */ | 871 | */ |
870 | powergate_err = g->ops.dbg_session_ops.dbg_set_powergate(dbg_s, | 872 | powergate_err = nvgpu_set_powergate_locked(dbg_s, true); |
871 | true); | 873 | if (!powergate_err) { |
872 | is_pg_disabled = true; | 874 | is_pg_disabled = true; |
875 | } | ||
873 | } | 876 | } |
874 | 877 | ||
875 | if (!powergate_err) { | 878 | if (!powergate_err) { |
@@ -938,9 +941,8 @@ static int nvgpu_ioctl_channel_reg_ops(struct dbg_session_gk20a *dbg_s, | |||
938 | 941 | ||
939 | /* enable powergate, if previously disabled */ | 942 | /* enable powergate, if previously disabled */ |
940 | if (is_pg_disabled) { | 943 | if (is_pg_disabled) { |
941 | powergate_err = | 944 | powergate_err = nvgpu_set_powergate_locked(dbg_s, |
942 | g->ops.dbg_session_ops.dbg_set_powergate(dbg_s, | 945 | false); |
943 | false); | ||
944 | } | 946 | } |
945 | } | 947 | } |
946 | 948 | ||
@@ -964,14 +966,16 @@ static int nvgpu_ioctl_powergate_gk20a(struct dbg_session_gk20a *dbg_s, | |||
964 | g->name, args->mode); | 966 | g->name, args->mode); |
965 | 967 | ||
966 | nvgpu_mutex_acquire(&g->dbg_sessions_lock); | 968 | nvgpu_mutex_acquire(&g->dbg_sessions_lock); |
967 | if (args->mode == NVGPU_DBG_GPU_POWERGATE_MODE_DISABLE) { | 969 | if ((args->mode != NVGPU_DBG_GPU_POWERGATE_MODE_DISABLE) && |
968 | err = g->ops.dbg_session_ops.dbg_set_powergate(dbg_s, true); | 970 | (args->mode != NVGPU_DBG_GPU_POWERGATE_MODE_ENABLE)) { |
969 | } else if (args->mode == NVGPU_DBG_GPU_POWERGATE_MODE_ENABLE) { | ||
970 | err = g->ops.dbg_session_ops.dbg_set_powergate(dbg_s, false); | ||
971 | } else { | ||
972 | nvgpu_err(g, "invalid powergate mode"); | 971 | nvgpu_err(g, "invalid powergate mode"); |
973 | err = -EINVAL; | 972 | err = -EINVAL; |
973 | goto pg_err_end; | ||
974 | } | 974 | } |
975 | |||
976 | err = nvgpu_set_powergate_locked(dbg_s, | ||
977 | args->mode == NVGPU_DBG_GPU_POWERGATE_MODE_DISABLE); | ||
978 | pg_err_end: | ||
975 | nvgpu_mutex_release(&g->dbg_sessions_lock); | 979 | nvgpu_mutex_release(&g->dbg_sessions_lock); |
976 | return err; | 980 | return err; |
977 | } | 981 | } |
@@ -1053,7 +1057,7 @@ static int nvgpu_dbg_gpu_ioctl_hwpm_ctxsw_mode(struct dbg_session_gk20a *dbg_s, | |||
1053 | err = -EINVAL; | 1057 | err = -EINVAL; |
1054 | goto clean_up; | 1058 | goto clean_up; |
1055 | } | 1059 | } |
1056 | if (!dbg_s->is_pg_disabled) { | 1060 | if (g->dbg_powergating_disabled_refcount == 0) { |
1057 | nvgpu_err(g, "powergate is not disabled"); | 1061 | nvgpu_err(g, "powergate is not disabled"); |
1058 | err = -ENOSYS; | 1062 | err = -ENOSYS; |
1059 | goto clean_up; | 1063 | goto clean_up; |