Skip to content

Commit 8def73f

Browse files
pierregondoissforshee
authored andcommitted
NVIDIA: VR: SAUCE: cpufreq: Set default policy->min/max values for all drivers
Some drivers set policy->min/max in their .init() callback. cpufreq_set_policy() will ultimately override them through: cpufreq_policy_online() \-cpufreq_init_policy() \-cpufreq_set_policy() \-/* Set policy->min/max */ Thus the policy min/max values provided are only temporary. There is an exception if CPUFREQ_NEED_INITIAL_FREQ_CHECK is set and: cpufreq_policy_online() \-__cpufreq_driver_target() \-cpufreq_driver->target() To prepare for a following patch that will remove all policy->min/max initialization in the driver .init() callback if the min/max value is equal to the cpuinfo.min/max_freq, set a default policy->min/max value for all drivers. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> (cherry picked from https://lore.kernel.org/lkml/20260511135538.522653-3-pierre.gondois@arm.com/) Signed-off-by: Seth Forshee <sforshee@nvidia.com>
1 parent f0acb4b commit 8def73f

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

drivers/cpufreq/cpufreq.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,6 +1395,13 @@ static int cpufreq_policy_init_qos(struct cpufreq_policy *policy)
13951395
{
13961396
int ret;
13971397

1398+
/*
1399+
* If the driver didn't set policy->min/max, set them as
1400+
* they are used to clamp frequency requests.
1401+
*/
1402+
policy->min = policy->min ? policy->min : policy->cpuinfo.min_freq;
1403+
policy->max = policy->max ? policy->max : policy->cpuinfo.max_freq;
1404+
13981405
if (policy->boost_supported) {
13991406
ret = freq_qos_add_request(&policy->constraints,
14001407
&policy->boost_freq_req,

0 commit comments

Comments
 (0)