From 943e3158bc2071757677e184e715baec620b6683 Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Wed, 23 May 2018 11:29:08 -0700 Subject: gpu: nvgpu: add g->fifo_eng_timeout_us Add g->fifo_eng_timeout_us to define engine timeout in microseconds. It is initialized with GRFIFO_TIMEOUT_CHECK_PERIOD_US. In RM server case, it can be overriden with value defined in device tree. Jira EVLR-2674 Change-Id: I69ac2ce779fe575566c8ba48e8cd2d0e6b2d93cf Signed-off-by: Thomas Fleury Reviewed-on: https://git-master.nvidia.com/r/1728391 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/driver_common.c | 1 + drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 11 ++++++----- drivers/gpu/nvgpu/gk20a/gk20a.h | 1 + drivers/gpu/nvgpu/gv11b/fifo_gv11b.c | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c index edc8aca8..8086cb29 100644 --- a/drivers/gpu/nvgpu/common/linux/driver_common.c +++ b/drivers/gpu/nvgpu/common/linux/driver_common.c @@ -107,6 +107,7 @@ static void nvgpu_init_timeout(struct gk20a *g) g->gr_idle_timeout_default = (u32)ULONG_MAX; } g->ch_wdt_timeout_ms = platform->ch_wdt_timeout_ms; + g->fifo_eng_timeout_us = GRFIFO_TIMEOUT_CHECK_PERIOD_US; } static void nvgpu_init_timeslice(struct gk20a *g) diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index 4e0e2bd1..997856aa 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c @@ -817,7 +817,7 @@ int gk20a_init_fifo_reset_enable_hw(struct gk20a *g) if (g->ops.fifo.apply_ctxsw_timeout_intr) g->ops.fifo.apply_ctxsw_timeout_intr(g); else { - timeout = GRFIFO_TIMEOUT_CHECK_PERIOD_US; + timeout = g->fifo_eng_timeout_us; timeout = scale_ptimer(timeout, ptimer_scalingfactor10x(g->ptimer_src_freq)); timeout |= fifo_eng_timeout_detection_enabled_f(); @@ -2169,15 +2169,16 @@ bool gk20a_fifo_check_ch_ctxsw_timeout(struct channel_gk20a *ch, { bool recover = false; bool progress = false; + struct gk20a *g = ch->g; if (gk20a_channel_get(ch)) { recover = gk20a_channel_update_and_check_timeout(ch, - GRFIFO_TIMEOUT_CHECK_PERIOD_US / 1000, + g->fifo_eng_timeout_us / 1000, &progress); *verbose = ch->timeout_debug_dump; *ms = ch->timeout_accumulated_ms; if (recover) - ch->g->ops.fifo.set_error_notifier(ch, + g->ops.fifo.set_error_notifier(ch, NVGPU_ERR_NOTIFIER_FIFO_ERROR_IDLE_TIMEOUT); gk20a_channel_put(ch); @@ -2194,7 +2195,7 @@ bool gk20a_fifo_check_tsg_ctxsw_timeout(struct tsg_gk20a *tsg, struct gk20a *g = tsg->g; *verbose = false; - *ms = GRFIFO_TIMEOUT_CHECK_PERIOD_US / 1000; + *ms = g->fifo_eng_timeout_us / 1000; nvgpu_rwsem_down_read(&tsg->ch_list_lock); @@ -2220,7 +2221,7 @@ bool gk20a_fifo_check_tsg_ctxsw_timeout(struct tsg_gk20a *tsg, nvgpu_log_info(g, "progress on tsg=%d ch=%d", tsg->tsgid, ch->chid); gk20a_channel_put(ch); - *ms = GRFIFO_TIMEOUT_CHECK_PERIOD_US / 1000; + *ms = g->fifo_eng_timeout_us / 1000; nvgpu_list_for_each_entry(ch, &tsg->ch_list, channel_gk20a, ch_entry) { if (gk20a_channel_get(ch)) { diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 01e0511d..f7bec806 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -1320,6 +1320,7 @@ struct gk20a { u32 gr_idle_timeout_default; bool timeouts_disabled_by_user; unsigned int ch_wdt_timeout_ms; + u32 fifo_eng_timeout_us; struct nvgpu_mutex poweron_lock; struct nvgpu_mutex poweroff_lock; diff --git a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c index fd014971..fdd9ecf0 100644 --- a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c @@ -1231,7 +1231,7 @@ int gv11b_init_fifo_reset_enable_hw(struct gk20a *g) if (nvgpu_platform_is_silicon(g)) { /* enable ctxsw timeout */ - timeout = GRFIFO_TIMEOUT_CHECK_PERIOD_US; + timeout = g->fifo_eng_timeout_us; timeout = scale_ptimer(timeout, ptimer_scalingfactor10x(g->ptimer_src_freq)); timeout |= fifo_eng_ctxsw_timeout_detection_enabled_f(); -- cgit v1.2.2