summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDebarshi Dutta <ddutta@nvidia.com>2018-07-10 04:34:55 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-07-11 13:13:22 -0400
commitaaf549ace8501d587806241b3cb56c2d706116d2 (patch)
tree2c053a49e36947719089ed7c28d87b1a86df4b75
parenta801c897df1e5e7ac498e1531ce4bbdabdca1c3d (diff)
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 <talho@nvidia.com> Signed-off-by: Debarshi Dutta <ddutta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1762987 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Deepak Nibade <dnibade@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/Kconfig8
-rw-r--r--drivers/gpu/nvgpu/os/linux/scale.c16
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
32 32
33endchoice 33endchoice
34 34
35config GK20A_PM_QOS
36 depends on GK20A_DEVFREQ
37 bool "Use PM_QOS constraints for devfreq based scaling"
38 default y
39 help
40 Enable support to pass PM_QOS constraints to devfreq based
41 scaling.
42
35config NVGPU_TRACK_MEM_USAGE 43config NVGPU_TRACK_MEM_USAGE
36 bool "Track the usage of system memory in nvgpu" 44 bool "Track the usage of system memory in nvgpu"
37 depends on GK20A 45 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 @@
1/* 1/*
2 * gk20a clock scaling profile 2 * gk20a clock scaling profile
3 * 3 *
4 * Copyright (c) 2013-2017, NVIDIA Corporation. All rights reserved. 4 * Copyright (c) 2013-2018, NVIDIA Corporation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -38,7 +38,7 @@
38 * has changed. The function calls postscaling callback if it is defined. 38 * has changed. The function calls postscaling callback if it is defined.
39 */ 39 */
40 40
41#if defined(CONFIG_COMMON_CLK) 41#if defined(CONFIG_GK20A_PM_QOS) && defined(CONFIG_COMMON_CLK)
42int gk20a_scale_qos_notify(struct notifier_block *nb, 42int gk20a_scale_qos_notify(struct notifier_block *nb,
43 unsigned long n, void *p) 43 unsigned long n, void *p)
44{ 44{
@@ -71,7 +71,7 @@ int gk20a_scale_qos_notify(struct notifier_block *nb,
71 71
72 return NOTIFY_OK; 72 return NOTIFY_OK;
73} 73}
74#else 74#elif defined(CONFIG_GK20A_PM_QOS)
75int gk20a_scale_qos_notify(struct notifier_block *nb, 75int gk20a_scale_qos_notify(struct notifier_block *nb,
76 unsigned long n, void *p) 76 unsigned long n, void *p)
77{ 77{
@@ -100,6 +100,12 @@ int gk20a_scale_qos_notify(struct notifier_block *nb,
100 100
101 return NOTIFY_OK; 101 return NOTIFY_OK;
102} 102}
103#else
104int gk20a_scale_qos_notify(struct notifier_block *nb,
105 unsigned long n, void *p)
106{
107 return 0;
108}
103#endif 109#endif
104 110
105/* 111/*
@@ -368,6 +374,7 @@ void gk20a_scale_init(struct device *dev)
368 l->devfreq = devfreq; 374 l->devfreq = devfreq;
369 } 375 }
370 376
377#ifdef CONFIG_GK20A_PM_QOS
371 /* Should we register QoS callback for this device? */ 378 /* Should we register QoS callback for this device? */
372 if (platform->qos_notify) { 379 if (platform->qos_notify) {
373 profile->qos_notify_block.notifier_call = 380 profile->qos_notify_block.notifier_call =
@@ -378,6 +385,7 @@ void gk20a_scale_init(struct device *dev)
378 pm_qos_add_max_notifier(PM_QOS_GPU_FREQ_BOUNDS, 385 pm_qos_add_max_notifier(PM_QOS_GPU_FREQ_BOUNDS,
379 &profile->qos_notify_block); 386 &profile->qos_notify_block);
380 } 387 }
388#endif
381 389
382 return; 390 return;
383 391
@@ -392,12 +400,14 @@ void gk20a_scale_exit(struct device *dev)
392 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); 400 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
393 int err; 401 int err;
394 402
403#ifdef CONFIG_GK20A_PM_QOS
395 if (platform->qos_notify) { 404 if (platform->qos_notify) {
396 pm_qos_remove_min_notifier(PM_QOS_GPU_FREQ_BOUNDS, 405 pm_qos_remove_min_notifier(PM_QOS_GPU_FREQ_BOUNDS,
397 &g->scale_profile->qos_notify_block); 406 &g->scale_profile->qos_notify_block);
398 pm_qos_remove_max_notifier(PM_QOS_GPU_FREQ_BOUNDS, 407 pm_qos_remove_max_notifier(PM_QOS_GPU_FREQ_BOUNDS,
399 &g->scale_profile->qos_notify_block); 408 &g->scale_profile->qos_notify_block);
400 } 409 }
410#endif
401 411
402 if (platform->devfreq_governor) { 412 if (platform->devfreq_governor) {
403 err = devfreq_remove_device(l->devfreq); 413 err = devfreq_remove_device(l->devfreq);