From 28f4e53e74e8ca93f59780167552db805b1da5c6 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Wed, 5 Nov 2014 17:18:28 +0200 Subject: 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 Reviewed-on: http://git-master/r/594441 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 17 ++++++++++++++--- 1 file 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) 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); } -- cgit v1.2.2