diff --git a/drivers/gpu/nvgpu/common/linux/timers.c b/drivers/gpu/nvgpu/common/linux/timers.c index 2953902e4..5786b240e 100644 --- a/drivers/gpu/nvgpu/common/linux/timers.c +++ b/drivers/gpu/nvgpu/common/linux/timers.c @@ -54,12 +54,9 @@ static int nvgpu_timeout_is_pre_silicon(struct nvgpu_timeout *timeout) * * If neither %NVGPU_TIMER_CPU_TIMER or %NVGPU_TIMER_RETRY_TIMER is passed then * a CPU timer is used by default. - * - * A negative duration is interpreted as the maximum possible, which for our - * purposes means infinite wait. */ int nvgpu_timeout_init(struct gk20a *g, struct nvgpu_timeout *timeout, - int duration, unsigned long flags) + u32 duration, unsigned long flags) { if (flags & ~NVGPU_TIMER_FLAG_MASK) return -EINVAL; @@ -69,9 +66,6 @@ int nvgpu_timeout_init(struct gk20a *g, struct nvgpu_timeout *timeout, timeout->g = g; timeout->flags = flags; - if (duration < 0) - duration = INT_MAX; - if (flags & NVGPU_TIMER_RETRY_TIMER) timeout->retries.max = duration; else diff --git a/drivers/gpu/nvgpu/common/pmu/pmu_ipc.c b/drivers/gpu/nvgpu/common/pmu/pmu_ipc.c index 0dbc2df34..6dffdf0fc 100644 --- a/drivers/gpu/nvgpu/common/pmu/pmu_ipc.c +++ b/drivers/gpu/nvgpu/common/pmu/pmu_ipc.c @@ -453,7 +453,7 @@ static int pmu_write_cmd(struct nvgpu_pmu *pmu, struct pmu_cmd *cmd, nvgpu_log_fn(g, " "); queue = &pmu->queue[queue_id]; - nvgpu_timeout_init(g, &timeout, (int)timeout_ms, NVGPU_TIMER_CPU_TIMER); + nvgpu_timeout_init(g, &timeout, timeout_ms, NVGPU_TIMER_CPU_TIMER); do { err = pmu_queue_open_write(pmu, queue, cmd->hdr.size); @@ -878,7 +878,7 @@ int pmu_wait_message_cond(struct nvgpu_pmu *pmu, u32 timeout_ms, struct nvgpu_timeout timeout; unsigned long delay = GR_IDLE_CHECK_DEFAULT; - nvgpu_timeout_init(g, &timeout, (int)timeout_ms, NVGPU_TIMER_CPU_TIMER); + nvgpu_timeout_init(g, &timeout, timeout_ms, NVGPU_TIMER_CPU_TIMER); do { if (*var == val) diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index f365ac94c..dd5f0d17a 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -1287,7 +1287,7 @@ struct gk20a { static inline unsigned long gk20a_get_gr_idle_timeout(struct gk20a *g) { return g->timeouts_enabled ? - g->gr_idle_timeout_default : MAX_SCHEDULE_TIMEOUT; + g->gr_idle_timeout_default : ULONG_MAX; } enum BAR0_DEBUG_OPERATION { diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index c5dab0b53..4dfb6ee83 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c @@ -344,8 +344,7 @@ int gr_gk20a_wait_idle(struct gk20a *g, unsigned long duration_ms, gr_engine_id = gk20a_fifo_get_gr_engine_id(g); - nvgpu_timeout_init(g, &timeout, (int)duration_ms, - NVGPU_TIMER_CPU_TIMER); + nvgpu_timeout_init(g, &timeout, duration_ms, NVGPU_TIMER_CPU_TIMER); do { /* fmodel: host gets fifo_engine_status(gr) from gr @@ -398,8 +397,7 @@ int gr_gk20a_wait_fe_idle(struct gk20a *g, unsigned long duration_ms, gk20a_dbg_fn(""); - nvgpu_timeout_init(g, &timeout, (int)duration_ms, - NVGPU_TIMER_CPU_TIMER); + nvgpu_timeout_init(g, &timeout, duration_ms, NVGPU_TIMER_CPU_TIMER); do { val = gk20a_readl(g, gr_status_r()); diff --git a/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c b/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c index ee55c8ef6..0f99c67e6 100644 --- a/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c @@ -184,7 +184,7 @@ static int pmu_gm20b_ctx_wait_lsf_ready(struct gk20a *g, u32 timeout_ms, gk20a_dbg_fn(""); reg = gk20a_readl(g, gr_fecs_ctxsw_mailbox_r(0)); - nvgpu_timeout_init(g, &timeout, (int)timeout_ms, NVGPU_TIMER_CPU_TIMER); + nvgpu_timeout_init(g, &timeout, timeout_ms, NVGPU_TIMER_CPU_TIMER); do { reg = gk20a_readl(g, gr_fecs_ctxsw_mailbox_r(0)); diff --git a/drivers/gpu/nvgpu/include/nvgpu/timers.h b/drivers/gpu/nvgpu/include/nvgpu/timers.h index 5265437e9..482f92b71 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/timers.h +++ b/drivers/gpu/nvgpu/include/nvgpu/timers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-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, @@ -52,8 +52,8 @@ struct nvgpu_timeout { union { s64 time; struct { - int max; - int attempted; + u32 max; + u32 attempted; } retries; }; }; @@ -75,7 +75,7 @@ struct nvgpu_timeout { NVGPU_TIMER_SILENT_TIMEOUT) int nvgpu_timeout_init(struct gk20a *g, struct nvgpu_timeout *timeout, - int duration, unsigned long flags); + u32 duration, unsigned long flags); int nvgpu_timeout_peek_expired(struct nvgpu_timeout *timeout); #define nvgpu_timeout_expired(__timeout) \