From 96cf9748a776e06ae9d9827b5e9adc58a6c25d80 Mon Sep 17 00:00:00 2001 From: Mahantesh Kumbar Date: Tue, 23 May 2017 17:03:28 +0530 Subject: gpu: nvgpu: nvgpu_thread to handle PMU state changes - Replaced schedule_worker() with nvgpu_thread along with nvgpu_cond_wait() to handle PMU state machine changes during boot. - Added new state "PMU_STATE_EXIT" to exit PMU state machine loop & wait for the thread stop signal. - In gk20a_init_pmu_setup_sw() thread creates & starts thread execution to handle PMU state changes. - In pmu_destroy() thread post PMU_STATE_EXIT & waits for pending operation to complete before thread destroy. JIRA NVGPU-56 Change-Id: I951208bf88e82c281e3e678ddc603d58aec5ab10 Signed-off-by: Mahantesh Kumbar Reviewed-on: http://git-master/r/1487882 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/pmu_gk20a.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/pmu_gk20a.h') diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h index cefb6577..cfcf3947 100644 --- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h @@ -307,8 +307,13 @@ struct pmu_pg_stats_data { #define PMU_STATE_LOADING_PG_BUF 5 /* Loading PG buf */ #define PMU_STATE_LOADING_ZBC 6 /* Loading ZBC buf */ #define PMU_STATE_STARTED 7 /* Fully unitialized */ +#define PMU_STATE_EXIT 8 /* Exit PMU state machine */ - +struct nvgpu_pg_init { + bool state_change; + struct nvgpu_cond wq; + struct nvgpu_thread state_task; +}; struct pmu_gk20a { @@ -356,7 +361,7 @@ struct pmu_gk20a { int pmu_state; #define PMU_ELPG_ENABLE_ALLOW_DELAY_MSEC 1 /* msec */ - struct work_struct pg_init; + struct nvgpu_pg_init pg_init; struct nvgpu_mutex pg_mutex; /* protect pg-RPPG/MSCG enable/disable */ struct nvgpu_mutex elpg_mutex; /* protect elpg enable/disable */ int elpg_refcnt; /* disable -1, enable +1, <=0 elpg disabled, > 0 elpg enabled */ @@ -440,7 +445,6 @@ int pmu_bootstrap(struct pmu_gk20a *pmu); int gk20a_init_pmu(struct pmu_gk20a *pmu); void pmu_dump_falcon_stats(struct pmu_gk20a *pmu); void gk20a_remove_pmu_support(struct pmu_gk20a *pmu); -void pmu_setup_hw(struct work_struct *work); void pmu_seq_init(struct pmu_gk20a *pmu); int gk20a_init_pmu(struct pmu_gk20a *pmu); -- cgit v1.2.2