Commit Graph

60 Commits

Author SHA1 Message Date
Johnny Liu
601567ef37 devfreq: nvhost_podgov: implementation cleanup
Previous implementation lacks of documentation and it's hard to
understand the effect of changing specific tunable parameter.

Revise the implementation so that the scaling behavior is somehow
aligned with the tegra_wmark governor supported by the actmon. The
only different is that nvhost_podgov governor is polling-based DFS
algorithm and it maintaines the moving average load in the governor
instead of hardware itself.

Bug 4892068

Change-Id: I033cb1359a484d4c9433fa4f2e7a99c42cb636b3
Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3315446
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Rajesh Devaraj <rdevaraj@nvidia.com>
2025-07-24 10:19:16 +00:00
Johnny Liu
bca162a20d kleaf: add tegra_wmark module in build targets
The tegra_wmark is a specialized devfreq governor to support
interrupt-driven DVFS algorithm with Host1x Actmon infrastructure.

This governor will be used for NVDEC/NVENC/OFA/VIC engines to
support load-based DVFS.

Bug 5147566

Change-Id: I9a60c22e8f12ea579e43e883a273a76d1170e0f5
Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3313827
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Ankita Garg <ankitag@nvidia.com>
Reviewed-by: Frankie Chang <frankiec@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2025-07-24 10:19:16 +00:00
Johnny Liu
d21ee3b3a8 devfreq: nvhost_podgov: fix build issue for K519+
Since K519+, frequency table and max_state information is stored in the
devfreq struct directly, not in the devfreq_dev_profile struct. Use
nvidia conftest to conditionally build the governor and choose the
correct data structure for accessing the information.

Kernel build won't complain anything when build the governor, but when
the devfreq driver (e.g. nvgpu) trying to add the devfreq device
with the nvhost_pogdov governor, it will fail to add the devfreq
device since the frequency table information is NULL in the
devfreq_dev_profile and the governor use the wrong information.

Bug 4883576

Change-Id: I885bc4ceac885eea5644416b6eacefbbea523a2b
Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3229870
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
2025-07-24 10:19:07 +00:00
Johnny Liu
5b3ba584c3 devfreq: use conftest for conditional module build
Some distros might use old kernel source but with some latest upstream
kernel patches backported to their kernel source tree. To deal with this
scenario and avoid kernel compilation failure, use conftest to check the
existence of features against the kernel source tree which the OOT
modules are built upon and do the conditional build based on the test
result generated with the conftest tool.

Use NV_DEVFREQ_HAS_FREQ_TABLE to determine whether freq_table field is
there in struct devfreq data strcuture, and choose the correct path for
building the module.

Use tegra_wmark-specific devfreq_get_freq_range always to avoid kernel
version check and conftest check. Since devfreq_get_freq_range exists in
the devfreq-specific governor.h (e.g. drivers/devfreq/governor.h) file
instead of globabl linux kernel include header files
(e.g. include/linux/devfreq.h), conftest cannot be used to the existence
of devfreq_get_freq_range kernel function.

Bug 4884092

Change-Id: I5bde4c712f59f38de74c1d8d95135c9b25d621b1
Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3220896
(cherry picked from commit c580fd0d06)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3220970
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:07 +00:00
Jian-Min Liu
a067801e61 nvidia-oot: Clean-up check ACK by NV_BUILD_KERNEL_OPTIONS
Control ACK feature only by CONFIG_TEGRA_SYSTEM_TYPE_ACK from
kernel-build. This can make build nv-oot clearer.

Bug 4405208

Change-Id: Ia3f036f9a59b829d762ced15b01f4342720f291d
Signed-off-by: Jian-Min Liu <jianminl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3027994
Reviewed-by: Ankita Garg <ankitag@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-08 06:47:23 -08:00
Johnny Liu
e3ce443fc9 devfreq: Migrate to K519 devfreq for tegra_wmark
Since K519, devfreq takes the priority of devfreq_dev_profile to save
the frequency table information and the number of frequency steps.

Therefore, change the implementation of tegra_wmark devfreq governor to
use devfreq to access the frequency table information and the nubmer of
frequency steps instead of devfreq_dev_profile.

Bug 4288411

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Ib0affdcc8913642167cd82d45d014c46b51a8c38
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2980425
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-19 03:30:17 -07:00
Johnny Liu
3db3e1ee88 devfreq: Disable watermark when switching governor
Before switching to another governor, tegra_wmark governor should
disable watermarks so that watermark interrupts won't get triggered and
occupy the CPU resource.

Bug 4180241

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I7aa5611445153b63e4849f4c077ef5fa9fbf4c88
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2930457
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Rajkumar Kasirajan <rkasirajan@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-05 14:55:56 -07:00
Johnny Liu
0da771f275 devfreq: Support suspend and resume in tegra_wmark
When devfreq_suspend_device get called, tegra_wmark will disable the
upper and lower watermark thresholds so that no DFS logic get triggered
after the suspension.

When devfreq_resume_device get called, tegra_wmark will enable back the
upper and lower watermark thresholds so that interrupt-driven DFS logic
can work properly.

Bug 4168788

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I98fa1487db26fdfe95f5c958dbe15bf0f49035d5
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2927019
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-28 02:06:25 -07:00
Ankita Garg
628e74016a nvidia-oot: Disable tegra_wmark in ACK
Temporarily disable these modules in android common kernel(ACK), due to
the build errors encountered when using clang.

Bug 3974840

Change-Id: I3a8d63112ac3ff7c8ac3a7dfe6fd757553cd8c57
Signed-off-by: Bruce Xu <brucex@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2921067
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-19 12:33:00 -07:00
shaochunk
8b310f6369 devfreq: Add governor attribute for nvhost_podgov
add governor attributes for nvhost_podgov in K5.15
- timer
- polling_interval

Bug 4137663

Change-Id: Ib8a989dec51474ba507a33cdc232fa24212414a5
Signed-off-by: Shao-Chun Kao <shaochunk@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2913189
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Rajkumar Kasirajan <rkasirajan@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-06 01:55:32 -07:00
Johnny Liu
d06443deae devfreq: Add tegra_wmark governor
The tegra_wmark governor can be used e.g. with DRM clients, such as VIC,
NVDEC, NVENC, and NVJPG. This governor tightly collaborates with the
actmon hardware used for monitoring the active time of the underlying
DRM clients.

Bug 3788919

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Ie4d4c2b173615aa239436fbb1545118435629d38
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2894529
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-09 22:27:14 -07:00
Johnny Liu
85c4d41d99 devfreq: Get rid of unused CONFIGs
Remove the config variables as there is no Kconfig to define
these configs:
   CONFIG_DEVFREQ_GOV_WMARK_SIMPLE
   CONFIG_DEVFREQ_GOV_WMARK_ACTIVE

Remove the handling of non-module build as devfreq is always
build as module.

Remove the wmark-related devfreq governors as we plan to keep
them under drivers/gpu/drm/tegra. They are tightly bound with
the actmon and drm drivers.

Bug 4074863

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Iba8f5da770d86ddcfb6315f72fd74fc9a781ab39
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2893701
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-28 08:10:27 -07:00
Laxman Dewangan
b866f4df8e devfreq: Get rid of explicit header inclusion
The required headers for devfreq driver are already
included in the master makefile. Hence, it is not
required to add include path explicitly.

Bug 4087103

Change-Id: I44793d4584479ba8148da310172749cfb58b8332
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2894610
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Johnny Liu <johnliu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-27 08:15:01 -07:00
Laxman Dewangan
863cebf312 dev-freq: Use SPDX license GPL 2.0 format
Use SPDX license GPL-V2.0 format and change Nvidia
copyright year to include 2023.

Bug 4078035

Change-Id: I386f82eec7ead65f0c3c6195004f2f9d6c8a3f74
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2891210
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Johnny Liu <johnliu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-21 11:40:19 -07:00
Laxman Dewangan
846435a74c drivers: Remove Kconfig files
The kconfig files from nvidia-oot will not get
parsed as the drivers in nvidia-oot are out tree and
does not support any config variable.

Bug 4074863

Change-Id: I6825a94c56404a6860dea9f2afd1ca3bc68e10a4
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2889266
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-19 10:54:28 -07:00
Jon Hunter
0a12bf1be8 devfreq: pod v2: Add support for Linux v6.3
Currently the pod v2 governor only supports kernels upto Linux v6.2.
Now that Linux v6.3-rc1 is available we can enable support for this
kernel by ensuring that the definitions and functions defined in the
governor_v2.h are compatible with upstream.

Bug 4014315

Change-Id: I6a1440fe36887b86946527483d0baecb83c017a7
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2867139
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:18:03 +00:00
Jon Hunter
0852eda522 devfreq: pod v2: Add support for Linux v6.2
Currently the pod v2 governor only supports kernel upto Linux v6.0. Now
that Linux v6.2-rc2 we can enable support for this kernel by ensuring
that the definitions and functions defined in the governor_v2.h are
compatible with upstream.

Note that by enabling support for v6.2 kernels, we want to allow the
driver to be built for all v6.2.x kernels and not just v6.2.0. So enable
building the driver for all kernels less than v6.3.0.

Bug 3820317

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Change-Id: I3087c660c9cd7d4aac016d5e9c8d9a089eea368c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2836690
(cherry picked from commit 7f73ecbdf7d78ae6f61234374706a24bda73e079)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2837247
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:18:03 +00:00
Andrew Chen
24d4fa2e60 devfreq: wmark: active: add wmark margin attrs
Add configurable high and low watermark margins to wmark_active
governor. As the names suggested, they represent the margins of
a given watermark. A smaller margin means a tighter load threshold
to trigger the frequency adjustment and vice versa.

Bug 200493763

Change-Id: Ie41e311dd483a1ad2f917ac7296f392262b5fd1f
Signed-off-by: Andrew Chen <andrewc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2819287
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: David Ung <davidu@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:18:03 +00:00
Jon Hunter
219d548fd4 devfreq: pod v2: Add support for Linux v6.1
Currently the pod v2 governor only supports kernel upto Linux v6.0.
Now that Linux v6.1-rc1 is released we can enable support for Linux v6.1
by ensuring that the definitions and functions defined in the
governor_v2.h are compatible with upstream.

Bug 3835208

Change-Id: I028346f2ac2c0f8e5c08b75e91355a719803e999
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2793480
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:18:03 +00:00
Jon Hunter
d8383c2fd4 devfreq: pod v2: Add support for Linux v6.0
Currently the pod v2 governor only supports kernel upto Linux v5.19.
Now that Linux v6.0-rc2 we can enable support for this kernel by
ensuring that the definitions and functions defined in the governor_v2.h
are compatible with upstream.

Bug 3767126

Change-Id: I18c055bd8c8c963130921993522aaf52bdc5ec99
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2772878
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:18:03 +00:00
Jon Hunter
a50a8e12cc devfreq: pod v2: Add support for Linux v5.19
Currently the pod v2 governor only supports kernel upto Linux v5.17. Now
that Linux v5.19-rc2 we can enable support for this kernel by ensuring
that the definitions and functions defined in the governor_v2.h are
compatible with upstream.

JIRA LS-418
Bug 3674235

Change-Id: I3a42290e5207163b82dea8a13d11bfa6decb8317
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2728508
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-04 05:18:03 +00:00
Laxman Dewangan
b34923cfa5 devfreq: Enable module build for OOT
If CONFIG_TEGRA_OOT_MODULE is set as m then build devfreq
governor governor_pod_scaling_v2 as module.

Bug 3674466

Change-Id: Idfcc6178b92f304eadd08cc8c8aba0df46ee1238
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2726202
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-04 05:18:03 +00:00
Jinesh Parakh
19de6baf19 drivers: devfreq: Fix CERT-C Violations
Fix the following CERT-C Violations:
governor_pod_scaling_v2.c : CERT ERR33-C

The violations occur due to non-verification of the snprintf
return values.
Adding WARN_ON statements to verify the return values.

CID 378002
CID 391305
CID 442828
CID 443110

Bug 3512546

Signed-off-by: Jinesh Parakh <jparakh@nvidia.com>
Change-Id: I91c35ecce9348d4f7127eafa603d2b8c2391ba18
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2723684
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Peng Liu
8a2d6e1b54 devfreq: pod v2: build as ext module for kstable
governor_pod_scaling_v2 will be provided as a kernel module in future
NVIDIA software deliverables for Linux platforms. As of this moment, the
function that returns the range of the device's scaling frequency hasn't
been exposed from Linux kernel for modules to call. A similar function
is implemented in the governor_pod_scaling_v2, but this function cannot
get the frequency constraints put through the PM QOS interface due to
the same reason, lack of kernel API function. An upstream kernel patch
has been proposed by the power management maintainer to provide the
function needed by governor_pod_scaling_v2, but it's not in any release
kernel yet. For now, PM QOS support is removed from
governor_pod_scaling_v2 and it will be added back when the upstream
kernel patch is available in kernel releases.

drivers_devfreq_governor_5_14.h is a copy of drivers/devfreq/governor.h
of Linux kernel 5.14. Having this copy is to avoid introducing the
dependency on Linux source for building the podgov as external module.

JIRA ID: LS-418

Signed-off-by: Peng Liu <pengliu@nvidia.com>
Change-Id: I0c70acf5679fed53f30bc3ba7c01ea571036cc5e
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2638232
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-04 05:18:03 +00:00
Johnny Liu
97ff547e3c devfreq: wmark: active: add trace log
Add trace log to print load and frequency.

Bug 200493763
Bug 200494025

Change-Id: Ieb1b28c4546230dbdefd14f11e07a92dd91eb702
Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2673488
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Rajkumar Kasirajan <rkasirajan@nvidia.com>
Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-04 05:18:03 +00:00
Arto Merilainen
abc0d9c44d video: tegra: host Register PDs before drivers
Register power domains before platform drivers to ensure that
the platform drivers get probed during rootfs initcall.

Move devfreq governor initialization to happen at
subsys_initcall() to ensure that the governor is available
at the time VIC is probed.

Bug 3270580

Change-Id: Ifaa958f8c8fd5022ab69de2d04ab46ddc4a9a885
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2497019
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Ken Chang
655ee7d9db devfreq: wmark: active: set interrupt_driven
Set interrupt_driven to 1 thus cancel_delayed_work_sync() won't be
called in devfreq_monitor_suspend() when handling DEVFREQ_GOV_SUSPEND
event. This will avoid below warning prints when runtime PM is enabled.

[ 22.121071] INFO: trying to register non-static key.
[ 22.126030] the code is fine but needs lockdep annotation.
[ 22.131501] turning off the locking correctness validator.

The backstrace:
[    9.322855] [<ffffff80080d3b04>] flush_work+0x1fc/0x208
[    9.322858] [<ffffff80080d5180>] __cancel_work_timer+0xa0/0x188
[    9.322862] [<ffffff80080d52bc>] cancel_delayed_work_sync+0x24/0x30
[    9.322867] [<ffffff8008ce1da4>] devfreq_monitor_suspend+0x4c/0x80
[    9.322871] [<ffffff8008ce6d7c>] devfreq_watermark_event_handler+0x3b4/0x458
[    9.322874] [<ffffff8008ce1d20>] devfreq_suspend_device+0x60/0x98
[    9.322878] [<ffffff800852dad4>] nvhost_module_runtime_suspend+0x64/0x160
[    9.322883] [<ffffff800878dc64>] pm_generic_runtime_suspend+0x3c/0x58
[    9.322887] [<ffffff800879e478>] genpd_runtime_suspend+0x98/0x230
[    9.322890] [<ffffff8008790004>] __rpm_callback+0x74/0xa0
[    9.322893] [<ffffff8008790064>] rpm_callback+0x34/0x98
[    9.322896] [<ffffff80087906c8>] rpm_suspend+0x100/0x5f0
[    9.322899] [<ffffff80087921d0>] pm_runtime_work+0x80/0xb8
[    9.322902] [<ffffff80080d4054>] process_one_work+0x1e4/0x4b0
[    9.322904] [<ffffff80080d4370>] worker_thread+0x50/0x4c8
[    9.322908] [<ffffff80080daffc>] kthread+0xec/0xf0
[    9.322911] [<ffffff80080838a0>] ret_from_fork+0x10/0x30

Bug 3128395

Change-Id: I15116cd452a062620c01e91f71eecba7d68cde17
Signed-off-by: Ken Chang <kenc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2418831
(cherry picked from commit b722658b31e1dc622870a9d5f38a8418ef8493ca)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2434773
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Aaron Tian <atian@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-04 05:18:03 +00:00
Aaron Tian
008fd60935 devfreq: introduce DEVFREQ_GOV_POD_SCALING_V2
Introduce DEVFREQ_GOV_POD_SCALING_V2 for podgov
governor implementation on kernel-5.9 and later
version to address major changes in upstream
devfreq framework.

1. devfreq framework uses devm_pm_qos to store
   "min/max frequency request from user-space",
   which caused 'min_freq' & 'max_freq' field
   in struct devfreq have been removed.
2. DEVFREQ_GOV_INTERVAL renamed as DEVFREQ_GOV_UPDATE_INTERVAL, and
   devfreq_interval_update() renamed as devfreq_update_interval()
3. return type of debugfs_create_u32() changed to void

Bug 200639056

Change-Id: I673ae3ac6b55b26766253ae0f1aeba181e2e0b53
Signed-off-by: Aaron Tian <atian@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2400108
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Mary Do
3961eaa5a4 podgov: Clear history and set freq before suspend
While the device is active, devfreq calls into
podgov to set the device frequency based on the
device workload. When the device goes into
suspension, devfreq would do one last call into
podgov before going into suspension. However,
because podgov decides the frequency based on
the history of previous loads, if the load drops
suddenly (i.e. going from 100% to 0%), this last
call might result in the frequency set high and
kept high until devfreq resumes running.

In this change, podgov would check if the device
has been suspended, and if so, it would clear the
history and set the frequency to min freq before
suspending devfreq. As a result, whenever the
device is suspended, its frequency will be set to
min freq.

Bug 200613859

Change-Id: I1ad2fd563407d53177a84f8fddbf47b699fa97b5
Signed-off-by: Mary Do <mdo@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2358085
(cherry picked from commit 87aa75c4ecd60a13056e32a00876b48591a520ec)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2363435
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-04 05:18:03 +00:00
Aaron Tian
cd1ab69066 devfreq: wmark: active: config params by sysfs
Configure governor parameters through sysfs instead of
debugfs, add add spinlock for concurrency protection.

Bug 200501949

Change-Id: I0131e6ab0d3befe380ef4774eb4d6193d2266011
Signed-off-by: Aaron Tian <atian@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2267338
(cherry picked from commit 6d2e734e3b1a3d951a7b934c869c91f99dc3f2f7)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2278103
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Aaron Tian
b2ef349be6 devfreq: wmark: active: introduce freq_boost_en knob
There is a freq. boost mechanism in wmark_active governor,
when current loading exceed load_max, directly set target
freq. to fmax.

Introduce 'freq_boost_en' knob to support enable/disable
freq. boost. If performance does not regressed, freq. boost
can be disabled to let DFS smoothly and save power.

Bug 200501949

Change-Id: I6ec7b7079a22a8d974743d766cfd0cc7d0e2dcd4
Signed-off-by: Aaron Tian <atian@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2255082
(cherry picked from commit 30c0d8332a9a36f88c4ba809b94cf5b0669e9b55)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2263228
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Aaron Tian
410b58af61 video: tegra: host: update T186 VIC actmon driver
Modify T186/T210 VIC actmon driver and wmark_active governor
to address the following issues:

1. To let VIC actmon reports accurate VIC active
   cycle counts, set static WEIGHT_COUNT in both
   VIC actmon and VIC IP block. It ensures
   VIC actmon can capture all activity signal
   toggle event from VIC.

   The value of WEIGHT_COUNT are equal to:

   4 * (max VIC freq / VIC_actmon freq)
       = 4 * (1024 / 19.2)
      ~= 213

2. Since VIC actmon reports active "VIC clock
   cycle" instead of "VIC actmon clock cycle",
   "relative loading translation" should consider
   current VIC clock freq.

   E.g.,
     - sample_period = 80 us, VIC freq = 115.2 Mhz
     - 9216 cycles represents 100% loading
       (115.2 * 80)

3. Update upper/lower wmark settings after VIC
   clock scaled completed, to ensure wmark settings
   are equil to 0 ~ 100% loading of current freq.
   - Register 'get_dev_status' instance in
     devfreq_dev_profile, to let wmark active
     governor can query current device freq.
   - Register devfreq transition notifier in
     wmark_active governor. It will query current
     device freq. and update corresponding wmark
     value after VIC freq. changed.

Bug 200501949

Change-Id: Ic159eb93fddc37d55b0c9649a3afcb50ed82cac2
Signed-off-by: Aaron Tian <atian@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2200520
(cherry picked from commit d6c7740ea2ddd9d5087d938e9ee3b3bc2c9b6d0a)
Reviewed-on: https://git-master.nvidia.com/r/2263225
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Peng Liu
0a98957d78 devfreq: recent high as a scaling factor
A circle buffer is introduced to store recent normalized GPU active
cycle counts. The highest value in this buffer marks the busiest
moment in recent history. When podgov decides next GPU freqeuncy, it
makes sure the new frequency level can satisfy the recent high work
load. This can be considered as an adaptive GPU frequency floor. This
feature can reduce stutter for certain use cases where work load
spikes occur without any temporal pattern, such as 4k video playback.

Bug 1963732

Change-Id: I70024f4d3ffb63425852e4f320eeffb6bc77c5e3
Signed-off-by: Peng Liu <pengliu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2114154
GVS: Gerrit_Virtual_Submit
Reviewed-by: Thomas Fleury <tfleury@nvidia.com>
Tested-by: Aaron Tian <atian@nvidia.com>
Reviewed-by: David Lock <dlock@nvidia.com>
Reviewed-by: Mubushir Rahman <mubushirr@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Peng Liu
216ab9426c devfreq: podgov: use cycles/sec to estimate load
GPU clock may change within the period of time defined by smooth. Thus
the result of averaging load percentages within smooth window has less
meanning. New method keeps track of active GPU cycle count per time
unit, and average load is average active cycle count divided by
current GPU clock (total cycle count per time unit).

Bug 1963732

Change-Id: I88cfb998f9bcfa0d6d0397f653f8e3096d4b3eed
Signed-off-by: Peng Liu <pengliu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2033266
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Timo Alho
7641694f0a devfreq: add core kernel directory to include path
Add include path pointing to core kernel repository in order for the
drivers to include "governor.h" and possibly other local header files
from there.

Bug 2246029

Change-Id: Ic4e31e51c6ef6fa8b2f9ef6ce19e4ae87f90a1f3
Signed-off-by: Timo Alho <talho@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1774215
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2023-04-04 05:18:03 +00:00
Timo Alho
6ab5d16908 devfreq: add Makefile and Kconfig for Nvidia governors
POD_SCALING, WMARK_ACTIVE, and WMARK_SIMPLE devfreq scaling governors
were moved to linux-nvidia repository. Add corresponding Kconfig and
Makefile for them.

Bug 200427621

Change-Id: Ib6e9416c11c5a6938c472ebf2d9480d85ddd473d
Signed-off-by: Timo Alho <talho@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1770155
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Joseph Lo
164daa17cc devfreq: wmark: active: add GPL module license
Add GPL module license to able to use the symbols that are exported by
"EXPORT_SYMBOL_GPL".

Bug 200299507

Change-Id: I127507b86392ebc20f5d04a747c528e788d87294
Signed-off-by: Joseph Lo <josephl@nvidia.com>
Reviewed-on: http://git-master/r/1478916
Reviewed-on: https://git-master.nvidia.com/r/1551729
(cherry picked from linux-4.9 commit aa85b2d73b55496faabf0deae896d021bda7d8c8)
Reviewed-on: https://git-master.nvidia.com/r/1770154
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Timo Alho <talho@nvidia.com>
Tested-by: Timo Alho <talho@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Stephen Warren
1aeace4daf Fix include paths for in-tree builds
Some source files include header files using <> even though the header
file is not in a directory typically in the system include path. This
works when compiling the kernel with an O= option (which stores built
files outside the source tree) because the kernel adds various extra
source paths to the system include path. However, this doesn't happen when
building in-tree, so the source must be fixed to use "" for "local" files.

Similarly, fix one usage of "" where no path was specified in the ""
filename, whereas the header was in a relative directory to the source.
Again, with O= I believe this works because the kernel added the file's
location into the include path, but doesn't for in-tree builds.

Note: Parts of the original commit apply to source that has been moved
to linux-nvidia.git; see change Icf4f94b671e73c0a889bb996edc3f15d5fbde98b
for that part of the original rel-28 change.

Bug 1978388

Change-Id: I907c88a4822b309a33c031ec21dd215047ea3e94
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1544318
Reviewed-on: https://git-master.nvidia.com/r/1545674
Reviewed-on: https://git-master.nvidia.com/r/1546976
(cherry picked from linux-4.9 commit cc6281afdbe059734d53f54020f1ead0b5cf3659)
Reviewed-on: https://git-master.nvidia.com/r/1770153
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Timo Alho <talho@nvidia.com>
Tested-by: Timo Alho <talho@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Peter Boonstoppel
297a2218f1 devfreq: stop podgov polling when disabled through sysfs
The pod governor allows scaling to be enabled/disabled through
sysfs. In the current implementation the devfreq_monitor keeps polling
periodically even when scaling is disabled. This patch disables the
timer when scaling is disabled.

NVGPU-20

Change-Id: I6842585afec48dbc9a2fe5aee96867c68612a127
Signed-off-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-on: https://git-master/r/1485185
(cherry picked from linux-4.9 commit 96ebb9e97b84092a852274f90e214d3976944b78)
Reviewed-on: https://git-master.nvidia.com/r/1770152
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Timo Alho <talho@nvidia.com>
Tested-by: Timo Alho <talho@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Peter Boonstoppel
3c30f1e47b devfreq: Clean up podgov parameter initialization
Remove support for VIC
Remove checks for chipid
Remove unused througput parameters

Jira NVGPU-20

Change-Id: I806c5689df12ff742f1be577a25ecc1b194e5075
Signed-off-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-on: https://git-master/r/1484197
(cherry picked from linux-4.9 commit 50ea795ac3224693b237445f2edd6d7296369576)
Reviewed-on: https://git-master.nvidia.com/r/1770151
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Timo Alho <talho@nvidia.com>
Tested-by: Timo Alho <talho@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Peter Boonstoppel
5007383f9f devfreq: Use devfreq timers for podgov
The pod governor used to rely on being invoked from nvgpu on every
gk20_busy/idle() call. This was done originally for load-tracking
purposes. This change refactors the code to instead rely on devfreq's
internal polling loop for calling the governor periodically. It also
removes the idle timeout from the podgov code, since devfreq will keep
polling even when the GPU is idle.

Jira NVGPU-20

Change-Id: I767b74c250d199e3cd5f7e249a49736836a54c0d
Signed-off-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-on: https://git-master/r/1484196
(cherry picked from linux-4.9 commit 5a0a5adcd0bd6fabbff9818ed6adba79cd8242ef)
Reviewed-on: https://git-master.nvidia.com/r/1770150
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Timo Alho <talho@nvidia.com>
Tested-by: Timo Alho <talho@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Deepak Nibade
d63c243547 devfreq: don't set last_scale for same freq
In nvhost_pod_estimate_freq(), we have *freq = 0
in case we decide to keep same frequency
In that case we set *freq as current frequency and
then set last_scale timestamp

This can result in keeping same frequency for
long duration due to less delta from last_scale

To fix this, return immediately in case *freq
is zero and do not set last_scale timestamp

Bug 200255163

Change-Id: Ie13bf54e2415c4016a101b9ea12a9abda83240fd
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1265185
Reviewed-on: http://git-master/r/1506359
(cherry picked from linux-4.9 commit be5331c94ebe9044cb67e3f622db517bfb7e28d4)
Reviewed-on: https://git-master.nvidia.com/r/1770149
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Timo Alho <talho@nvidia.com>
Tested-by: Timo Alho <talho@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Timo Alho
52f91e7e3e devfreq: tegra: use soc/tegra/chip-id.h for soc header
The soc tegra headers are unified and moved all the content of
linux/tegra-soc.h to the soc/tegra/chip-id.h to have the
single soc header for Tegra.

Change-Id: I4c45721243574f5d9e533360538790a94eaa57de
Signed-off-by: Timo Alho <talho@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1770148
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Konsta Holtta
79d16144f0 devfreq: remove throughput hints from podgov
The CONFIG_TEGRA_THROUGHPUT-dependent throughput hint feature is dead,
so remove the code from podgov that used it.

Bug 1853519

Change-Id: Icb36eb0b2baa98757b3ce419080b43978384bbc9
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: http://git-master/r/1454591
(cherry picked from linux-4.9 commit 96fcf87d98618ddf9a1e23a017294d201040859b)
Reviewed-on: https://git-master.nvidia.com/r/1770147
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Timo Alho <talho@nvidia.com>
Tested-by: Timo Alho <talho@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Deepak Nibade
625f652f89 devfreq: set current freq in case no change required
API scaling_state_check() returns 0 in case no change
in frequency is required
In nvhost_pod_estimate_freq(), we set *freq to 0
in case scaling_state_check() returns 0

And as a result of this, update_devfreq() will just
keep setting minimum frequency instead of keeping
same frequency - and this results in huge
performance degradation

To fix this, set *freq to current frequency in case
scaling_state_check() returns 0 as estimated
frequency

Bug 200255163

Change-Id: Ia8fe54dfd48b0898cc1dd53d821b1c95865b1f57
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1261281
(cherry picked from linux-4.9 commit 624718566201ce9c0b9780be6f29dc2ae9082b09)
Reviewed-on: https://git-master.nvidia.com/r/1770146
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Timo Alho <talho@nvidia.com>
Tested-by: Timo Alho <talho@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Deepak Nibade
8a5e6773ed devfreq: remove FREQ_DONTSCALE return if same freq
In nvhost_pod_estimate_freq(), we return
GET_TARGET_FREQ_DONTSCALE if new frequency is same
as current frequency

And based on this return value, update_devfreq()
will just return without actually calling target()
function

But it is possible that target() function has freq
clipping of its own, and skipping target() itself
will break this

Hence in case we find new frequency same as current
frequency, do not return GET_TARGET_FREQ_DONTSCALE
Instead just return 0

Note that we still return GET_TARGET_FREQ_DONTSCALE
if governor itself is disabled, and this is
required in perf measurement cases

Bug 200245796

Change-Id: I55a3a344982c5b5441ba011cd0dd254947e89e5c
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1251841
(cherry picked from linux-4.9 commit c6417ac88eb43501b8bf6d5351059ac2dadaf2c0)
Reviewed-on: https://git-master.nvidia.com/r/1770145
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Timo Alho <talho@nvidia.com>
Tested-by: Timo Alho <talho@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Mikko Perttunen
ed2d152576 devfreq: wmark: fix compilation on kernel 4.4
The watermark devfreq governors were not building
on kernel 4.4 due to a missing include of module.h
Add the include.

JIRA HOSTX-50

Change-Id: Ieebf5cd0bf6a0737e501423c1f182de5838f31a3
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-on: http://git-master/r/1189446
(cherry picked from linux-4.9 commit e397f5ebd40c9f5114efdd0f6da7e189e51203a6)
Reviewed-on: https://git-master.nvidia.com/r/1770144
GVS: Gerrit_Virtual_Submit
Reviewed-by: Timo Alho <talho@nvidia.com>
Tested-by: Timo Alho <talho@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Shridhar Rasal
a55c8f34e2 devfreq: wmark: active: init average target freq
- initializes average target freq parameter of active watermark
  governor parameter to current frequency set during start and
  resume from suspend.

Bug 200165367

Change-Id: I56b43ea371c77e95285944433615660400da94ea
Reviewed-on: http://git-master/r/936632
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-on: http://git-master/r/1160862
(cherry picked from linux-4.9 commit 331b1f92e097209b3afd9ab92fe5337152c604e2)
Reviewed-on: https://git-master.nvidia.com/r/1770143
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Timo Alho <talho@nvidia.com>
Tested-by: Timo Alho <talho@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Arto Merilainen
a18f6421d2 devfreq: Improvements watermark active policy
This patch modifies wmark active policy to...
- track average frequency requirement
- not scale too often - there is now 50ms hysteresis.

Bug 1625576

Change-Id: I18afc5249a4821f62a0a58cdccd163e11763c841
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/719594
Reviewed-on: http://git-master/r/1160010
(cherry picked from linux-4.9 commit d451a28402cfee5bf393b44674b4a50a4321a131)
Reviewed-on: https://git-master.nvidia.com/r/1770142
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Timo Alho <talho@nvidia.com>
Tested-by: Timo Alho <talho@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Arto Merilainen
29440602f3 devfreq: Improve wmark_active initialization
The wmark_active governor initialization assumes that the device
frequency is the lowest possible frequency when the governor is
started or resumed. However, this may not be correct if the
governor was suspended/stopped before the clock had been slowed
down.

This patch modifies the governor to read the frequency during
governor initialization and resume.

Change-Id: I38d3256102b344bc8818c5623a015843678a8ce5
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/733007
Reviewed-on: http://git-master/r/1160009
(cherry picked from linux-4.9 commit 32e2561dffc5d7390fa4fd503651da9013403ecb)
Reviewed-on: https://git-master.nvidia.com/r/1770141
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Timo Alho <talho@nvidia.com>
Tested-by: Timo Alho <talho@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00