summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.c28
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)