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/common/linux/driver_common.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'drivers/gpu/nvgpu/common/linux/driver_common.c') diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c index 769f7e03..edc8aca8 100644 --- a/drivers/gpu/nvgpu/common/linux/driver_common.c +++ b/drivers/gpu/nvgpu/common/linux/driver_common.c @@ -96,12 +96,15 @@ static void nvgpu_init_timeout(struct gk20a *g) { struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); - g->gr_idle_timeout_default = NVGPU_DEFAULT_GR_IDLE_TIMEOUT; - if (nvgpu_platform_is_silicon(g)) - g->timeouts_enabled = true; - else if (nvgpu_platform_is_fpga(g)) { + g->timeouts_disabled_by_user = false; + nvgpu_atomic_set(&g->timeouts_disabled_refcount, 0); + + if (nvgpu_platform_is_silicon(g)) { + g->gr_idle_timeout_default = NVGPU_DEFAULT_GR_IDLE_TIMEOUT; + } else if (nvgpu_platform_is_fpga(g)) { g->gr_idle_timeout_default = GK20A_TIMEOUT_FPGA; - g->timeouts_enabled = true; + } else { + g->gr_idle_timeout_default = (u32)ULONG_MAX; } g->ch_wdt_timeout_ms = platform->ch_wdt_timeout_ms; } -- cgit v1.2.2