From aaf549ace8501d587806241b3cb56c2d706116d2 Mon Sep 17 00:00:00 2001 From: Debarshi Dutta Date: Tue, 10 Jul 2018 14:04:55 +0530 Subject: gpu: nvgpu: add GK20A_PM_QOS Kconfig option GK20A_DEVFREQ scaling depends on Nvidia downstream kernel modifications to PM QoS framework. To break that dependency and to allow devfreq based scaling to work without those changes, introduce a Kconfig option to conditionally enable the PM Qos based constraints. Bug 200414723 Bug 200414600 Change-Id: If39a144dfb322176c2d0e6c17d57d0cd6d885c41 Signed-off-by: Timo Alho Signed-off-by: Debarshi Dutta Reviewed-on: https://git-master.nvidia.com/r/1762987 Reviewed-by: svc-mobile-coverity Reviewed-by: Deepak Nibade GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/Kconfig | 8 ++++++++ drivers/gpu/nvgpu/os/linux/scale.c | 16 +++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/nvgpu/Kconfig b/drivers/gpu/nvgpu/Kconfig index 84c30666..0c78f67f 100644 --- a/drivers/gpu/nvgpu/Kconfig +++ b/drivers/gpu/nvgpu/Kconfig @@ -32,6 +32,14 @@ config GK20A_DEVFREQ endchoice +config GK20A_PM_QOS + depends on GK20A_DEVFREQ + bool "Use PM_QOS constraints for devfreq based scaling" + default y + help + Enable support to pass PM_QOS constraints to devfreq based + scaling. + config NVGPU_TRACK_MEM_USAGE bool "Track the usage of system memory in nvgpu" depends on GK20A diff --git a/drivers/gpu/nvgpu/os/linux/scale.c b/drivers/gpu/nvgpu/os/linux/scale.c index 84ac1cfd..72ed94bd 100644 --- a/drivers/gpu/nvgpu/os/linux/scale.c +++ b/drivers/gpu/nvgpu/os/linux/scale.c @@ -1,7 +1,7 @@ /* * gk20a clock scaling profile * - * Copyright (c) 2013-2017, NVIDIA Corporation. All rights reserved. + * Copyright (c) 2013-2018, 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, @@ -38,7 +38,7 @@ * has changed. The function calls postscaling callback if it is defined. */ -#if defined(CONFIG_COMMON_CLK) +#if defined(CONFIG_GK20A_PM_QOS) && defined(CONFIG_COMMON_CLK) int gk20a_scale_qos_notify(struct notifier_block *nb, unsigned long n, void *p) { @@ -71,7 +71,7 @@ int gk20a_scale_qos_notify(struct notifier_block *nb, return NOTIFY_OK; } -#else +#elif defined(CONFIG_GK20A_PM_QOS) int gk20a_scale_qos_notify(struct notifier_block *nb, unsigned long n, void *p) { @@ -100,6 +100,12 @@ int gk20a_scale_qos_notify(struct notifier_block *nb, return NOTIFY_OK; } +#else +int gk20a_scale_qos_notify(struct notifier_block *nb, + unsigned long n, void *p) +{ + return 0; +} #endif /* @@ -368,6 +374,7 @@ void gk20a_scale_init(struct device *dev) l->devfreq = devfreq; } +#ifdef CONFIG_GK20A_PM_QOS /* Should we register QoS callback for this device? */ if (platform->qos_notify) { profile->qos_notify_block.notifier_call = @@ -378,6 +385,7 @@ void gk20a_scale_init(struct device *dev) pm_qos_add_max_notifier(PM_QOS_GPU_FREQ_BOUNDS, &profile->qos_notify_block); } +#endif return; @@ -392,12 +400,14 @@ void gk20a_scale_exit(struct device *dev) struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); int err; +#ifdef CONFIG_GK20A_PM_QOS if (platform->qos_notify) { pm_qos_remove_min_notifier(PM_QOS_GPU_FREQ_BOUNDS, &g->scale_profile->qos_notify_block); pm_qos_remove_max_notifier(PM_QOS_GPU_FREQ_BOUNDS, &g->scale_profile->qos_notify_block); } +#endif if (platform->devfreq_governor) { err = devfreq_remove_device(l->devfreq); -- cgit v1.2.2