From e45e7b5cf87eaf94cf22e631c906170890233d8e Mon Sep 17 00:00:00 2001 From: Debarshi Dutta Date: Fri, 15 Nov 2019 14:59:31 +0530 Subject: gpu: nvgpu: move cg_enable after pmu_init is complete This patch help resolve the boot time failures happening with pmu_exterr for porg. cg_enable can race with pmu_init thread, cg_enable is moved post pmu init thread to avoid the above race. Bug 200565050 Change-Id: I2192053eff8767847ea012ca20b3607d2f6cd26f Signed-off-by: Debarshi Dutta Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2239959 Tested-by: mobile promotions Reviewed-by: svc-mobile-coverity Reviewed-by: Sagar Kamble Reviewed-by: Bibek Basu Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/pmu/pmu.c | 9 +++++++- drivers/gpu/nvgpu/common/power_features/cg/cg.c | 30 ++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/nvgpu/common') diff --git a/drivers/gpu/nvgpu/common/pmu/pmu.c b/drivers/gpu/nvgpu/common/pmu/pmu.c index 8d051e5a..59d38277 100644 --- a/drivers/gpu/nvgpu/common/pmu/pmu.c +++ b/drivers/gpu/nvgpu/common/pmu/pmu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -526,6 +526,13 @@ static int nvgpu_pg_init_task(void *arg) nvgpu_pmu_dbg(g, "loaded zbc"); pmu_setup_hw_enable_elpg(g); nvgpu_pmu_dbg(g, "PMU booted, thread exiting"); + + gk20a_gr_wait_initialized(g); + + nvgpu_cg_blcg_enable_no_wait(g); + + nvgpu_cg_elcg_enable_no_wait(g); + return 0; default: nvgpu_pmu_dbg(g, "invalid state"); diff --git a/drivers/gpu/nvgpu/common/power_features/cg/cg.c b/drivers/gpu/nvgpu/common/power_features/cg/cg.c index 39796bc8..a966c4c6 100644 --- a/drivers/gpu/nvgpu/common/power_features/cg/cg.c +++ b/drivers/gpu/nvgpu/common/power_features/cg/cg.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -84,6 +84,34 @@ void nvgpu_cg_elcg_disable_no_wait(struct gk20a *g) nvgpu_mutex_release(&g->cg_pg_lock); } +void nvgpu_cg_blcg_disable_no_wait(struct gk20a *g) { + nvgpu_log_fn(g, " "); + + if (!nvgpu_is_enabled(g, NVGPU_GPU_CAN_BLCG)) { + return; + } + + nvgpu_mutex_acquire(&g->cg_pg_lock); + if (g->blcg_enabled) { + nvgpu_cg_set_mode(g, BLCG_MODE, BLCG_RUN); + } + nvgpu_mutex_release(&g->cg_pg_lock); +} + +void nvgpu_cg_blcg_enable_no_wait(struct gk20a *g) { + nvgpu_log_fn(g, " "); + + if (!nvgpu_is_enabled(g, NVGPU_GPU_CAN_BLCG)) { + return; + } + + nvgpu_mutex_acquire(&g->cg_pg_lock); + if (g->blcg_enabled) { + nvgpu_cg_set_mode(g, BLCG_MODE, BLCG_AUTO); + } + nvgpu_mutex_release(&g->cg_pg_lock); +} + void nvgpu_cg_elcg_enable(struct gk20a *g) { nvgpu_log_fn(g, " "); -- cgit v1.2.2