diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2017-01-20 02:00:14 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-01-25 05:41:02 -0500 |
commit | 8613119529b37b78275092f274212b0a08e2e27d (patch) | |
tree | 6d626dc96d511c8ff324021bbb8e26107771e8bb /drivers/gpu | |
parent | bad0572cb1144ba08659aed88c311ae02c72c21c (diff) |
gpu: nvgpu: add target refcount for gk20a_wait_for_idle()
API gk20a_wait_for_idle() right now always waits for
0 usage count
But in case railgating is disabled through sysfs,
usage count will never get to 0
Hence in this case we should wait for usage count
of 1
If platform->user_railgate_disabled is set,
keep target usage count of 1, otherwise keep
target usage count as 0
Bug 200260926
Change-Id: I1a80621ca61babbd6566989dc09a7b20670c649c
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1291421
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 44786e4b..16acc1c9 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -1776,12 +1776,19 @@ void gk20a_driver_start_unload(struct gk20a *g) | |||
1776 | int gk20a_wait_for_idle(struct device *dev) | 1776 | int gk20a_wait_for_idle(struct device *dev) |
1777 | { | 1777 | { |
1778 | struct gk20a *g = get_gk20a(dev); | 1778 | struct gk20a *g = get_gk20a(dev); |
1779 | struct gk20a_platform *platform; | ||
1779 | int wait_length = 150; /* 3 second overall max wait. */ | 1780 | int wait_length = 150; /* 3 second overall max wait. */ |
1781 | int target_usage_count = 0; | ||
1780 | 1782 | ||
1781 | if (!g) | 1783 | if (!g) |
1782 | return -ENODEV; | 1784 | return -ENODEV; |
1783 | 1785 | ||
1784 | while (atomic_read(&g->usage_count) && wait_length-- >= 0) | 1786 | platform = dev_get_drvdata(dev); |
1787 | if (platform->user_railgate_disabled) | ||
1788 | target_usage_count = 1; | ||
1789 | |||
1790 | while ((atomic_read(&g->usage_count) != target_usage_count) | ||
1791 | && (wait_length-- >= 0)) | ||
1785 | msleep(20); | 1792 | msleep(20); |
1786 | 1793 | ||
1787 | if (wait_length < 0) { | 1794 | if (wait_length < 0) { |