gpu: nvgpu: Enable ELPG when disabled due to reset
Mahantesh Kumbar [Wed, 9 Mar 2016 07:00:51 +0000 (12:00 +0530)]
Enable ELPG back whenever ELPG disable is done due to reset or recovery.
Otherwise elpg_refcnt mismatch doesn\222t engage ELPG correctly

Bug 200156347
Bug 1716764

Change-Id: I16dd47ebc647e631c1ace59099a36c92d4c3abb0
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: http://git-master/r/1027020
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Tested-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>

drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
drivers/gpu/nvgpu/gk20a/gr_gk20a.h

index fc68139..fff5108 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * GK20A Graphics FIFO (gr host)
  *
- * Copyright (c) 2011-2015, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2011-2016, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -777,6 +777,8 @@ void gk20a_fifo_reset_engine(struct gk20a *g, u32 engine_id)
                        /* resetting engine using mc_enable_r() is not
                        enough, we do full init sequence */
                        gk20a_gr_reset(g);
+               if (support_gk20a_pmu(g->dev) && g->elpg_enabled)
+                       gk20a_pmu_enable_elpg(g);
        }
        if (engine_id == top_device_info_type_enum_copy0_v())
                gk20a_reset(g, mc_enable_ce2_m());
@@ -1087,7 +1089,7 @@ static bool gk20a_fifo_handle_mmu_fault(
                           " deferring channel recovery to channel free");
                /* clear interrupt */
                gk20a_writel(g, fifo_intr_mmu_fault_id_r(), fault_id);
-               return verbose;
+               goto exit_enable;
        }
 
        /* clear interrupt */
@@ -1102,6 +1104,7 @@ static bool gk20a_fifo_handle_mmu_fault(
                     gr_gpfifo_ctl_access_enabled_f() |
                     gr_gpfifo_ctl_semaphore_access_enabled_f());
 
+exit_enable:
        /* It is safe to enable ELPG again. */
        if (support_gk20a_pmu(g->dev) && g->elpg_enabled)
                gk20a_pmu_enable_elpg(g);
index c6aa74c..cb63332 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * GK20A Graphics Engine
  *
- * Copyright (c) 2011-2015, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2011-2016, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -436,7 +436,10 @@ bool gk20a_gr_sm_debugger_attached(struct gk20a *g);
                int err = 0; \
                if (support_gk20a_pmu(g->dev)) \
                        err = gk20a_pmu_disable_elpg(g); \
-               if (err) return err; \
+               if (err) { \
+                       gk20a_pmu_enable_elpg(g); \
+                       return err; \
+               } \
                err = func; \
                if (support_gk20a_pmu(g->dev)) \
                        gk20a_pmu_enable_elpg(g); \