summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2016-08-03 16:04:38 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2016-09-15 15:23:37 -0400
commiteee2744d497213a503de927cbbfe179753f5e370 (patch)
treefd4570dfa75578c7227e00e653113b8765789e72 /drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
parent33665060728693c28ed5222a0d9004e261c63e82 (diff)
gpu: nvgpu: When powering down, abort if not idle
When trying to power down GPU the engine might be still busy. In this case delay power down by returning -EBUSY from gk20a_pm_runtime_suspend(). Bug 200224907 Change-Id: Ibad74c090add24a185bc1a7a02df367af9b95ced Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1213042 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fifo_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
index ff052400..2e38c4b6 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
@@ -3016,6 +3016,19 @@ bool gk20a_fifo_mmu_fault_pending(struct gk20a *g)
3016 return false; 3016 return false;
3017} 3017}
3018 3018
3019bool gk20a_fifo_is_engine_busy(struct gk20a *g)
3020{
3021 int i;
3022
3023 for (i = 0; i < fifo_engine_status__size_1_v(); i++) {
3024 u32 status = gk20a_readl(g, fifo_engine_status_r(i));
3025 if (fifo_engine_status_engine_v(status) ==
3026 fifo_engine_status_engine_busy_v())
3027 return true;
3028 }
3029 return false;
3030}
3031
3019int gk20a_fifo_wait_engine_idle(struct gk20a *g) 3032int gk20a_fifo_wait_engine_idle(struct gk20a *g)
3020{ 3033{
3021 unsigned long end_jiffies = jiffies + 3034 unsigned long end_jiffies = jiffies +
@@ -3023,7 +3036,6 @@ int gk20a_fifo_wait_engine_idle(struct gk20a *g)
3023 unsigned long delay = GR_IDLE_CHECK_DEFAULT; 3036 unsigned long delay = GR_IDLE_CHECK_DEFAULT;
3024 int ret = -ETIMEDOUT; 3037 int ret = -ETIMEDOUT;
3025 u32 i; 3038 u32 i;
3026 struct device *d = dev_from_gk20a(g);
3027 3039
3028 gk20a_dbg_fn(""); 3040 gk20a_dbg_fn("");
3029 3041
@@ -3041,7 +3053,7 @@ int gk20a_fifo_wait_engine_idle(struct gk20a *g)
3041 } while (time_before(jiffies, end_jiffies) || 3053 } while (time_before(jiffies, end_jiffies) ||
3042 !tegra_platform_is_silicon()); 3054 !tegra_platform_is_silicon());
3043 if (ret) { 3055 if (ret) {
3044 gk20a_err(d, "cannot idle engine %u\n", i); 3056 gk20a_dbg_info("cannot idle engine %u", i);
3045 break; 3057 break;
3046 } 3058 }
3047 } 3059 }