summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
diff options
context:
space:
mode:
authorRichard Zhao <rizhao@nvidia.com>2016-12-28 19:28:11 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-01-06 18:02:24 -0500
commite229514bece5a109cdbfe263f6329efe987e5939 (patch)
tree5900d1bcf0067e1109ebfe1666f9ae19239c4006 /drivers/gpu/nvgpu/vgpu/gr_vgpu.c
parentecc3722aa1d7cd439035b0895781930871008a82 (diff)
gpu: nvgpu: vgpu: receive event TEGRA_VGPU_EVENT_SM_ESR
- allocate gr.sm_error_state - handle event of sm error state - add callback of clear sm error state JIRA VFND-3291 Bug 200257899 Change-Id: I49b9437013e8c65290750b7fe21fc6819ea93b1c Signed-off-by: Richard Zhao <rizhao@nvidia.com> Reviewed-on: http://git-master/r/1278397 Reviewed-by: Aingara Paramakuru <aparamakuru@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/gr_vgpu.c')
-rw-r--r--drivers/gpu/nvgpu/vgpu/gr_vgpu.c52
1 files changed, 51 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
index f1b498ca..02a5e87e 100644
--- a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Virtualized GPU Graphics 2 * Virtualized GPU Graphics
3 * 3 *
4 * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -837,6 +837,9 @@ static void vgpu_remove_gr_support(struct gr_gk20a *gr)
837 837
838 gk20a_comptag_allocator_destroy(&gr->comp_tags); 838 gk20a_comptag_allocator_destroy(&gr->comp_tags);
839 839
840 kfree(gr->sm_error_states);
841 gr->sm_error_states = NULL;
842
840 kfree(gr->gpc_tpc_mask); 843 kfree(gr->gpc_tpc_mask);
841 gr->gpc_tpc_mask = NULL; 844 gr->gpc_tpc_mask = NULL;
842 845
@@ -883,6 +886,14 @@ static int vgpu_gr_init_gr_setup_sw(struct gk20a *g)
883 886
884 mutex_init(&gr->ctx_mutex); 887 mutex_init(&gr->ctx_mutex);
885 888
889 gr->sm_error_states = kzalloc(
890 sizeof(struct nvgpu_dbg_gpu_sm_error_state_record) *
891 gr->no_of_sm, GFP_KERNEL);
892 if (!gr->sm_error_states) {
893 err = -ENOMEM;
894 goto clean_up;
895 }
896
886 gr->remove_support = vgpu_remove_gr_support; 897 gr->remove_support = vgpu_remove_gr_support;
887 gr->sw_ready = true; 898 gr->sw_ready = true;
888 899
@@ -1061,6 +1072,44 @@ static int vgpu_gr_update_hwpm_ctxsw_mode(struct gk20a *g,
1061 return err ? err : msg.ret; 1072 return err ? err : msg.ret;
1062} 1073}
1063 1074
1075static int vgpu_gr_clear_sm_error_state(struct gk20a *g,
1076 struct channel_gk20a *ch, u32 sm_id)
1077{
1078 struct gr_gk20a *gr = &g->gr;
1079
1080 mutex_lock(&g->dbg_sessions_lock);
1081 memset(&gr->sm_error_states[sm_id], 0, sizeof(*gr->sm_error_states));
1082 mutex_unlock(&g->dbg_sessions_lock);
1083
1084 return 0;
1085}
1086
1087void vgpu_gr_handle_sm_esr_event(struct gk20a *g,
1088 struct tegra_vgpu_sm_esr_info *info)
1089{
1090 struct nvgpu_dbg_gpu_sm_error_state_record *sm_error_states;
1091
1092 if (info->sm_id >= g->gr.no_of_sm) {
1093 gk20a_err(g->dev, "invalid smd_id %d / %d",
1094 info->sm_id, g->gr.no_of_sm);
1095 return;
1096 }
1097
1098 mutex_lock(&g->dbg_sessions_lock);
1099
1100 sm_error_states = &g->gr.sm_error_states[info->sm_id];
1101
1102 sm_error_states->hww_global_esr = info->hww_global_esr;
1103 sm_error_states->hww_warp_esr = info->hww_warp_esr;
1104 sm_error_states->hww_warp_esr_pc = info->hww_warp_esr_pc;
1105 sm_error_states->hww_global_esr_report_mask =
1106 info->hww_global_esr_report_mask;
1107 sm_error_states->hww_warp_esr_report_mask =
1108 info->hww_warp_esr_report_mask;
1109
1110 mutex_unlock(&g->dbg_sessions_lock);
1111}
1112
1064void vgpu_init_gr_ops(struct gpu_ops *gops) 1113void vgpu_init_gr_ops(struct gpu_ops *gops)
1065{ 1114{
1066 gops->gr.detect_sm_arch = vgpu_gr_detect_sm_arch; 1115 gops->gr.detect_sm_arch = vgpu_gr_detect_sm_arch;
@@ -1082,5 +1131,6 @@ void vgpu_init_gr_ops(struct gpu_ops *gops)
1082 gops->gr.set_sm_debug_mode = vgpu_gr_set_sm_debug_mode; 1131 gops->gr.set_sm_debug_mode = vgpu_gr_set_sm_debug_mode;
1083 gops->gr.update_smpc_ctxsw_mode = vgpu_gr_update_smpc_ctxsw_mode; 1132 gops->gr.update_smpc_ctxsw_mode = vgpu_gr_update_smpc_ctxsw_mode;
1084 gops->gr.update_hwpm_ctxsw_mode = vgpu_gr_update_hwpm_ctxsw_mode; 1133 gops->gr.update_hwpm_ctxsw_mode = vgpu_gr_update_hwpm_ctxsw_mode;
1134 gops->gr.clear_sm_error_state = vgpu_gr_clear_sm_error_state;
1085 gops->gr.dump_gr_regs = NULL; 1135 gops->gr.dump_gr_regs = NULL;
1086} 1136}