summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2014-11-05 10:18:28 -0500
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:12:17 -0400
commit28f4e53e74e8ca93f59780167552db805b1da5c6 (patch)
treee3e93857144b4445845f033b43a60096e0addca9
parente22d0082ec96864c0689848945f6c41a5f1419af (diff)
gpu: nvgpu: l2 invalidate/flush for off devices
When doing l2 invalidate or l2 flush, first check if the hw is powered on. If it is not, nothing is done, as there are no hardware registers available. As a side-effect, this may race so that the hardware stays unrailgated. Change-Id: I8bdbfcee3545355435d4ae01476188eb1b8b8817 Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: http://git-master/r/594441 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
index f588d112..0d68464d 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
@@ -2950,9 +2950,13 @@ static void gk20a_mm_l2_invalidate_locked(struct gk20a *g)
2950void gk20a_mm_l2_invalidate(struct gk20a *g) 2950void gk20a_mm_l2_invalidate(struct gk20a *g)
2951{ 2951{
2952 struct mm_gk20a *mm = &g->mm; 2952 struct mm_gk20a *mm = &g->mm;
2953 mutex_lock(&mm->l2_op_lock); 2953 gk20a_busy_noresume(g->dev);
2954 gk20a_mm_l2_invalidate_locked(g); 2954 if (g->power_on) {
2955 mutex_unlock(&mm->l2_op_lock); 2955 mutex_lock(&mm->l2_op_lock);
2956 gk20a_mm_l2_invalidate_locked(g);
2957 mutex_unlock(&mm->l2_op_lock);
2958 }
2959 pm_runtime_put_noidle(&g->dev->dev);
2956} 2960}
2957 2961
2958void gk20a_mm_l2_flush(struct gk20a *g, bool invalidate) 2962void gk20a_mm_l2_flush(struct gk20a *g, bool invalidate)
@@ -2963,6 +2967,10 @@ void gk20a_mm_l2_flush(struct gk20a *g, bool invalidate)
2963 2967
2964 gk20a_dbg_fn(""); 2968 gk20a_dbg_fn("");
2965 2969
2970 gk20a_busy_noresume(g->dev);
2971 if (!g->power_on)
2972 goto hw_was_off;
2973
2966 mutex_lock(&mm->l2_op_lock); 2974 mutex_lock(&mm->l2_op_lock);
2967 2975
2968 /* Flush all dirty lines from the L2 to DRAM. Lines are left in the L2 2976 /* Flush all dirty lines from the L2 to DRAM. Lines are left in the L2
@@ -2992,6 +3000,9 @@ void gk20a_mm_l2_flush(struct gk20a *g, bool invalidate)
2992 gk20a_mm_l2_invalidate_locked(g); 3000 gk20a_mm_l2_invalidate_locked(g);
2993 3001
2994 mutex_unlock(&mm->l2_op_lock); 3002 mutex_unlock(&mm->l2_op_lock);
3003
3004hw_was_off:
3005 pm_runtime_put_noidle(&g->dev->dev);
2995} 3006}
2996 3007
2997 3008