gpu: nvgpu: Protect elpg_stat access

- Protect the access of pmu->pg->elpg_stat using
  g->can_elpg protection
- Also, in pg public functions keep a check for 
  if lspmu and pg features are enabled.

JIRA NVGPU-3573

Change-Id: If4f25d4ab9df5e3e7257aaa9ed1e6d1fb9e431cf
Signed-off-by: Divya Singhatwaria <dsinghatwari@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2128351
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Divya Singhatwaria
2019-05-31 14:38:01 +05:30
committed by mobile promotions
parent 87379d2295
commit 8618135d6e
5 changed files with 35 additions and 11 deletions

View File

@@ -29,6 +29,10 @@ static int lpwr_debug_show(struct seq_file *s, void *data)
struct gk20a *g = s->private;
struct nvgpu_pmu *pmu = g->pmu;
if (!g->can_elpg) {
return 0;
}
if (pmu->pg->engines_feature_list &&
pmu->pg->engines_feature_list(g,
PMU_PG_ELPG_ENGINE_ID_GRAPHICS) !=
@@ -45,12 +49,13 @@ static int lpwr_debug_show(struct seq_file *s, void *data)
g->pmu->pg->elpg_stat, g->mscg_enabled,
g->pmu->pg->mscg_stat, g->pmu->pg->mscg_transition_state);
} else
} else {
seq_printf(s, "ELPG Enabled: %u\n"
"ELPG ref count: %u\n"
"ELPG state: %u\n",
g->elpg_enabled, g->pmu->pg->elpg_refcnt,
g->pmu->pg->elpg_stat);
}
return 0;