From 5121bd4b6f2a41b3db045cca7246f9b1832c8648 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Wed, 29 Nov 2017 15:53:24 -0800 Subject: gpu: nvpgu: Move GR IDLE timeout definition to header GR IDLE timeout is defined as Kconfig. Instead of that introduce a new header file defaults.h which encapsulates any generic defaults we use in nvgpu, and move the definition there. Change-Id: I78ff1d2790d7ee3dff6df42bbd11cf683a85bf79 Signed-off-by: Terje Bergstrom Reviewed-on: https://git-master.nvidia.com/r/1612650 GVS: Gerrit_Virtual_Submit Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/Kconfig | 7 ------ drivers/gpu/nvgpu/common/linux/driver_common.c | 3 ++- drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c | 4 ++-- drivers/gpu/nvgpu/include/nvgpu/defaults.h | 31 ++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 drivers/gpu/nvgpu/include/nvgpu/defaults.h diff --git a/drivers/gpu/nvgpu/Kconfig b/drivers/gpu/nvgpu/Kconfig index cab717bb..01744453 100644 --- a/drivers/gpu/nvgpu/Kconfig +++ b/drivers/gpu/nvgpu/Kconfig @@ -5,13 +5,6 @@ config GK20A Choose this option if you have an SoC with integrated Nvidia GPU IP. -config GK20A_DEFAULT_TIMEOUT - depends on GK20A - int "Default timeout for submits" - default 3000 - help - Default timeout for jobs in milliseconds. Set to zero for no timeout. - config GK20A_PMU bool "Support GK20A PMU" depends on GK20A diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c index 425198d5..51ae18a3 100644 --- a/drivers/gpu/nvgpu/common/linux/driver_common.c +++ b/drivers/gpu/nvgpu/common/linux/driver_common.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -88,7 +89,7 @@ static void nvgpu_init_timeout(struct gk20a *g) { struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); - g->gr_idle_timeout_default = CONFIG_GK20A_DEFAULT_TIMEOUT; + 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)) { diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c index f6c13db1..1ec0bc1c 100644 --- a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c +++ b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "vgpu.h" #include "fecs_trace_vgpu.h" @@ -750,8 +751,7 @@ int vgpu_probe(struct platform_device *pdev) dev->dma_parms = &l->dma_parms; dma_set_max_seg_size(dev, UINT_MAX); - gk20a->gr_idle_timeout_default = - CONFIG_GK20A_DEFAULT_TIMEOUT; + gk20a->gr_idle_timeout_default = NVGPU_DEFAULT_GR_IDLE_TIMEOUT; gk20a->timeouts_enabled = true; vgpu_create_sysfs(dev); diff --git a/drivers/gpu/nvgpu/include/nvgpu/defaults.h b/drivers/gpu/nvgpu/include/nvgpu/defaults.h new file mode 100644 index 00000000..2d7a42b1 --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/defaults.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef __NVGPU_DEFAULTS_H__ +#define __NVGPU_DEFAULTS_H__ + +/* + * Default timeout used for channel watchdog and ctxsw timeout. + */ +#define NVGPU_DEFAULT_GR_IDLE_TIMEOUT 3000 + +#endif -- cgit v1.2.2