summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2014-08-06 02:33:45 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:10:47 -0400
commit2489960344b02fb8ca8f725a481ead527bb0da49 (patch)
tree5c7ceb0b69575f18175ecb6e5c5b30f7f11f7e39 /drivers/gpu/nvgpu/gk20a/pmu_gk20a.c
parentfff31d310c03a6e34234a133df694d4e4d777754 (diff)
gpu: nvgpu: remove redundant lock
"isr_enable_lock" was used to protect pmu's isr_enabled flag and pmu enable/disable calls Instead of this extra lock, we can reuse "isr_mutex" for this purpose Bug 200014542 Bug 200014887 Change-Id: Ifbb7d6108effc132266a20517820e470d52a7110 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/453348 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/pmu_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/pmu_gk20a.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c
index 06e7a4e6..8bdbb106 100644
--- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c
@@ -636,7 +636,6 @@ int gk20a_init_pmu(struct pmu_gk20a *pmu)
636 636
637 mutex_init(&pmu->elpg_mutex); 637 mutex_init(&pmu->elpg_mutex);
638 mutex_init(&pmu->isr_mutex); 638 mutex_init(&pmu->isr_mutex);
639 mutex_init(&pmu->isr_enable_lock);
640 mutex_init(&pmu->pmu_copy_lock); 639 mutex_init(&pmu->pmu_copy_lock);
641 mutex_init(&pmu->pmu_seq_lock); 640 mutex_init(&pmu->pmu_seq_lock);
642 641
@@ -2076,10 +2075,10 @@ int gk20a_init_pmu_setup_hw1(struct gk20a *g)
2076 2075
2077 gk20a_dbg_fn(""); 2076 gk20a_dbg_fn("");
2078 2077
2079 mutex_lock(&pmu->isr_enable_lock); 2078 mutex_lock(&pmu->isr_mutex);
2080 pmu_reset(pmu); 2079 pmu_reset(pmu);
2081 pmu->isr_enabled = true; 2080 pmu->isr_enabled = true;
2082 mutex_unlock(&pmu->isr_enable_lock); 2081 mutex_unlock(&pmu->isr_mutex);
2083 2082
2084 /* setup apertures - virtual */ 2083 /* setup apertures - virtual */
2085 gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_UCODE), 2084 gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_UCODE),
@@ -3192,14 +3191,12 @@ void gk20a_pmu_isr(struct gk20a *g)
3192 3191
3193 gk20a_dbg_fn(""); 3192 gk20a_dbg_fn("");
3194 3193
3195 mutex_lock(&pmu->isr_enable_lock); 3194 mutex_lock(&pmu->isr_mutex);
3196 if (!pmu->isr_enabled) { 3195 if (!pmu->isr_enabled) {
3197 mutex_unlock(&pmu->isr_enable_lock); 3196 mutex_unlock(&pmu->isr_mutex);
3198 return; 3197 return;
3199 } 3198 }
3200 3199
3201 mutex_lock(&pmu->isr_mutex);
3202
3203 mask = gk20a_readl(g, pwr_falcon_irqmask_r()) & 3200 mask = gk20a_readl(g, pwr_falcon_irqmask_r()) &
3204 gk20a_readl(g, pwr_falcon_irqdest_r()); 3201 gk20a_readl(g, pwr_falcon_irqdest_r());
3205 3202
@@ -3210,7 +3207,6 @@ void gk20a_pmu_isr(struct gk20a *g)
3210 if (!intr || pmu->pmu_state == PMU_STATE_OFF) { 3207 if (!intr || pmu->pmu_state == PMU_STATE_OFF) {
3211 gk20a_writel(g, pwr_falcon_irqsclr_r(), intr); 3208 gk20a_writel(g, pwr_falcon_irqsclr_r(), intr);
3212 mutex_unlock(&pmu->isr_mutex); 3209 mutex_unlock(&pmu->isr_mutex);
3213 mutex_unlock(&pmu->isr_enable_lock);
3214 return; 3210 return;
3215 } 3211 }
3216 3212
@@ -3243,7 +3239,6 @@ void gk20a_pmu_isr(struct gk20a *g)
3243 } 3239 }
3244 3240
3245 mutex_unlock(&pmu->isr_mutex); 3241 mutex_unlock(&pmu->isr_mutex);
3246 mutex_unlock(&pmu->isr_enable_lock);
3247} 3242}
3248 3243
3249static bool pmu_validate_cmd(struct pmu_gk20a *pmu, struct pmu_cmd *cmd, 3244static bool pmu_validate_cmd(struct pmu_gk20a *pmu, struct pmu_cmd *cmd,
@@ -3661,10 +3656,10 @@ int gk20a_pmu_destroy(struct gk20a *g)
3661 g->pg_ungating_time_us += (u64)elpg_ungating_time; 3656 g->pg_ungating_time_us += (u64)elpg_ungating_time;
3662 g->pg_gating_cnt += gating_cnt; 3657 g->pg_gating_cnt += gating_cnt;
3663 3658
3664 mutex_lock(&pmu->isr_enable_lock); 3659 mutex_lock(&pmu->isr_mutex);
3665 pmu_enable(pmu, false); 3660 pmu_enable(pmu, false);
3666 pmu->isr_enabled = false; 3661 pmu->isr_enabled = false;
3667 mutex_unlock(&pmu->isr_enable_lock); 3662 mutex_unlock(&pmu->isr_mutex);
3668 3663
3669 pmu->pmu_state = PMU_STATE_OFF; 3664 pmu->pmu_state = PMU_STATE_OFF;
3670 pmu->pmu_ready = false; 3665 pmu->pmu_ready = false;