From 982fcfa737be54fd0ab16792faf97a2741e34907 Mon Sep 17 00:00:00 2001 From: Seema Khowala Date: Mon, 30 Oct 2017 14:15:51 -0700 Subject: gpu: nvgpu: Add timeouts_disabled_refcount for enabling timeout -timeouts will be enabled only when timeouts_disabled_refcount will reach 0 -timeouts_enabled debugfs will change from u32 type to file type to avoid race enabling/disabling timeout from debugfs and ioctl -unify setting timeouts_enabled from debugfs and ioctl Bug 1982434 Change-Id: I54bab778f1ae533872146dfb8d80deafd2a685c7 Signed-off-by: Seema Khowala Reviewed-on: https://git-master.nvidia.com/r/1588690 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/gk20a.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/gk20a.h') diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 84d3f639..f6318257 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -1314,7 +1314,7 @@ struct gk20a { struct railgate_stats pstats; #endif u32 gr_idle_timeout_default; - bool timeouts_enabled; + bool timeouts_disabled_by_user; unsigned int ch_wdt_timeout_ms; struct nvgpu_mutex poweron_lock; @@ -1376,7 +1376,8 @@ struct gk20a { /* also prevents debug sessions from attaching until released */ struct nvgpu_mutex dbg_sessions_lock; int dbg_powergating_disabled_refcount; /*refcount for pg disable */ - int dbg_timeout_disabled_refcount; /*refcount for timeout disable */ + /*refcount for timeout disable */ + nvgpu_atomic_t timeouts_disabled_refcount; /* must have dbg_sessions_lock before use */ struct nvgpu_dbg_reg_op *dbg_regops_tmp_buf; @@ -1508,9 +1509,14 @@ struct gk20a { struct nvgpu_list_node boardobjgrp_head; }; +static inline bool nvgpu_is_timeouts_enabled(struct gk20a *g) +{ + return nvgpu_atomic_read(&g->timeouts_disabled_refcount) == 0; +} + static inline unsigned long gk20a_get_gr_idle_timeout(struct gk20a *g) { - return g->timeouts_enabled ? + return nvgpu_is_timeouts_enabled(g) ? g->gr_idle_timeout_default : ULONG_MAX; } -- cgit v1.2.2