summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/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/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/gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c
index f6bb9445..10fa86a1 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.c
@@ -767,6 +767,10 @@ static int gk20a_pm_prepare_poweroff(struct device *dev)
767 if (!g->power_on) 767 if (!g->power_on)
768 goto done; 768 goto done;
769 769
770 if (gk20a_fifo_is_engine_busy(g)) {
771 mutex_unlock(&g->poweroff_lock);
772 return -EBUSY;
773 }
770 gk20a_scale_suspend(dev); 774 gk20a_scale_suspend(dev);
771 775
772 /* cancel any pending cde work */ 776 /* cancel any pending cde work */
@@ -1353,6 +1357,7 @@ static int gk20a_pm_runtime_suspend(struct device *dev)
1353fail_railgate: 1357fail_railgate:
1354 gk20a_pm_finalize_poweron(dev); 1358 gk20a_pm_finalize_poweron(dev);
1355fail: 1359fail:
1360 pm_runtime_mark_last_busy(dev);
1356 return err; 1361 return err;
1357} 1362}
1358 1363
@@ -1751,6 +1756,7 @@ int __gk20a_do_idle(struct device *dev, bool force_reset)
1751 msecs_to_jiffies(GK20A_WAIT_FOR_IDLE_MS); 1756 msecs_to_jiffies(GK20A_WAIT_FOR_IDLE_MS);
1752 int ref_cnt; 1757 int ref_cnt;
1753 bool is_railgated; 1758 bool is_railgated;
1759 int err = 0;
1754 1760
1755 /* acquire busy lock to block other busy() calls */ 1761 /* acquire busy lock to block other busy() calls */
1756 down_write(&g->busy_lock); 1762 down_write(&g->busy_lock);
@@ -1825,7 +1831,9 @@ int __gk20a_do_idle(struct device *dev, bool force_reset)
1825 */ 1831 */
1826 1832
1827 /* Save the GPU state */ 1833 /* Save the GPU state */
1828 gk20a_pm_prepare_poweroff(dev); 1834 err = gk20a_pm_prepare_poweroff(dev);
1835 if (err)
1836 goto fail_drop_usage_count;
1829 1837
1830 /* railgate GPU */ 1838 /* railgate GPU */
1831 platform->railgate(dev); 1839 platform->railgate(dev);