summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp10b/gr_gp10b.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b/gr_gp10b.c')
-rw-r--r--drivers/gpu/nvgpu/gp10b/gr_gp10b.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c
index 93d7dcbd..7eceb2a4 100644
--- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c
@@ -31,6 +31,8 @@
31#include "gp10b/gr_gp10b.h" 31#include "gp10b/gr_gp10b.h"
32#include "gp10b_sysfs.h" 32#include "gp10b_sysfs.h"
33 33
34#include <nvgpu/timers.h>
35
34#include <nvgpu/hw/gp10b/hw_gr_gp10b.h> 36#include <nvgpu/hw/gp10b/hw_gr_gp10b.h>
35#include <nvgpu/hw/gp10b/hw_fifo_gp10b.h> 37#include <nvgpu/hw/gp10b/hw_fifo_gp10b.h>
36#include <nvgpu/hw/gp10b/hw_ctxsw_prog_gp10b.h> 38#include <nvgpu/hw/gp10b/hw_ctxsw_prog_gp10b.h>
@@ -1353,8 +1355,8 @@ static bool gr_activity_empty_or_preempted(u32 val)
1353 return true; 1355 return true;
1354} 1356}
1355 1357
1356static int gr_gp10b_wait_empty(struct gk20a *g, unsigned long end_jiffies, 1358static int gr_gp10b_wait_empty(struct gk20a *g, unsigned long duration_ms,
1357 u32 expect_delay) 1359 u32 expect_delay)
1358{ 1360{
1359 u32 delay = expect_delay; 1361 u32 delay = expect_delay;
1360 bool gr_enabled; 1362 bool gr_enabled;
@@ -1362,9 +1364,12 @@ static int gr_gp10b_wait_empty(struct gk20a *g, unsigned long end_jiffies,
1362 bool gr_busy; 1364 bool gr_busy;
1363 u32 gr_status; 1365 u32 gr_status;
1364 u32 activity0, activity1, activity2, activity4; 1366 u32 activity0, activity1, activity2, activity4;
1367 struct nvgpu_timeout timeout;
1365 1368
1366 gk20a_dbg_fn(""); 1369 gk20a_dbg_fn("");
1367 1370
1371 nvgpu_timeout_init(g, &timeout, duration_ms, NVGPU_TIMER_CPU_TIMER);
1372
1368 do { 1373 do {
1369 /* fmodel: host gets fifo_engine_status(gr) from gr 1374 /* fmodel: host gets fifo_engine_status(gr) from gr
1370 only when gr_status is read */ 1375 only when gr_status is read */
@@ -1392,9 +1397,7 @@ static int gr_gp10b_wait_empty(struct gk20a *g, unsigned long end_jiffies,
1392 1397
1393 usleep_range(delay, delay * 2); 1398 usleep_range(delay, delay * 2);
1394 delay = min_t(u32, delay << 1, GR_IDLE_CHECK_MAX); 1399 delay = min_t(u32, delay << 1, GR_IDLE_CHECK_MAX);
1395 1400 } while (!nvgpu_timeout_expired(&timeout));
1396 } while (time_before(jiffies, end_jiffies)
1397 || !tegra_platform_is_silicon());
1398 1401
1399 gk20a_err(dev_from_gk20a(g), 1402 gk20a_err(dev_from_gk20a(g),
1400 "timeout, ctxsw busy : %d, gr busy : %d, %08x, %08x, %08x, %08x", 1403 "timeout, ctxsw busy : %d, gr busy : %d, %08x, %08x, %08x, %08x",