Commit Graph

19 Commits

Author SHA1 Message Date
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
Arto Merilainen
6135535c12 devfreq: Add Active Watermark governor
This patch adds a new watermark governor that actively alters the
watermark values based on the current frequency and target load.

The governor takes target load as a given property (80% by default)
and every time when the governor re-estimation is triggered, the
governor checks the current load and calculates the next frequency
that would push the device as close this target load as possible.

At this point also the watermark values are updated so that next
time the interrupt should come when the load change is significant
enough to cause frequency change to either next or previous
frequency.

Change-Id: I860a0bc984d55628a0e560652a93306616b080cf
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/598801
Reviewed-on: http://git-master/r/1160008
(cherry picked from linux-4.9 commit e55ba2a709574ce4f01ca2f8211393c795b75dad)
[talho: removed Kconfig and Makefile changes from the patch]
Signed-off-by: Timo Alho <talho@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1770140
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
Arto Merilainen
526edececa devfreq: Add debugfs interface to simple watermark
This patch adds support to tune low and high watermark values in
debugfs.

Change-Id: I82056a5c1baa29df9e0389fda7d2bc2cc1771978
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/1160007
(cherry picked from linux-4.9 commit 69b139a5024dbe04daf9d22ac2a6493251846f12)
Reviewed-on: https://git-master.nvidia.com/r/1770139
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
dcc3e906a0 devfreq: Rename watermark governor
This patch renames watermark governor from "watermark" to
"wmark_simple". This allows having more complex watermark
based scaling algorithms available.

Change-Id: If6a5653300f964173e6581bf256f7bf65041beb9
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/598799
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-on: http://git-master/r/1160006
(cherry picked from linux-4.9 commit a47423f57343b9609341065350e399ada5d767d0)
[talho: removed Kconfig and Makefile changes from patch]
Signed-off-by: Timo Alho <talho@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1770138
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
Ishan Mittal
7471ea5dc2 devfreq: governor_pod_scaling: Fix build errors
MODULE_LICENCE was not declared
exit function didnt have an explicit return

linux/module.h wasn't included because of which
module_exit was throwing errors.
Added the statement to do the same.

Bug 200199306

Change-Id: Ib9e3a6f832b75095b9465dbe236a1f1c3606563f
Signed-off-by: Ishan Mittal <imittal@nvidia.com>
(cherry picked from linux-4.9 commit be9e41d39b8f9b6bbd716ea7a26ea7fdec54bad7)
Reviewed-on: https://git-master.nvidia.com/r/1770137
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
b69d69ec4d devfreq: compare previous_freq only if podgov disabled
In update_devfreq(), we currently get target frequency,
compare it with previous_freq, and set it only if
new freq is different one

But get_target_freq() (nvhost_pod_estimate_freq())
already takes care of such cases in normal conditions
Hence, remove the check with previous_freq in
update_devfreq()

For case when we disable podgov governor, we might still end
up setting max freq all the time
Hence, add a check on previous_freq, and if previous_freq
is already max, do not set it

Bug 200175874
Bug 200161377

Change-Id: I287d37c07ee6214ed48612482211ce0f45088ca4
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1111437
Reviewed-on: http://git-master/r/1113417
(cherry picked from linux-4.9 commit 9c424ce31bedac5db0c2d93e083f20ea89ed1836)
Reviewed-on: https://git-master.nvidia.com/r/1770136
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
fbde18a19c devfreq: get dev status after checking if scaling is enabled
In nvhost_pod_estimate_freq(), we currently have below
sequence
- profile->get_dev_status()
- check if (!podgov->enable)
- check if (podgov->p_user)

But in case we have podgov disabled, we unnecessarily
call profile->get_dev_status()

Hence, do all such checks before calling get_dev_status()

Bug 200161377

Change-Id: I6128803c21bea6c5efefd517ea1c69e4f1b1597e
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/929508
Reviewed-on: http://git-master/r/933703
(cherry picked from linux-4.9 commit b8d1d439d206887c3cf4ff50119647b02efdae0e)
Reviewed-on: https://git-master.nvidia.com/r/1770135
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
Seshendra Gadagottu
efcf59c618 devfreq: tegra: add support for t18x
Extend devfreq support for t18x

Change-Id: I379110f9a1fb0b002b7224374f49a127929a635d
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: http://git-master/r/816897
Reviewed-on: http://git-master/r/828639
(cherry picked from linux-4.9 commit 4a43088268a3fe87b6208a77e806b4891226f9ff)
Reviewed-on: https://git-master.nvidia.com/r/1770134
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Tested-by: Bitan Biswas <bbiswas@nvidia.com>
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
Sam Payne
23ee901b27 video: tegra: host: move pod_scaling.c
move pod_scaling.c from nvhost to devfreq

bug 1645757

Change-Id: I0e905bf7e14aa264c4235ddfa94536acd5e4c008
Signed-off-by: Sam Payne <spayne@nvidia.com>
Reviewed-on: http://git-master/r/743942
Reviewed-on: http://git-master/r/756665
(cherry picked from linux-4.9 commit 80a8f5a341351c3973aee12fe1615785bcf8d6ee)
Reviewed-on: https://git-master.nvidia.com/r/1770133
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
Laxman Dewangan
cfaad5bd1c devfreq: remove Makefile to prepare for driver integration
The devfreq drivers are available in kernel/nvidia and it
is required to integrate in kernel/nvidia-oot.

Remove Makefile so avoid makefile conflict.

Bug 4038415

Change-Id: If0e81b66271d65c5a6d613d61be0e95d1af503e1
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-04-04 05:15:37 +00:00
Laxman Dewangan
b2a93e8e3b devfreq: Build governor pod scaling as OOT module
Make pod scaling governor as the OOT module.

Bug 3674466

Change-Id: Id99a72f508889d0b9c416ba908f8a2de62c594d1
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2726249
Reviewed-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-06-08 21:46:31 -07:00