From 4d8ad643d67ac4044f76976c4085a35fcc5d4095 Mon Sep 17 00:00:00 2001 From: Debarshi Dutta Date: Fri, 3 May 2019 14:11:52 +0530 Subject: gpu: nvgpu: wait for gr.initialized before changing cg/pg set gr.initialized to false in the beginning of gk20a_gr_reset() and set it to true at the end of successful execution of gk20a_gr_reset. Use gk20a_gr_wait_initialized() to enable/disable cg/pg functions to make sure engine is out of reset and initialized. Bug 2092051 Bug 2429295 Bug 2484211 Bug 1890287 Change-Id: Ic7b0b71382c6d852a625c603dad8609c43b7f20f Signed-off-by: Seema Khowala Signed-off-by: Debarshi Dutta (cherry-picked from 7e2f124fd12caf37172f12da8de65093622941a5 in dev-kernel) Reviewed-on: https://git-master.nvidia.com/r/2111038 GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/power_features/pg/pg.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'drivers/gpu/nvgpu/common/power_features/pg') diff --git a/drivers/gpu/nvgpu/common/power_features/pg/pg.c b/drivers/gpu/nvgpu/common/power_features/pg/pg.c index fa31f4e3..394c0824 100644 --- a/drivers/gpu/nvgpu/common/power_features/pg/pg.c +++ b/drivers/gpu/nvgpu/common/power_features/pg/pg.c @@ -46,6 +46,8 @@ int nvgpu_pg_elpg_enable(struct gk20a *g) return 0; } + gk20a_gr_wait_initialized(g); + nvgpu_mutex_acquire(&g->cg_pg_lock); if (g->elpg_enabled) { err = nvgpu_pmu_pg_global_enable(g, true); @@ -64,6 +66,8 @@ int nvgpu_pg_elpg_disable(struct gk20a *g) return 0; } + gk20a_gr_wait_initialized(g); + nvgpu_mutex_acquire(&g->cg_pg_lock); if (g->elpg_enabled) { err = nvgpu_pmu_pg_global_enable(g, false); @@ -83,6 +87,8 @@ int nvgpu_pg_elpg_set_elpg_enabled(struct gk20a *g, bool enable) return 0; } + gk20a_gr_wait_initialized(g); + nvgpu_mutex_acquire(&g->cg_pg_lock); if (enable) { if (!g->elpg_enabled) { -- cgit v1.2.2