diff options
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 42 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.h | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 8 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/hw_pbdma_gk20a.h | 22 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/hw_pbdma_gm20b.h | 22 |
5 files changed, 87 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index b480c80a..a5c2efb3 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GK20A Graphics channel | 2 | * GK20A Graphics channel |
3 | * | 3 | * |
4 | * Copyright (c) 2011-2015, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2011-2016, 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, |
@@ -62,6 +62,8 @@ static int channel_gk20a_update_runlist(struct channel_gk20a *c, | |||
62 | bool add); | 62 | bool add); |
63 | static void gk20a_free_error_notifiers(struct channel_gk20a *ch); | 63 | static void gk20a_free_error_notifiers(struct channel_gk20a *ch); |
64 | 64 | ||
65 | static u32 gk20a_get_channel_watchdog_timeout(struct channel_gk20a *ch); | ||
66 | |||
65 | /* allocate GPU channel */ | 67 | /* allocate GPU channel */ |
66 | static struct channel_gk20a *allocate_channel(struct fifo_gk20a *f) | 68 | static struct channel_gk20a *allocate_channel(struct fifo_gk20a *f) |
67 | { | 69 | { |
@@ -204,6 +206,38 @@ static int channel_gk20a_set_schedule_params(struct channel_gk20a *c, | |||
204 | return 0; | 206 | return 0; |
205 | } | 207 | } |
206 | 208 | ||
209 | u32 channel_gk20a_pbdma_acquire_val(struct channel_gk20a *c) | ||
210 | { | ||
211 | u32 val, exp, man; | ||
212 | u64 timeout; | ||
213 | int val_len; | ||
214 | |||
215 | timeout = gk20a_get_channel_watchdog_timeout(c); | ||
216 | do_div(timeout, 2); /* set acquire timeout to half of channel wdt */ | ||
217 | timeout *= 1000000UL; /* ms -> ns */ | ||
218 | do_div(timeout, 1024); /* in unit of 1024ns */ | ||
219 | val_len = fls(timeout >> 32) + 32; | ||
220 | if (val_len == 32) | ||
221 | val_len = fls(timeout); | ||
222 | if (val_len > 16 + pbdma_acquire_timeout_exp_max_v()) { /* man: 16bits */ | ||
223 | exp = pbdma_acquire_timeout_exp_max_v(); | ||
224 | man = pbdma_acquire_timeout_man_max_v(); | ||
225 | } else if (val_len > 16) { | ||
226 | exp = val_len - 16; | ||
227 | man = timeout >> exp; | ||
228 | } else { | ||
229 | exp = 0; | ||
230 | man = timeout; | ||
231 | } | ||
232 | |||
233 | val = pbdma_acquire_retry_man_2_f() | | ||
234 | pbdma_acquire_retry_exp_2_f() | | ||
235 | pbdma_acquire_timeout_exp_f(exp) | | ||
236 | pbdma_acquire_timeout_man_f(man) | | ||
237 | pbdma_acquire_timeout_en_enable_f(); | ||
238 | return val; | ||
239 | } | ||
240 | |||
207 | int channel_gk20a_setup_ramfc(struct channel_gk20a *c, | 241 | int channel_gk20a_setup_ramfc(struct channel_gk20a *c, |
208 | u64 gpfifo_base, u32 gpfifo_entries, u32 flags) | 242 | u64 gpfifo_base, u32 gpfifo_entries, u32 flags) |
209 | { | 243 | { |
@@ -249,11 +283,7 @@ int channel_gk20a_setup_ramfc(struct channel_gk20a *c, | |||
249 | gk20a_mem_wr32(inst_ptr, ram_fc_target_w(), pbdma_target_engine_sw_f()); | 283 | gk20a_mem_wr32(inst_ptr, ram_fc_target_w(), pbdma_target_engine_sw_f()); |
250 | 284 | ||
251 | gk20a_mem_wr32(inst_ptr, ram_fc_acquire_w(), | 285 | gk20a_mem_wr32(inst_ptr, ram_fc_acquire_w(), |
252 | pbdma_acquire_retry_man_2_f() | | 286 | channel_gk20a_pbdma_acquire_val(c)); |
253 | pbdma_acquire_retry_exp_2_f() | | ||
254 | pbdma_acquire_timeout_exp_max_f() | | ||
255 | pbdma_acquire_timeout_man_max_f() | | ||
256 | pbdma_acquire_timeout_en_disable_f()); | ||
257 | 287 | ||
258 | gk20a_mem_wr32(inst_ptr, ram_fc_runlist_timeslice_w(), | 288 | gk20a_mem_wr32(inst_ptr, ram_fc_runlist_timeslice_w(), |
259 | fifo_runlist_timeslice_timeout_128_f() | | 289 | fifo_runlist_timeslice_timeout_128_f() | |
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h index f62d2731..ddc517b9 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GK20A graphics channel | 2 | * GK20A graphics channel |
3 | * | 3 | * |
4 | * Copyright (c) 2011-2015, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2011-2016, 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, |
@@ -252,6 +252,7 @@ void channel_gk20a_unbind(struct channel_gk20a *ch_gk20a); | |||
252 | void channel_gk20a_disable(struct channel_gk20a *ch); | 252 | void channel_gk20a_disable(struct channel_gk20a *ch); |
253 | int channel_gk20a_alloc_inst(struct gk20a *g, struct channel_gk20a *ch); | 253 | int channel_gk20a_alloc_inst(struct gk20a *g, struct channel_gk20a *ch); |
254 | void channel_gk20a_free_inst(struct gk20a *g, struct channel_gk20a *ch); | 254 | void channel_gk20a_free_inst(struct gk20a *g, struct channel_gk20a *ch); |
255 | u32 channel_gk20a_pbdma_acquire_val(struct channel_gk20a *c); | ||
255 | int channel_gk20a_setup_ramfc(struct channel_gk20a *c, | 256 | int channel_gk20a_setup_ramfc(struct channel_gk20a *c, |
256 | u64 gpfifo_base, u32 gpfifo_entries, u32 flags); | 257 | u64 gpfifo_base, u32 gpfifo_entries, u32 flags); |
257 | void channel_gk20a_enable(struct channel_gk20a *ch); | 258 | void channel_gk20a_enable(struct channel_gk20a *ch); |
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index 1727cf1d..5c99877b 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GK20A Graphics FIFO (gr host) | 2 | * GK20A Graphics FIFO (gr host) |
3 | * | 3 | * |
4 | * Copyright (c) 2011-2015, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2011-2016, 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, |
@@ -1642,6 +1642,12 @@ static u32 gk20a_fifo_handle_pbdma_intr(struct device *dev, | |||
1642 | pbdma_intr_0); | 1642 | pbdma_intr_0); |
1643 | } | 1643 | } |
1644 | 1644 | ||
1645 | if (pbdma_intr_0 & pbdma_intr_0_acquire_pending_f()) { | ||
1646 | u32 val = gk20a_readl(g, pbdma_acquire_r(pbdma_id)); | ||
1647 | val &= ~pbdma_acquire_timeout_en_enable_f(); | ||
1648 | gk20a_writel(g, pbdma_acquire_r(pbdma_id), val); | ||
1649 | } | ||
1650 | |||
1645 | if (pbdma_intr_0 & pbdma_intr_0_pbentry_pending_f()) { | 1651 | if (pbdma_intr_0 & pbdma_intr_0_pbentry_pending_f()) { |
1646 | gk20a_fifo_reset_pbdma_header(g, pbdma_id); | 1652 | gk20a_fifo_reset_pbdma_header(g, pbdma_id); |
1647 | gk20a_fifo_reset_pbdma_method(g, pbdma_id, 0); | 1653 | gk20a_fifo_reset_pbdma_method(g, pbdma_id, 0); |
diff --git a/drivers/gpu/nvgpu/gk20a/hw_pbdma_gk20a.h b/drivers/gpu/nvgpu/gk20a/hw_pbdma_gk20a.h index e83dbb5c..79a4ef96 100644 --- a/drivers/gpu/nvgpu/gk20a/hw_pbdma_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/hw_pbdma_gk20a.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2012-2015, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2012-2016, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms and conditions of the GNU General Public License, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -274,14 +274,34 @@ static inline u32 pbdma_acquire_retry_exp_2_f(void) | |||
274 | { | 274 | { |
275 | return 0x100; | 275 | return 0x100; |
276 | } | 276 | } |
277 | static inline u32 pbdma_acquire_timeout_exp_f(u32 v) | ||
278 | { | ||
279 | return (v & 0xf) << 11; | ||
280 | } | ||
281 | static inline u32 pbdma_acquire_timeout_exp_max_v(void) | ||
282 | { | ||
283 | return 0x0000000f; | ||
284 | } | ||
277 | static inline u32 pbdma_acquire_timeout_exp_max_f(void) | 285 | static inline u32 pbdma_acquire_timeout_exp_max_f(void) |
278 | { | 286 | { |
279 | return 0x7800; | 287 | return 0x7800; |
280 | } | 288 | } |
289 | static inline u32 pbdma_acquire_timeout_man_f(u32 v) | ||
290 | { | ||
291 | return (v & 0xffff) << 15; | ||
292 | } | ||
293 | static inline u32 pbdma_acquire_timeout_man_max_v(void) | ||
294 | { | ||
295 | return 0x0000ffff; | ||
296 | } | ||
281 | static inline u32 pbdma_acquire_timeout_man_max_f(void) | 297 | static inline u32 pbdma_acquire_timeout_man_max_f(void) |
282 | { | 298 | { |
283 | return 0x7fff8000; | 299 | return 0x7fff8000; |
284 | } | 300 | } |
301 | static inline u32 pbdma_acquire_timeout_en_enable_f(void) | ||
302 | { | ||
303 | return 0x80000000; | ||
304 | } | ||
285 | static inline u32 pbdma_acquire_timeout_en_disable_f(void) | 305 | static inline u32 pbdma_acquire_timeout_en_disable_f(void) |
286 | { | 306 | { |
287 | return 0x0; | 307 | return 0x0; |
diff --git a/drivers/gpu/nvgpu/gm20b/hw_pbdma_gm20b.h b/drivers/gpu/nvgpu/gm20b/hw_pbdma_gm20b.h index c03a377a..19b3bc44 100644 --- a/drivers/gpu/nvgpu/gm20b/hw_pbdma_gm20b.h +++ b/drivers/gpu/nvgpu/gm20b/hw_pbdma_gm20b.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms and conditions of the GNU General Public License, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -262,14 +262,34 @@ static inline u32 pbdma_acquire_retry_exp_2_f(void) | |||
262 | { | 262 | { |
263 | return 0x100; | 263 | return 0x100; |
264 | } | 264 | } |
265 | static inline u32 pbdma_acquire_timeout_exp_f(u32 v) | ||
266 | { | ||
267 | return (v & 0xf) << 11; | ||
268 | } | ||
269 | static inline u32 pbdma_acquire_timeout_exp_max_v(void) | ||
270 | { | ||
271 | return 0x0000000f; | ||
272 | } | ||
265 | static inline u32 pbdma_acquire_timeout_exp_max_f(void) | 273 | static inline u32 pbdma_acquire_timeout_exp_max_f(void) |
266 | { | 274 | { |
267 | return 0x7800; | 275 | return 0x7800; |
268 | } | 276 | } |
277 | static inline u32 pbdma_acquire_timeout_man_f(u32 v) | ||
278 | { | ||
279 | return (v & 0xffff) << 15; | ||
280 | } | ||
281 | static inline u32 pbdma_acquire_timeout_man_max_v(void) | ||
282 | { | ||
283 | return 0x0000ffff; | ||
284 | } | ||
269 | static inline u32 pbdma_acquire_timeout_man_max_f(void) | 285 | static inline u32 pbdma_acquire_timeout_man_max_f(void) |
270 | { | 286 | { |
271 | return 0x7fff8000; | 287 | return 0x7fff8000; |
272 | } | 288 | } |
289 | static inline u32 pbdma_acquire_timeout_en_enable_f(void) | ||
290 | { | ||
291 | return 0x80000000; | ||
292 | } | ||
273 | static inline u32 pbdma_acquire_timeout_en_disable_f(void) | 293 | static inline u32 pbdma_acquire_timeout_en_disable_f(void) |
274 | { | 294 | { |
275 | return 0x0; | 295 | return 0x0; |