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>
This commit is contained in:
Konsta Holtta
2014-11-05 17:18:28 +02:00
committed by Dan Willemsen
parent e22d0082ec
commit 28f4e53e74

View File

@@ -2950,9 +2950,13 @@ static void gk20a_mm_l2_invalidate_locked(struct gk20a *g)
void gk20a_mm_l2_invalidate(struct gk20a *g)
{
struct mm_gk20a *mm = &g->mm;
mutex_lock(&mm->l2_op_lock);
gk20a_mm_l2_invalidate_locked(g);
mutex_unlock(&mm->l2_op_lock);
gk20a_busy_noresume(g->dev);
if (g->power_on) {
mutex_lock(&mm->l2_op_lock);
gk20a_mm_l2_invalidate_locked(g);
mutex_unlock(&mm->l2_op_lock);
}
pm_runtime_put_noidle(&g->dev->dev);
}
void gk20a_mm_l2_flush(struct gk20a *g, bool invalidate)
@@ -2963,6 +2967,10 @@ void gk20a_mm_l2_flush(struct gk20a *g, bool invalidate)
gk20a_dbg_fn("");
gk20a_busy_noresume(g->dev);
if (!g->power_on)
goto hw_was_off;
mutex_lock(&mm->l2_op_lock);
/* 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)
gk20a_mm_l2_invalidate_locked(g);
mutex_unlock(&mm->l2_op_lock);
hw_was_off:
pm_runtime_put_noidle(&g->dev->dev);
}