diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2014-07-03 11:18:30 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:10:25 -0400 |
commit | 597083eaba3abd3e48b3c6bfafac3ef94606c2ad (patch) | |
tree | f37a367c5a3f90956aa3a61ef5b65dd1030a5421 /drivers/gpu/nvgpu/gk20a | |
parent | 7c5404fa426c6f38b8330b2f70db552e1bfaba72 (diff) |
gpu: nvgpu: increase delays in do_idle()
Increase the wait delays in do_idle() to 2000 mS and make use
of msleep instead of mdelays
Also, to check if GPU is rail gated or not, add a do-while()
loop which will keep checking the status and bail out as soon
as GPU is rail gated
This increase in delays is required to allow GPU sufficient
time to complete its work and get rail gated
These delays are specially needed during stress testing where
it is possible that a large amount of GPU work is blocked
during do_idle() and then it might take more time to complete
it while next do_idle() is waiting for it
Also, remove waiting on API gk20a_wait_channel_idle() for each
channels since it is sufficient to wait for refcount to be 1
bug 1529160
Change-Id: Ie541485fbdda76d79ae4a75dda928da240fc5d8f
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/434192
(cherry picked from commit 5a621bf2aaf3355e1330a662dc98e943d68ef86d)
Reviewed-on: http://git-master/r/435133
Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 64be9398..cd104580 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -76,6 +76,8 @@ u32 gk20a_dbg_mask = GK20A_DEFAULT_DBG_MASK; | |||
76 | u32 gk20a_dbg_ftrace; | 76 | u32 gk20a_dbg_ftrace; |
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | #define GK20A_WAIT_FOR_IDLE_MS 2000 | ||
80 | |||
79 | static int gk20a_pm_finalize_poweron(struct device *dev); | 81 | static int gk20a_pm_finalize_poweron(struct device *dev); |
80 | static int gk20a_pm_prepare_poweroff(struct device *dev); | 82 | static int gk20a_pm_prepare_poweroff(struct device *dev); |
81 | 83 | ||
@@ -1736,9 +1738,10 @@ int gk20a_do_idle(void) | |||
1736 | NULL, "gk20a.0")); | 1738 | NULL, "gk20a.0")); |
1737 | struct gk20a *g = get_gk20a(pdev); | 1739 | struct gk20a *g = get_gk20a(pdev); |
1738 | struct gk20a_platform *platform = dev_get_drvdata(&pdev->dev); | 1740 | struct gk20a_platform *platform = dev_get_drvdata(&pdev->dev); |
1739 | struct fifo_gk20a *f = &g->fifo; | 1741 | unsigned long timeout = jiffies + |
1740 | unsigned long timeout = jiffies + msecs_to_jiffies(200); | 1742 | msecs_to_jiffies(GK20A_WAIT_FOR_IDLE_MS); |
1741 | int chid, ref_cnt; | 1743 | int ref_cnt; |
1744 | bool is_railgated; | ||
1742 | 1745 | ||
1743 | if (!platform->can_railgate) | 1746 | if (!platform->can_railgate) |
1744 | return -ENOSYS; | 1747 | return -ENOSYS; |
@@ -1759,12 +1762,8 @@ int gk20a_do_idle(void) | |||
1759 | /* check and wait until GPU is idle (with a timeout) */ | 1762 | /* check and wait until GPU is idle (with a timeout) */ |
1760 | pm_runtime_barrier(&pdev->dev); | 1763 | pm_runtime_barrier(&pdev->dev); |
1761 | 1764 | ||
1762 | for (chid = 0; chid < f->num_channels; chid++) | ||
1763 | if (gk20a_wait_channel_idle(&f->channel[chid])) | ||
1764 | goto fail; | ||
1765 | |||
1766 | do { | 1765 | do { |
1767 | mdelay(1); | 1766 | msleep(1); |
1768 | ref_cnt = atomic_read(&pdev->dev.power.usage_count); | 1767 | ref_cnt = atomic_read(&pdev->dev.power.usage_count); |
1769 | } while (ref_cnt != 1 && time_before(jiffies, timeout)); | 1768 | } while (ref_cnt != 1 && time_before(jiffies, timeout)); |
1770 | 1769 | ||
@@ -1778,19 +1777,20 @@ int gk20a_do_idle(void) | |||
1778 | pm_runtime_put_sync(&pdev->dev); | 1777 | pm_runtime_put_sync(&pdev->dev); |
1779 | 1778 | ||
1780 | /* add sufficient delay to allow GPU to rail gate */ | 1779 | /* add sufficient delay to allow GPU to rail gate */ |
1781 | mdelay(platform->railgate_delay); | 1780 | msleep(platform->railgate_delay); |
1782 | 1781 | ||
1783 | if (platform->is_railgated(pdev)) | 1782 | timeout = jiffies + msecs_to_jiffies(GK20A_WAIT_FOR_IDLE_MS); |
1784 | return 0; | 1783 | |
1785 | else { | 1784 | /* check in loop if GPU is railgated or not */ |
1786 | /* wait for some more time */ | 1785 | do { |
1787 | mdelay(100); | 1786 | msleep(1); |
1788 | if (platform->is_railgated(pdev)) | 1787 | is_railgated = platform->is_railgated(pdev); |
1789 | return 0; | 1788 | } while (!is_railgated && time_before(jiffies, timeout)); |
1790 | } | ||
1791 | 1789 | ||
1792 | /* GPU is not rail gated by now, return error */ | 1790 | if (is_railgated) |
1793 | goto fail_timeout; | 1791 | return 0; |
1792 | else | ||
1793 | goto fail_timeout; | ||
1794 | 1794 | ||
1795 | fail: | 1795 | fail: |
1796 | pm_runtime_put_noidle(&pdev->dev); | 1796 | pm_runtime_put_noidle(&pdev->dev); |