summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
diff options
context:
space:
mode:
authorSeema Khowala <seemaj@nvidia.com>2017-06-21 00:50:36 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-06-29 16:28:54 -0400
commit2eea080584b36747d7f8a7d5120d60be25d12242 (patch)
treeee3e9c817ce917c0daf4352d563334aaa096e003 /drivers/gpu/nvgpu/gk20a/gr_gk20a.c
parent02d1e7ae979eedf74a27f0ec57bde85c06ba2d35 (diff)
gpu: nvgpu: Support multiple SM for t19x
-Add sm input param for handle_sm_exception and pre_process_sm_exception for gr ops/functions. -Add functions to calculate gpc and tpc reg offsets. -Add function to find SMs which raised SM exception. JIRA GPUT19X-75 Change-Id: I257e7342ddabadb1556c9551c50a54d34b0f9d1e Signed-off-by: Seema Khowala <seemaj@nvidia.com> Reviewed-on: https://git-master/r/1476108 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: David Martinez Nieto <dmartineznie@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gr_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gr_gk20a.c50
1 files changed, 45 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
index 2afa79f1..2ee2048c 100644
--- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
@@ -820,6 +820,23 @@ clean_up_mem:
820 return ret; 820 return ret;
821} 821}
822 822
823u32 gk20a_gr_gpc_offset(struct gk20a *g, u32 gpc)
824{
825 u32 gpc_stride = nvgpu_get_litter_value(g, GPU_LIT_GPC_STRIDE);
826 u32 gpc_offset = gpc_stride * gpc;
827
828 return gpc_offset;
829}
830
831u32 gk20a_gr_tpc_offset(struct gk20a *g, u32 tpc)
832{
833 u32 tpc_in_gpc_stride = nvgpu_get_litter_value(g,
834 GPU_LIT_TPC_IN_GPC_STRIDE);
835 u32 tpc_offset = tpc_in_gpc_stride * tpc;
836
837 return tpc_offset;
838}
839
823static int gr_gk20a_commit_global_cb_manager(struct gk20a *g, 840static int gr_gk20a_commit_global_cb_manager(struct gk20a *g,
824 struct channel_gk20a *c, bool patch) 841 struct channel_gk20a *c, bool patch)
825{ 842{
@@ -6163,7 +6180,7 @@ fail:
6163 return err; 6180 return err;
6164} 6181}
6165 6182
6166int gr_gk20a_handle_sm_exception(struct gk20a *g, u32 gpc, u32 tpc, 6183int gr_gk20a_handle_sm_exception(struct gk20a *g, u32 gpc, u32 tpc, u32 sm,
6167 bool *post_event, struct channel_gk20a *fault_ch, 6184 bool *post_event, struct channel_gk20a *fault_ch,
6168 u32 *hww_global_esr) 6185 u32 *hww_global_esr)
6169{ 6186{
@@ -6206,7 +6223,7 @@ int gr_gk20a_handle_sm_exception(struct gk20a *g, u32 gpc, u32 tpc,
6206 *hww_global_esr = global_esr; 6223 *hww_global_esr = global_esr;
6207 6224
6208 if (g->ops.gr.pre_process_sm_exception) { 6225 if (g->ops.gr.pre_process_sm_exception) {
6209 ret = g->ops.gr.pre_process_sm_exception(g, gpc, tpc, 6226 ret = g->ops.gr.pre_process_sm_exception(g, gpc, tpc, sm,
6210 global_esr, warp_esr, 6227 global_esr, warp_esr,
6211 sm_debugger_attached, 6228 sm_debugger_attached,
6212 fault_ch, 6229 fault_ch,
@@ -6290,6 +6307,12 @@ int gr_gk20a_handle_tex_exception(struct gk20a *g, u32 gpc, u32 tpc,
6290 return ret; 6307 return ret;
6291} 6308}
6292 6309
6310void gk20a_gr_get_esr_sm_sel(struct gk20a *g, u32 gpc, u32 tpc,
6311 u32 *esr_sm_sel)
6312{
6313 *esr_sm_sel = 1;
6314}
6315
6293static int gk20a_gr_handle_tpc_exception(struct gk20a *g, u32 gpc, u32 tpc, 6316static int gk20a_gr_handle_tpc_exception(struct gk20a *g, u32 gpc, u32 tpc,
6294 bool *post_event, struct channel_gk20a *fault_ch, 6317 bool *post_event, struct channel_gk20a *fault_ch,
6295 u32 *hww_global_esr) 6318 u32 *hww_global_esr)
@@ -6300,17 +6323,33 @@ static int gk20a_gr_handle_tpc_exception(struct gk20a *g, u32 gpc, u32 tpc,
6300 u32 offset = gpc_stride * gpc + tpc_in_gpc_stride * tpc; 6323 u32 offset = gpc_stride * gpc + tpc_in_gpc_stride * tpc;
6301 u32 tpc_exception = gk20a_readl(g, gr_gpc0_tpc0_tpccs_tpc_exception_r() 6324 u32 tpc_exception = gk20a_readl(g, gr_gpc0_tpc0_tpccs_tpc_exception_r()
6302 + offset); 6325 + offset);
6326 u32 sm_per_tpc = nvgpu_get_litter_value(g, GPU_LIT_NUM_SM_PER_TPC);
6303 6327
6304 gk20a_dbg(gpu_dbg_intr | gpu_dbg_gpu_dbg, ""); 6328 gk20a_dbg(gpu_dbg_intr | gpu_dbg_gpu_dbg, "");
6305 6329
6306 /* check if an sm exeption is pending */ 6330 /* check if an sm exeption is pending */
6307 if (gr_gpc0_tpc0_tpccs_tpc_exception_sm_v(tpc_exception) == 6331 if (gr_gpc0_tpc0_tpccs_tpc_exception_sm_v(tpc_exception) ==
6308 gr_gpc0_tpc0_tpccs_tpc_exception_sm_pending_v()) { 6332 gr_gpc0_tpc0_tpccs_tpc_exception_sm_pending_v()) {
6333 u32 esr_sm_sel, sm;
6334
6309 gk20a_dbg(gpu_dbg_intr | gpu_dbg_gpu_dbg, 6335 gk20a_dbg(gpu_dbg_intr | gpu_dbg_gpu_dbg,
6310 "GPC%d TPC%d: SM exception pending", gpc, tpc); 6336 "GPC%d TPC%d: SM exception pending", gpc, tpc);
6311 ret = g->ops.gr.handle_sm_exception(g, gpc, tpc, 6337 g->ops.gr.get_esr_sm_sel(g, gpc, tpc, &esr_sm_sel);
6312 post_event, fault_ch, 6338
6313 hww_global_esr); 6339 for (sm = 0; sm < sm_per_tpc; sm++) {
6340
6341 if (!(esr_sm_sel & (1 << sm)))
6342 continue;
6343
6344 gk20a_dbg(gpu_dbg_intr | gpu_dbg_gpu_dbg,
6345 "GPC%d TPC%d: SM%d exception pending",
6346 gpc, tpc, sm);
6347
6348 ret = g->ops.gr.handle_sm_exception(g,
6349 gpc, tpc, sm, post_event, fault_ch,
6350 hww_global_esr);
6351 }
6352
6314 } 6353 }
6315 6354
6316 /* check if a tex exeption is pending */ 6355 /* check if a tex exeption is pending */
@@ -9621,4 +9660,5 @@ void gk20a_init_gr_ops(struct gpu_ops *gops)
9621 gops->gr.resume_from_pause = gr_gk20a_resume_from_pause; 9660 gops->gr.resume_from_pause = gr_gk20a_resume_from_pause;
9622 gops->gr.clear_sm_errors = gr_gk20a_clear_sm_errors; 9661 gops->gr.clear_sm_errors = gr_gk20a_clear_sm_errors;
9623 gops->gr.tpc_enabled_exceptions = gr_gk20a_tpc_enabled_exceptions; 9662 gops->gr.tpc_enabled_exceptions = gr_gk20a_tpc_enabled_exceptions;
9663 gops->gr.get_esr_sm_sel = gk20a_gr_get_esr_sm_sel;
9624} 9664}