summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2016-12-12 03:10:08 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2016-12-19 18:40:36 -0500
commit92fe0007496fd42983a6849b4f8dd5bc7d124834 (patch)
tree8d8469893fa630f428ba5036c6c63475ccc822d6 /drivers
parent8efeebaac53265428848fd64545ca10a6fd6e601 (diff)
gpu: nvgpu: rename timeout_check to timeout_expired
Change "check" to "expired" in nvgpu_timeout_check* and append _expired to nvgpu_timeout_peek to clarify what the boolean-like return value means and thus avoid bugs. Bug 200260715 Change-Id: I47e097ee922e856005a79fa9e27eddb1c8d77f8b Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: http://git-master/r/1269366 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/common/linux/timers.c16
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.c18
-rw-r--r--drivers/gpu/nvgpu/gk20a/pmu_gk20a.c6
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/timers.h12
4 files changed, 26 insertions, 26 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/timers.c b/drivers/gpu/nvgpu/common/linux/timers.c
index e1e08f82..b7fe30f1 100644
--- a/drivers/gpu/nvgpu/common/linux/timers.c
+++ b/drivers/gpu/nvgpu/common/linux/timers.c
@@ -71,7 +71,7 @@ int nvgpu_timeout_init(struct gk20a *g, struct nvgpu_timeout *timeout,
71 return 0; 71 return 0;
72} 72}
73 73
74static int __nvgpu_timeout_check_msg_cpu(struct nvgpu_timeout *timeout, 74static int __nvgpu_timeout_expired_msg_cpu(struct nvgpu_timeout *timeout,
75 void *caller, 75 void *caller,
76 const char *fmt, va_list args) 76 const char *fmt, va_list args)
77{ 77{
@@ -97,7 +97,7 @@ static int __nvgpu_timeout_check_msg_cpu(struct nvgpu_timeout *timeout,
97 return 0; 97 return 0;
98} 98}
99 99
100static int __nvgpu_timeout_check_msg_retry(struct nvgpu_timeout *timeout, 100static int __nvgpu_timeout_expired_msg_retry(struct nvgpu_timeout *timeout,
101 void *caller, 101 void *caller,
102 const char *fmt, va_list args) 102 const char *fmt, va_list args)
103{ 103{
@@ -125,7 +125,7 @@ static int __nvgpu_timeout_check_msg_retry(struct nvgpu_timeout *timeout,
125} 125}
126 126
127/** 127/**
128 * __nvgpu_timeout_check_msg - Check if a timeout has expired. 128 * __nvgpu_timeout_expired_msg - Check if a timeout has expired.
129 * 129 *
130 * @timeout - The timeout to check. 130 * @timeout - The timeout to check.
131 * @caller - Address of the caller of this function. 131 * @caller - Address of the caller of this function.
@@ -136,7 +136,7 @@ static int __nvgpu_timeout_check_msg_retry(struct nvgpu_timeout *timeout,
136 * If a timeout occurs and %NVGPU_TIMER_SILENT_TIMEOUT is not set in the timeout 136 * If a timeout occurs and %NVGPU_TIMER_SILENT_TIMEOUT is not set in the timeout
137 * then a message is printed based on %fmt. 137 * then a message is printed based on %fmt.
138 */ 138 */
139int __nvgpu_timeout_check_msg(struct nvgpu_timeout *timeout, 139int __nvgpu_timeout_expired_msg(struct nvgpu_timeout *timeout,
140 void *caller, const char *fmt, ...) 140 void *caller, const char *fmt, ...)
141{ 141{
142 int ret; 142 int ret;
@@ -144,10 +144,10 @@ int __nvgpu_timeout_check_msg(struct nvgpu_timeout *timeout,
144 144
145 va_start(args, fmt); 145 va_start(args, fmt);
146 if (timeout->flags & NVGPU_TIMER_RETRY_TIMER) 146 if (timeout->flags & NVGPU_TIMER_RETRY_TIMER)
147 ret = __nvgpu_timeout_check_msg_retry(timeout, caller, fmt, 147 ret = __nvgpu_timeout_expired_msg_retry(timeout, caller, fmt,
148 args); 148 args);
149 else 149 else
150 ret = __nvgpu_timeout_check_msg_cpu(timeout, caller, fmt, 150 ret = __nvgpu_timeout_expired_msg_cpu(timeout, caller, fmt,
151 args); 151 args);
152 va_end(args); 152 va_end(args);
153 153
@@ -155,7 +155,7 @@ int __nvgpu_timeout_check_msg(struct nvgpu_timeout *timeout,
155} 155}
156 156
157/** 157/**
158 * nvgpu_timeout_peek - Check the status of a timeout. 158 * nvgpu_timeout_peek_expired - Check the status of a timeout.
159 * 159 *
160 * @timeout - The timeout to check. 160 * @timeout - The timeout to check.
161 * 161 *
@@ -165,7 +165,7 @@ int __nvgpu_timeout_check_msg(struct nvgpu_timeout *timeout,
165 * 165 *
166 * This function honors the pre-Si check as well. 166 * This function honors the pre-Si check as well.
167 */ 167 */
168int nvgpu_timeout_peek(struct nvgpu_timeout *timeout) 168int nvgpu_timeout_peek_expired(struct nvgpu_timeout *timeout)
169{ 169{
170 if (nvgpu_timeout_is_pre_silicon(timeout)) 170 if (nvgpu_timeout_is_pre_silicon(timeout))
171 return 0; 171 return 0;
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
index 8ac6d1d1..792fa098 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
@@ -5049,9 +5049,9 @@ int gk20a_mm_fb_flush(struct gk20a *g)
5049 udelay(5); 5049 udelay(5);
5050 } else 5050 } else
5051 break; 5051 break;
5052 } while (!nvgpu_timeout_check(&timeout)); 5052 } while (!nvgpu_timeout_expired(&timeout));
5053 5053
5054 if (nvgpu_timeout_peek(&timeout)) { 5054 if (nvgpu_timeout_peek_expired(&timeout)) {
5055 if (g->ops.fb.dump_vpr_wpr_info) 5055 if (g->ops.fb.dump_vpr_wpr_info)
5056 g->ops.fb.dump_vpr_wpr_info(g); 5056 g->ops.fb.dump_vpr_wpr_info(g);
5057 ret = -EBUSY; 5057 ret = -EBUSY;
@@ -5092,9 +5092,9 @@ static void gk20a_mm_l2_invalidate_locked(struct gk20a *g)
5092 udelay(5); 5092 udelay(5);
5093 } else 5093 } else
5094 break; 5094 break;
5095 } while (!nvgpu_timeout_check(&timeout)); 5095 } while (!nvgpu_timeout_expired(&timeout));
5096 5096
5097 if (nvgpu_timeout_peek(&timeout)) 5097 if (nvgpu_timeout_peek_expired(&timeout))
5098 gk20a_warn(dev_from_gk20a(g), 5098 gk20a_warn(dev_from_gk20a(g),
5099 "l2_system_invalidate too many retries"); 5099 "l2_system_invalidate too many retries");
5100 5100
@@ -5147,7 +5147,7 @@ void gk20a_mm_l2_flush(struct gk20a *g, bool invalidate)
5147 udelay(5); 5147 udelay(5);
5148 } else 5148 } else
5149 break; 5149 break;
5150 } while (!nvgpu_timeout_check_msg(&timeout, 5150 } while (!nvgpu_timeout_expired_msg(&timeout,
5151 "l2_flush_dirty too many retries")); 5151 "l2_flush_dirty too many retries"));
5152 5152
5153 trace_gk20a_mm_l2_flush_done(dev_name(g->dev)); 5153 trace_gk20a_mm_l2_flush_done(dev_name(g->dev));
@@ -5192,7 +5192,7 @@ void gk20a_mm_cbc_clean(struct gk20a *g)
5192 udelay(5); 5192 udelay(5);
5193 } else 5193 } else
5194 break; 5194 break;
5195 } while (!nvgpu_timeout_check_msg(&timeout, 5195 } while (!nvgpu_timeout_expired_msg(&timeout,
5196 "l2_clean_comptags too many retries")); 5196 "l2_clean_comptags too many retries"));
5197 5197
5198 mutex_unlock(&mm->l2_op_lock); 5198 mutex_unlock(&mm->l2_op_lock);
@@ -5259,10 +5259,10 @@ void gk20a_mm_tlb_invalidate(struct vm_gk20a *vm)
5259 if (fb_mmu_ctrl_pri_fifo_space_v(data) != 0) 5259 if (fb_mmu_ctrl_pri_fifo_space_v(data) != 0)
5260 break; 5260 break;
5261 udelay(2); 5261 udelay(2);
5262 } while (!nvgpu_timeout_check_msg(&timeout, 5262 } while (!nvgpu_timeout_expired_msg(&timeout,
5263 "wait mmu fifo space")); 5263 "wait mmu fifo space"));
5264 5264
5265 if (nvgpu_timeout_peek(&timeout)) 5265 if (nvgpu_timeout_peek_expired(&timeout))
5266 goto out; 5266 goto out;
5267 5267
5268 nvgpu_timeout_init(g, &timeout, 1000, NVGPU_TIMER_RETRY_TIMER); 5268 nvgpu_timeout_init(g, &timeout, 1000, NVGPU_TIMER_RETRY_TIMER);
@@ -5283,7 +5283,7 @@ void gk20a_mm_tlb_invalidate(struct vm_gk20a *vm)
5283 fb_mmu_ctrl_pri_fifo_empty_false_f()) 5283 fb_mmu_ctrl_pri_fifo_empty_false_f())
5284 break; 5284 break;
5285 udelay(2); 5285 udelay(2);
5286 } while (!nvgpu_timeout_check_msg(&timeout, 5286 } while (!nvgpu_timeout_expired_msg(&timeout,
5287 "wait mmu invalidate")); 5287 "wait mmu invalidate"));
5288 5288
5289 trace_gk20a_mm_tlb_invalidate_done(dev_name(g->dev)); 5289 trace_gk20a_mm_tlb_invalidate_done(dev_name(g->dev));
diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c
index 1d580dae..853011f2 100644
--- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c
@@ -2129,7 +2129,7 @@ int pmu_idle(struct pmu_gk20a *pmu)
2129 break; 2129 break;
2130 } 2130 }
2131 2131
2132 if (nvgpu_timeout_check_msg(&timeout, 2132 if (nvgpu_timeout_expired_msg(&timeout,
2133 "waiting for pmu idle: 0x%08x", 2133 "waiting for pmu idle: 0x%08x",
2134 idle_stat)) 2134 idle_stat))
2135 return -EBUSY; 2135 return -EBUSY;
@@ -4058,7 +4058,7 @@ int pmu_wait_message_cond(struct pmu_gk20a *pmu, u32 timeout_ms,
4058 4058
4059 usleep_range(delay, delay * 2); 4059 usleep_range(delay, delay * 2);
4060 delay = min_t(u32, delay << 1, GR_IDLE_CHECK_MAX); 4060 delay = min_t(u32, delay << 1, GR_IDLE_CHECK_MAX);
4061 } while (!nvgpu_timeout_check(&timeout)); 4061 } while (!nvgpu_timeout_expired(&timeout));
4062 4062
4063 return -ETIMEDOUT; 4063 return -ETIMEDOUT;
4064} 4064}
@@ -4409,7 +4409,7 @@ static int pmu_write_cmd(struct pmu_gk20a *pmu, struct pmu_cmd *cmd,
4409 4409
4410 do { 4410 do {
4411 err = pmu_queue_open_write(pmu, queue, cmd->hdr.size); 4411 err = pmu_queue_open_write(pmu, queue, cmd->hdr.size);
4412 if (err == -EAGAIN && !nvgpu_timeout_check(&timeout)) 4412 if (err == -EAGAIN && !nvgpu_timeout_expired(&timeout))
4413 usleep_range(1000, 2000); 4413 usleep_range(1000, 2000);
4414 else 4414 else
4415 break; 4415 break;
diff --git a/drivers/gpu/nvgpu/include/nvgpu/timers.h b/drivers/gpu/nvgpu/include/nvgpu/timers.h
index e46982c9..0ecbc183 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/timers.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/timers.h
@@ -74,21 +74,21 @@ struct nvgpu_timeout {
74 74
75int nvgpu_timeout_init(struct gk20a *g, struct nvgpu_timeout *timeout, 75int nvgpu_timeout_init(struct gk20a *g, struct nvgpu_timeout *timeout,
76 int duration, unsigned long flags); 76 int duration, unsigned long flags);
77int nvgpu_timeout_peek(struct nvgpu_timeout *timeout); 77int nvgpu_timeout_peek_expired(struct nvgpu_timeout *timeout);
78 78
79#define nvgpu_timeout_check(__timeout) \ 79#define nvgpu_timeout_expired(__timeout) \
80 __nvgpu_timeout_check_msg(__timeout, \ 80 __nvgpu_timeout_expired_msg(__timeout, \
81 __builtin_return_address(0), "") 81 __builtin_return_address(0), "")
82 82
83#define nvgpu_timeout_check_msg(__timeout, fmt, args...) \ 83#define nvgpu_timeout_expired_msg(__timeout, fmt, args...) \
84 __nvgpu_timeout_check_msg(__timeout, \ 84 __nvgpu_timeout_expired_msg(__timeout, \
85 __builtin_return_address(0), \ 85 __builtin_return_address(0), \
86 fmt, ##args) 86 fmt, ##args)
87 87
88/* 88/*
89 * Don't use this directly. 89 * Don't use this directly.
90 */ 90 */
91int __nvgpu_timeout_check_msg(struct nvgpu_timeout *timeout, 91int __nvgpu_timeout_expired_msg(struct nvgpu_timeout *timeout,
92 void *caller, const char *fmt, ...); 92 void *caller, const char *fmt, ...);
93 93
94#endif 94#endif