diff options
author | Alex Waterman <alexw@nvidia.com> | 2016-12-16 15:29:34 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-01-18 19:46:33 -0500 |
commit | 6e2237ef622113b8fa1149aa48988a99fa30594f (patch) | |
tree | 1356c45dda5751f7094f37aa93019f1199b635fb /drivers/gpu/nvgpu/gk20a/mm_gk20a.c | |
parent | 8f5a42c4bf9c323b86452065d39ed7632b126561 (diff) |
gpu: nvgpu: Use timer API in gk20a code
Use the timers API in the gk20a code instead of Linux specific
API calls.
This also changes the behavior of several functions to wait for
the full timeout for each operation that can timeout. Previously
the timeout was shared across each operation.
Bug 1799159
Change-Id: I2bbed54630667b2b879b56a63a853266afc1e5d8
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1273826
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 74476fe4..b7ef21b3 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GK20A memory management | 2 | * GK20A memory management |
3 | * | 3 | * |
4 | * Copyright (c) 2011-2016, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -894,14 +894,17 @@ static int gk20a_vidmem_clear_all(struct gk20a *g) | |||
894 | } | 894 | } |
895 | 895 | ||
896 | if (gk20a_fence_out) { | 896 | if (gk20a_fence_out) { |
897 | unsigned long end_jiffies = jiffies + | 897 | struct nvgpu_timeout timeout; |
898 | msecs_to_jiffies(gk20a_get_gr_idle_timeout(g)); | 898 | |
899 | nvgpu_timeout_init(g, &timeout, | ||
900 | gk20a_get_gr_idle_timeout(g), | ||
901 | NVGPU_TIMER_CPU_TIMER); | ||
899 | 902 | ||
900 | do { | 903 | do { |
901 | unsigned int timeout = jiffies_to_msecs(end_jiffies - jiffies); | ||
902 | err = gk20a_fence_wait(gk20a_fence_out, | 904 | err = gk20a_fence_wait(gk20a_fence_out, |
903 | timeout); | 905 | gk20a_get_gr_idle_timeout(g)); |
904 | } while ((err == -ERESTARTSYS) && time_before(jiffies, end_jiffies)); | 906 | } while (err == -ERESTARTSYS && |
907 | !nvgpu_timeout_expired(&timeout)); | ||
905 | 908 | ||
906 | gk20a_fence_put(gk20a_fence_out); | 909 | gk20a_fence_put(gk20a_fence_out); |
907 | if (err) { | 910 | if (err) { |
@@ -3103,14 +3106,17 @@ static int gk20a_gmmu_clear_vidmem_mem(struct gk20a *g, struct mem_desc *mem) | |||
3103 | } | 3106 | } |
3104 | 3107 | ||
3105 | if (gk20a_last_fence) { | 3108 | if (gk20a_last_fence) { |
3106 | unsigned long end_jiffies = jiffies + | 3109 | struct nvgpu_timeout timeout; |
3107 | msecs_to_jiffies(gk20a_get_gr_idle_timeout(g)); | 3110 | |
3111 | nvgpu_timeout_init(g, &timeout, | ||
3112 | gk20a_get_gr_idle_timeout(g), | ||
3113 | NVGPU_TIMER_CPU_TIMER); | ||
3108 | 3114 | ||
3109 | do { | 3115 | do { |
3110 | unsigned int timeout = jiffies_to_msecs(end_jiffies - jiffies); | ||
3111 | err = gk20a_fence_wait(gk20a_last_fence, | 3116 | err = gk20a_fence_wait(gk20a_last_fence, |
3112 | timeout); | 3117 | gk20a_get_gr_idle_timeout(g)); |
3113 | } while ((err == -ERESTARTSYS) && time_before(jiffies, end_jiffies)); | 3118 | } while (err == -ERESTARTSYS && |
3119 | !nvgpu_timeout_expired(&timeout)); | ||
3114 | 3120 | ||
3115 | gk20a_fence_put(gk20a_last_fence); | 3121 | gk20a_fence_put(gk20a_last_fence); |
3116 | if (err) | 3122 | if (err) |