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/mm_gm20b.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'drivers/gpu/nvgpu/gm20b/mm_gm20b.c') diff --git a/drivers/gpu/nvgpu/gm20b/mm_gm20b.c b/drivers/gpu/nvgpu/gm20b/mm_gm20b.c index ca8fbaee..8f5d1e10 100644 --- a/drivers/gpu/nvgpu/gm20b/mm_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/mm_gm20b.c @@ -1,7 +1,7 @@ /* * GM20B MMU * - * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -20,6 +20,8 @@ #include "mm_gm20b.h" +#include + #include #include #include @@ -27,28 +29,23 @@ #include static int gm20b_mm_mmu_vpr_info_fetch_wait(struct gk20a *g, - const unsigned int msec) + unsigned int msec) { - unsigned long timeout; + struct nvgpu_timeout timeout; - if (tegra_platform_is_silicon()) - timeout = jiffies + msecs_to_jiffies(msec); - else - timeout = msecs_to_jiffies(msec); + nvgpu_timeout_init(g, &timeout, msec, NVGPU_TIMER_CPU_TIMER); - while (1) { + do { u32 val; + val = gk20a_readl(g, fb_mmu_vpr_info_r()); if (fb_mmu_vpr_info_fetch_v(val) == - fb_mmu_vpr_info_fetch_false_v()) - break; - if (tegra_platform_is_silicon()) { - if (WARN_ON(time_after(jiffies, timeout))) - return -ETIME; - } else if (--timeout == 0) - return -ETIME; - } - return 0; + fb_mmu_vpr_info_fetch_false_v()) + return 0; + + } while (!nvgpu_timeout_expired(&timeout)); + + return -ETIMEDOUT; } int gm20b_mm_mmu_vpr_info_fetch(struct gk20a *g) -- cgit v1.2.2