summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2015-12-18 01:53:05 -0500
committerSachin Nikam <snikam@nvidia.com>2016-01-13 01:59:24 -0500
commit4bc0a42f32f16b2050b9f190909d0d5df4d80e44 (patch)
tree6b2d449853a518746980e0ba348f7fb17348957c /drivers/gpu/nvgpu/gk20a/gr_gk20a.c
parentca76b336b32dce2e57034fbd44a273c539f67a54 (diff)
gpu: nvgpu: APIs to suspend/resume single SM
Add below APIs to suspend or resume single SM : gk20a_suspend_single_sm() gk20a_resume_single_sm() Also, update gk20a_suspend_all_sms() to make it more generic by passing global_esr_mask and check_errors flag as parameter Bug 200156699 Change-Id: If40f4bcae74a8132673b4dca10b7d9898f23c164 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/925884 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gr_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gr_gk20a.c80
1 files changed, 76 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
index 6f4669f2..7f02dc43 100644
--- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
@@ -7021,7 +7021,42 @@ int gk20a_gr_wait_for_sm_lock_down(struct gk20a *g, u32 gpc, u32 tpc,
7021 return -EAGAIN; 7021 return -EAGAIN;
7022} 7022}
7023 7023
7024void gk20a_suspend_all_sms(struct gk20a *g) 7024void gk20a_suspend_single_sm(struct gk20a *g,
7025 u32 gpc, u32 tpc,
7026 u32 global_esr_mask, bool check_errors)
7027{
7028 u32 offset;
7029 int err;
7030 u32 dbgr_control0;
7031
7032 offset = proj_gpc_stride_v() * gpc +
7033 proj_tpc_in_gpc_stride_v() * tpc;
7034
7035 /* if an SM debugger isn't attached, skip suspend */
7036 if (!gk20a_gr_sm_debugger_attached(g)) {
7037 gk20a_err(dev_from_gk20a(g),
7038 "SM debugger not attached, skipping suspend!\n");
7039 return;
7040 }
7041
7042 /* assert stop trigger. */
7043 dbgr_control0 = gk20a_readl(g,
7044 gr_gpc0_tpc0_sm_dbgr_control0_r() + offset);
7045 dbgr_control0 |= gr_gpcs_tpcs_sm_dbgr_control0_stop_trigger_enable_f();
7046 gk20a_writel(g, gr_gpc0_tpc0_sm_dbgr_control0_r() + offset,
7047 dbgr_control0);
7048
7049 err = gk20a_gr_wait_for_sm_lock_down(g, gpc, tpc,
7050 global_esr_mask, check_errors);
7051 if (err) {
7052 gk20a_err(dev_from_gk20a(g),
7053 "SuspendSm failed\n");
7054 return;
7055 }
7056}
7057
7058void gk20a_suspend_all_sms(struct gk20a *g,
7059 u32 global_esr_mask, bool check_errors)
7025{ 7060{
7026 struct gr_gk20a *gr = &g->gr; 7061 struct gr_gk20a *gr = &g->gr;
7027 u32 gpc, tpc; 7062 u32 gpc, tpc;
@@ -7030,8 +7065,8 @@ void gk20a_suspend_all_sms(struct gk20a *g)
7030 7065
7031 /* if an SM debugger isn't attached, skip suspend */ 7066 /* if an SM debugger isn't attached, skip suspend */
7032 if (!gk20a_gr_sm_debugger_attached(g)) { 7067 if (!gk20a_gr_sm_debugger_attached(g)) {
7033 gk20a_err(dev_from_gk20a(g), "SM debugger not attached, " 7068 gk20a_err(dev_from_gk20a(g),
7034 "skipping suspend!\n"); 7069 "SM debugger not attached, skipping suspend!\n");
7035 return; 7070 return;
7036 } 7071 }
7037 7072
@@ -7048,7 +7083,8 @@ void gk20a_suspend_all_sms(struct gk20a *g)
7048 for (gpc = 0; gpc < gr->gpc_count; gpc++) { 7083 for (gpc = 0; gpc < gr->gpc_count; gpc++) {
7049 for (tpc = 0; tpc < gr->tpc_count; tpc++) { 7084 for (tpc = 0; tpc < gr->tpc_count; tpc++) {
7050 err = 7085 err =
7051 gk20a_gr_wait_for_sm_lock_down(g, gpc, tpc, 0, false); 7086 gk20a_gr_wait_for_sm_lock_down(g, gpc, tpc,
7087 global_esr_mask, check_errors);
7052 if (err) { 7088 if (err) {
7053 gk20a_err(dev_from_gk20a(g), 7089 gk20a_err(dev_from_gk20a(g),
7054 "SuspendAllSms failed\n"); 7090 "SuspendAllSms failed\n");
@@ -7058,6 +7094,42 @@ void gk20a_suspend_all_sms(struct gk20a *g)
7058 } 7094 }
7059} 7095}
7060 7096
7097void gk20a_resume_single_sm(struct gk20a *g,
7098 u32 gpc, u32 tpc)
7099{
7100 u32 dbgr_control0;
7101 u32 offset;
7102 /*
7103 * The following requires some clarification. Despite the fact that both
7104 * RUN_TRIGGER and STOP_TRIGGER have the word "TRIGGER" in their
7105 * names, only one is actually a trigger, and that is the STOP_TRIGGER.
7106 * Merely writing a 1(_TASK) to the RUN_TRIGGER is not sufficient to
7107 * resume the gpu - the _STOP_TRIGGER must explicitly be set to 0
7108 * (_DISABLE) as well.
7109
7110 * Advice from the arch group: Disable the stop trigger first, as a
7111 * separate operation, in order to ensure that the trigger has taken
7112 * effect, before enabling the run trigger.
7113 */
7114
7115 offset = proj_gpc_stride_v() * gpc +
7116 proj_tpc_in_gpc_stride_v() * tpc;
7117
7118 /*De-assert stop trigger */
7119 dbgr_control0 =
7120 gk20a_readl(g, gr_gpc0_tpc0_sm_dbgr_control0_r() + offset);
7121 dbgr_control0 = set_field(dbgr_control0,
7122 gr_gpcs_tpcs_sm_dbgr_control0_stop_trigger_m(),
7123 gr_gpcs_tpcs_sm_dbgr_control0_stop_trigger_disable_f());
7124 gk20a_writel(g,
7125 gr_gpcs_tpcs_sm_dbgr_control0_r() + offset, dbgr_control0);
7126
7127 /* Run trigger */
7128 dbgr_control0 |= gr_gpcs_tpcs_sm_dbgr_control0_run_trigger_task_f();
7129 gk20a_writel(g,
7130 gr_gpc0_tpc0_sm_dbgr_control0_r() + offset, dbgr_control0);
7131}
7132
7061void gk20a_resume_all_sms(struct gk20a *g) 7133void gk20a_resume_all_sms(struct gk20a *g)
7062{ 7134{
7063 u32 dbgr_control0; 7135 u32 dbgr_control0;