gpu: nvgpu: stop ELPG init thread during unload

ELPG initialization thread creation can fail when the process is killed.
That leads to driver resume failure.

That thread was stopped on suspend and re-created on resume. To avoid
the issue above, don't stop the ELPG thread in suspend and let the
first created thread handle the ELPG state transitions always.
And stop the ELPG thread during unload.

Also fix couple of instances of config flag as:

s/CONFIG_PMU_POWER_PG/CONFIG_NVGPU_POWER_PG

bug 3345977

Change-Id: I8952edf8d1664ed258f238e265002e716d1bf5c2
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2573763
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: Ashish Mhetre <amhetre@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Sagar Kamble
2021-08-10 16:58:04 +05:30
committed by mobile promotions
parent 40064ef1ec
commit f4571194b0
2 changed files with 10 additions and 6 deletions

View File

@@ -704,8 +704,8 @@ static int pmu_pg_task(void *arg)
case PMU_FW_STATE_LOADING_ZBC:
nvgpu_pmu_dbg(g, "loaded zbc");
err = pmu_pg_setup_hw_enable_elpg(g, pmu, pmu->pg);
nvgpu_pmu_dbg(g, "PMU booted, thread exiting");
return 0;
nvgpu_pmu_dbg(g, "PMU booted");
break;
default:
nvgpu_pmu_dbg(g, "invalid state");
err = -EINVAL;
@@ -797,6 +797,10 @@ int nvgpu_pmu_pg_sw_setup(struct gk20a *g, struct nvgpu_pmu *pmu,
}
}
if (nvgpu_thread_is_running(&pg->pg_init.state_task)) {
return 0;
}
/* Create thread to handle PMU state machine */
return pmu_pg_task_init(g, pg);
}
@@ -810,8 +814,6 @@ void nvgpu_pmu_pg_destroy(struct gk20a *g, struct nvgpu_pmu *pmu,
return;
}
pmu_pg_kill_task(g, pmu, pg);
nvgpu_pmu_get_pg_stats(g,
PMU_PG_ELPG_ENGINE_ID_GRAPHICS, &pg_stat_data);
@@ -905,6 +907,8 @@ void nvgpu_pmu_pg_deinit(struct gk20a *g, struct nvgpu_pmu *pmu,
return;
}
pmu_pg_kill_task(g, pmu, pg);
if (nvgpu_mem_is_valid(&pg->seq_buf)) {
nvgpu_dma_unmap_free(vm, &pg->seq_buf);
}

View File

@@ -91,7 +91,7 @@ int nvgpu_pmu_lock_release(struct gk20a *g, struct nvgpu_pmu *pmu,
return 0;
}
#ifdef CONFIG_PMU_POWER_PG
#ifdef CONFIG_NVGPU_POWER_PG
if (!pmu->pg->initialized) {
return -EINVAL;
}
@@ -169,7 +169,7 @@ static void remove_pmu_support(struct nvgpu_pmu *pmu)
nvgpu_pmu_debug_deinit(g, pmu);
nvgpu_pmu_lsfm_deinit(g, pmu, pmu->lsfm);
#ifdef CONFIG_PMU_POWER_PG
#ifdef CONFIG_NVGPU_POWER_PG
nvgpu_pmu_pg_deinit(g, pmu, pmu->pg);
#endif
nvgpu_pmu_sequences_deinit(g, pmu, pmu->sequences);