gpu: nvgpu: update pmu_early_init

Move the setting of power features related enable flags to separate
static function. Invoke this function when PMU is not supported.

JIRA NVGPU-9283

Change-Id: I429504c09d40c2cb115fce7550555f06b1e384ed
Signed-off-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2817658
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Ramalingam C <ramalingamc@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Rajesh Devaraj
2022-11-28 11:39:29 +00:00
committed by mobile promotions
parent 373398a46b
commit 3b2b225c73
2 changed files with 28 additions and 16 deletions

View File

@@ -222,9 +222,11 @@ int nvgpu_engine_disable_activity(struct gk20a *g,
} }
#ifdef CONFIG_NVGPU_LS_PMU #ifdef CONFIG_NVGPU_LS_PMU
if (g->ops.pmu.is_pmu_supported(g)) { if (g->ops.pmu.is_pmu_supported != NULL) {
mutex_ret = nvgpu_pmu_lock_acquire(g, g->pmu, if (g->ops.pmu.is_pmu_supported(g)) {
mutex_ret = nvgpu_pmu_lock_acquire(g, g->pmu,
PMU_MUTEX_ID_FIFO, &token); PMU_MUTEX_ID_FIFO, &token);
}
} }
#endif #endif

View File

@@ -162,6 +162,24 @@ void nvgpu_pmu_remove_support(struct gk20a *g, struct nvgpu_pmu *pmu)
} }
} }
static void nvgpu_pmu_disable_features(struct gk20a *g)
{
g->support_ls_pmu = false;
/* Disable LS PMU global checkers */
#ifdef CONFIG_NVGPU_NON_FUSA
g->can_elpg = false;
g->elpg_enabled = false;
g->aelpg_enabled = false;
g->elpg_ms_enabled = false;
#endif
nvgpu_set_enabled(g, NVGPU_PMU_PERFMON, false);
nvgpu_set_enabled(g, NVGPU_ELPG_MS_ENABLED, false);
#ifdef CONFIG_NVGPU_DGPU
nvgpu_set_enabled(g, NVGPU_PMU_PSTATE, false);
#endif
}
/* PMU unit init */ /* PMU unit init */
int nvgpu_pmu_early_init(struct gk20a *g) int nvgpu_pmu_early_init(struct gk20a *g)
{ {
@@ -170,6 +188,11 @@ int nvgpu_pmu_early_init(struct gk20a *g)
nvgpu_log_fn(g, " "); nvgpu_log_fn(g, " ");
if (g->ops.pmu.is_pmu_supported == NULL) {
nvgpu_pmu_disable_features(g);
goto exit;
}
if (g->pmu != NULL) { if (g->pmu != NULL) {
/* skip alloc/reinit for unrailgate sequence */ /* skip alloc/reinit for unrailgate sequence */
nvgpu_pmu_dbg(g, "skip pmu init for unrailgate sequence"); nvgpu_pmu_dbg(g, "skip pmu init for unrailgate sequence");
@@ -208,20 +231,7 @@ int nvgpu_pmu_early_init(struct gk20a *g)
} }
if (!g->ops.pmu.is_pmu_supported(g)) { if (!g->ops.pmu.is_pmu_supported(g)) {
g->support_ls_pmu = false; nvgpu_pmu_disable_features(g);
/* Disable LS PMU global checkers */
#ifdef CONFIG_NVGPU_NON_FUSA
g->can_elpg = false;
g->elpg_enabled = false;
g->aelpg_enabled = false;
g->elpg_ms_enabled = false;
#endif
nvgpu_set_enabled(g, NVGPU_PMU_PERFMON, false);
nvgpu_set_enabled(g, NVGPU_ELPG_MS_ENABLED, false);
#ifdef CONFIG_NVGPU_DGPU
nvgpu_set_enabled(g, NVGPU_PMU_PSTATE, false);
#endif
goto exit; goto exit;
} }