From 8e53d790902b8a40098a5851584ae7ba58b357b6 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Mon, 19 Dec 2016 15:23:01 -0800 Subject: gpu: nvgpu: Use timer API in gm20b code Use the timer API instead of Linux specific APIs for handling timeouts. Also, lower the L2 timeout from 1 second (absurdly long) to 5ms. Bug 1799159 Change-Id: I27dbc35b12e9bc22ff2207bb87543f76203e20f1 Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1273825 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gm20b/fifo_gm20b.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'drivers/gpu/nvgpu/gm20b/fifo_gm20b.c') diff --git a/drivers/gpu/nvgpu/gm20b/fifo_gm20b.c b/drivers/gpu/nvgpu/gm20b/fifo_gm20b.c index 6be6be04..bd94a54b 100644 --- a/drivers/gpu/nvgpu/gm20b/fifo_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/fifo_gm20b.c @@ -20,6 +20,8 @@ #include "fifo_gm20b.h" +#include + #include #include #include @@ -69,11 +71,10 @@ static inline u32 gm20b_engine_id_to_mmu_id(struct gk20a *g, u32 engine_id) static void gm20b_fifo_trigger_mmu_fault(struct gk20a *g, unsigned long engine_ids) { - unsigned long end_jiffies = jiffies + - msecs_to_jiffies(gk20a_get_gr_idle_timeout(g)); unsigned long delay = GR_IDLE_CHECK_DEFAULT; unsigned long engine_id; int ret = -EBUSY; + struct nvgpu_timeout timeout; /* trigger faults for all bad engines */ for_each_set_bit(engine_id, &engine_ids, 32) { @@ -89,6 +90,9 @@ static void gm20b_fifo_trigger_mmu_fault(struct gk20a *g, } } + nvgpu_timeout_init(g, &timeout, gk20a_get_gr_idle_timeout(g), + NVGPU_TIMER_CPU_TIMER); + /* Wait for MMU fault to trigger */ do { if (gk20a_readl(g, fifo_intr_0_r()) & @@ -99,8 +103,7 @@ static void gm20b_fifo_trigger_mmu_fault(struct gk20a *g, usleep_range(delay, delay * 2); delay = min_t(u32, delay << 1, GR_IDLE_CHECK_MAX); - } while (time_before(jiffies, end_jiffies) || - !tegra_platform_is_silicon()); + } while (!nvgpu_timeout_expired(&timeout)); if (ret) gk20a_err(dev_from_gk20a(g), "mmu fault timeout"); -- cgit v1.2.2