summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/gv11b/gr_gv11b.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
index 4f17a33c..84ff1335 100644
--- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
@@ -1772,7 +1772,8 @@ static int gr_gv11b_pre_process_sm_exception(struct gk20a *g,
1772 "CILP: Broadcasting STOP_TRIGGER from " 1772 "CILP: Broadcasting STOP_TRIGGER from "
1773 "gpc %d tpc %d sm %d", 1773 "gpc %d tpc %d sm %d",
1774 gpc, tpc, sm); 1774 gpc, tpc, sm);
1775 gk20a_suspend_all_sms(g, global_mask, false); 1775 g->ops.gr.suspend_all_sms(g,
1776 global_mask, false);
1776 1777
1777 gk20a_dbg_gpu_clear_broadcast_stop_trigger(fault_ch); 1778 gk20a_dbg_gpu_clear_broadcast_stop_trigger(fault_ch);
1778 } else { 1779 } else {
@@ -2798,6 +2799,51 @@ static void gv11b_gr_suspend_single_sm(struct gk20a *g,
2798 } 2799 }
2799} 2800}
2800 2801
2802static void gv11b_gr_suspend_all_sms(struct gk20a *g,
2803 u32 global_esr_mask, bool check_errors)
2804{
2805 struct gr_gk20a *gr = &g->gr;
2806 u32 gpc, tpc, sm;
2807 int err;
2808 u32 dbgr_control0;
2809 u32 sm_per_tpc = nvgpu_get_litter_value(g, GPU_LIT_NUM_SM_PER_TPC);
2810
2811 /* if an SM debugger isn't attached, skip suspend */
2812 if (!g->ops.gr.sm_debugger_attached(g)) {
2813 nvgpu_err(g,
2814 "SM debugger not attached, skipping suspend!");
2815 return;
2816 }
2817
2818 nvgpu_log(g, gpu_dbg_fn | gpu_dbg_gpu_dbg, "suspending all sms");
2819
2820 /* assert stop trigger. uniformity assumption: all SMs will have
2821 * the same state in dbg_control0.
2822 */
2823 dbgr_control0 =
2824 gk20a_readl(g, gr_gpc0_tpc0_sm0_dbgr_control0_r());
2825 dbgr_control0 |= gr_gpc0_tpc0_sm0_dbgr_control0_stop_trigger_enable_f();
2826
2827 /* broadcast write */
2828 gk20a_writel(g,
2829 gr_gpcs_tpcs_sms_dbgr_control0_r(), dbgr_control0);
2830
2831 for (gpc = 0; gpc < gr->gpc_count; gpc++) {
2832 for (tpc = 0; tpc < gr_gk20a_get_tpc_count(gr, gpc); tpc++) {
2833 for (sm = 0; sm < sm_per_tpc; sm++) {
2834 err = gk20a_gr_wait_for_sm_lock_down(g,
2835 gpc, tpc,
2836 global_esr_mask, check_errors);
2837 if (err) {
2838 nvgpu_err(g,
2839 "SuspendAllSms failed");
2840 return;
2841 }
2842 }
2843 }
2844 }
2845}
2846
2801void gv11b_init_gr(struct gpu_ops *gops) 2847void gv11b_init_gr(struct gpu_ops *gops)
2802{ 2848{
2803 gp10b_init_gr(gops); 2849 gp10b_init_gr(gops);
@@ -2868,4 +2914,5 @@ void gv11b_init_gr(struct gpu_ops *gops)
2868 gops->gr.set_hww_esr_report_mask = gv11b_gr_set_hww_esr_report_mask; 2914 gops->gr.set_hww_esr_report_mask = gv11b_gr_set_hww_esr_report_mask;
2869 gops->gr.sm_debugger_attached = gv11b_gr_sm_debugger_attached; 2915 gops->gr.sm_debugger_attached = gv11b_gr_sm_debugger_attached;
2870 gops->gr.suspend_single_sm = gv11b_gr_suspend_single_sm; 2916 gops->gr.suspend_single_sm = gv11b_gr_suspend_single_sm;
2917 gops->gr.suspend_all_sms = gv11b_gr_suspend_all_sms;
2871} 2918}