gpu: nvgpu: acquire platforms clocks on floorsweeping gpc

bpmp will floorsweep GPCs as per parameters to tpc_pg_mask sysfs.
While doing that corresponding GPC clocks are also disabled.
nvgpu should re-initialize the clocks every time the
GPC/TPC pg_masks are passed to bpmp mrq.

Also print error when clk_prepare_enable fails.

Introduce platform->clks_lock to protect access to platform->clks
and platform->num_clks done from unrailgate/railgate and bpmp
mrq set calls from sysfs.

Acquire static_pg_lock in railgate path to synchronize railgate
with sysfs.

Bug 3688506

Change-Id: I3203d78b87289e7a847d78b3117e2d3119be3425
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2738920
(cherry picked from commit 28ddb0996f)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2741029
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Sagar Kamble
2022-07-02 22:12:02 +05:30
committed by mobile promotions
parent fb466b5b25
commit c99819ffd8
5 changed files with 60 additions and 11 deletions

View File

@@ -1177,12 +1177,17 @@ static int gk20a_pm_railgate(struct device *dev)
g->pstats.last_rail_ungate_complete);
#endif
nvgpu_mutex_acquire(&g->static_pg_lock);
ret = platform->railgate(dev);
if (ret) {
nvgpu_err(g, "failed to railgate platform, err=%d", ret);
nvgpu_mutex_release(&g->static_pg_lock);
return ret;
}
nvgpu_mutex_release(&g->static_pg_lock);
#ifdef CONFIG_DEBUG_FS
g->pstats.last_rail_gate_complete = jiffies;
#endif