summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Fu <danifu@nvidia.com>2018-07-04 11:56:26 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-07-18 17:26:12 -0400
commit96d53bff8598a44fcec3f2492c8ec630d71d5dd0 (patch)
tree3f6572646bfb21d3fb3cbf130164f94295a45a55
parent77dc80699c3be6c25e3b8f9e164e9f3084d9b938 (diff)
gpu: nvgpu: avoid redundant enable/disable PG
ELPG powergate is refcounted. We should not enable/disable it, if it's already so. Or it will break the PG disable/enable function. Bug 200410661 Change-Id: Ife60f373b877d1ffc441578ffa53fe0d4409eba6 Signed-off-by: Daniel Fu <danifu@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1774265 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com> Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
index ddf2039b..7ec9f5d3 100644
--- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
@@ -232,7 +232,12 @@ int dbg_set_powergate(struct dbg_session_gk20a *dbg_s, bool disable_powergate)
232 return err; 232 return err;
233 233
234 /*do elpg disable before clock gating */ 234 /*do elpg disable before clock gating */
235 nvgpu_pmu_pg_global_enable(g, false); 235
236 /* we should not disabled it again, if it's already so */
237 if (g->elpg_enabled) {
238 g->elpg_enabled = false;
239 nvgpu_pmu_pg_global_enable(g, false);
240 }
236 241
237 if (g->ops.clock_gating.slcg_gr_load_gating_prod) 242 if (g->ops.clock_gating.slcg_gr_load_gating_prod)
238 g->ops.clock_gating.slcg_gr_load_gating_prod(g, 243 g->ops.clock_gating.slcg_gr_load_gating_prod(g,
@@ -276,7 +281,12 @@ int dbg_set_powergate(struct dbg_session_gk20a *dbg_s, bool disable_powergate)
276 slcg_gr_load_gating_prod(g, 281 slcg_gr_load_gating_prod(g,
277 g->slcg_enabled); 282 g->slcg_enabled);
278 } 283 }
279 nvgpu_pmu_pg_global_enable(g, true); 284
285 /* we should not enable it again, if it's already so */
286 if (!g->elpg_enabled) {
287 g->elpg_enabled = true;
288 nvgpu_pmu_pg_global_enable(g, true);
289 }
280 290
281 nvgpu_log(g, gpu_dbg_gpu_dbg | gpu_dbg_fn, 291 nvgpu_log(g, gpu_dbg_gpu_dbg | gpu_dbg_fn,
282 "module idle"); 292 "module idle");