diff options
Diffstat (limited to 'drivers/gpu/nvgpu/os/linux/ioctl_dbg.c')
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/ioctl_dbg.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_dbg.c b/drivers/gpu/nvgpu/os/linux/ioctl_dbg.c index 9c7608e9..d530492a 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_dbg.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_dbg.c | |||
@@ -1039,12 +1039,33 @@ static int nvgpu_dbg_gpu_ioctl_smpc_ctxsw_mode(struct dbg_session_gk20a *dbg_s, | |||
1039 | return err; | 1039 | return err; |
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | /* | ||
1043 | * Convert linux hwpm ctxsw mode type of the form of NVGPU_DBG_GPU_HWPM_CTXSW_MODE_* | ||
1044 | * into common hwpm ctxsw mode type of the form of NVGPU_DBG_HWPM_CTXSW_MODE_* | ||
1045 | */ | ||
1046 | |||
1047 | static u32 nvgpu_hwpm_ctxsw_mode_to_common_mode(u32 mode) | ||
1048 | { | ||
1049 | switch (mode){ | ||
1050 | case NVGPU_DBG_GPU_HWPM_CTXSW_MODE_NO_CTXSW: | ||
1051 | return NVGPU_DBG_HWPM_CTXSW_MODE_NO_CTXSW; | ||
1052 | case NVGPU_DBG_GPU_HWPM_CTXSW_MODE_CTXSW: | ||
1053 | return NVGPU_DBG_HWPM_CTXSW_MODE_CTXSW; | ||
1054 | case NVGPU_DBG_GPU_HWPM_CTXSW_MODE_STREAM_OUT_CTXSW: | ||
1055 | return NVGPU_DBG_HWPM_CTXSW_MODE_STREAM_OUT_CTXSW; | ||
1056 | } | ||
1057 | |||
1058 | return mode; | ||
1059 | } | ||
1060 | |||
1061 | |||
1042 | static int nvgpu_dbg_gpu_ioctl_hwpm_ctxsw_mode(struct dbg_session_gk20a *dbg_s, | 1062 | static int nvgpu_dbg_gpu_ioctl_hwpm_ctxsw_mode(struct dbg_session_gk20a *dbg_s, |
1043 | struct nvgpu_dbg_gpu_hwpm_ctxsw_mode_args *args) | 1063 | struct nvgpu_dbg_gpu_hwpm_ctxsw_mode_args *args) |
1044 | { | 1064 | { |
1045 | int err; | 1065 | int err; |
1046 | struct gk20a *g = dbg_s->g; | 1066 | struct gk20a *g = dbg_s->g; |
1047 | struct channel_gk20a *ch_gk20a; | 1067 | struct channel_gk20a *ch_gk20a; |
1068 | u32 mode = nvgpu_hwpm_ctxsw_mode_to_common_mode(args->mode); | ||
1048 | 1069 | ||
1049 | nvgpu_log_fn(g, "%s pm ctxsw mode = %d", g->name, args->mode); | 1070 | nvgpu_log_fn(g, "%s pm ctxsw mode = %d", g->name, args->mode); |
1050 | 1071 | ||
@@ -1080,7 +1101,8 @@ static int nvgpu_dbg_gpu_ioctl_hwpm_ctxsw_mode(struct dbg_session_gk20a *dbg_s, | |||
1080 | goto clean_up; | 1101 | goto clean_up; |
1081 | } | 1102 | } |
1082 | err = g->ops.gr.update_hwpm_ctxsw_mode(g, ch_gk20a, 0, | 1103 | err = g->ops.gr.update_hwpm_ctxsw_mode(g, ch_gk20a, 0, |
1083 | args->mode == NVGPU_DBG_GPU_HWPM_CTXSW_MODE_CTXSW); | 1104 | mode); |
1105 | |||
1084 | if (err) | 1106 | if (err) |
1085 | nvgpu_err(g, | 1107 | nvgpu_err(g, |
1086 | "error (%d) during pm ctxsw mode update", err); | 1108 | "error (%d) during pm ctxsw mode update", err); |