summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/os/linux/ioctl_dbg.c
diff options
context:
space:
mode:
authorVaibhav Kachore <vkachore@nvidia.com>2018-07-06 05:40:03 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-07-10 21:13:43 -0400
commite14fdcd8f1f4125da697433b1744b1e4e4f15b09 (patch)
treef48ff794ef77e977ccba397f5abf14f5ae7b185b /drivers/gpu/nvgpu/os/linux/ioctl_dbg.c
parent4cd59404a2d4ab1c31605d96cff848dd4e93c3b4 (diff)
gpu: nvgpu: enable HWPM Mode-E context switch
- Write new pm mode to context buffer header. Ucode use this mode to enable mode-e context switch. This is Mode-B context switch of PMs with Mode-E streamout on one context. If this mode is set, Ucode makes sure that Mode-E pipe (perfmons, routers, pma) is idle before it context switches PMs. - This allows us to collect counters in a secure way (i.e. on context basis) with stream out. Bug 2106999 Change-Id: I5a7435f09d1bf053ca428e538b0a57f3a175ac37 Signed-off-by: Vaibhav Kachore <vkachore@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1760366 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/os/linux/ioctl_dbg.c')
-rw-r--r--drivers/gpu/nvgpu/os/linux/ioctl_dbg.c24
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
1047static 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
1042static int nvgpu_dbg_gpu_ioctl_hwpm_ctxsw_mode(struct dbg_session_gk20a *dbg_s, 1062static 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);