]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cpufreq: Introduce policy->boost_supported flag
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 23 Jan 2025 05:34:25 +0000 (11:04 +0530)
committerViresh Kumar <viresh.kumar@linaro.org>
Fri, 7 Feb 2025 04:15:14 +0000 (09:45 +0530)
It is possible to have a scenario where not all cpufreq policies support
boost frequencies. And letting sysfs (or other parts of the kernel)
enable boost feature for that policy isn't correct.

Add a new flag, boost_supported, which will be set to true by the
cpufreq core only if the freq table contains valid boost frequencies.

Some cpufreq drivers though don't have boost frequencies in the
freq-table, they can set this flag from their ->init() callbacks.

Once all the drivers are updated to set the flag correctly, we can check
it before enabling boost feature for a policy.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/cpufreq/freq_table.c
include/linux/cpufreq.h

index 16e56f2fcee4e58a21f16f42e6da74dd6463830b..185070052b41417e10b0cc37a4366b1337ac9899 100644 (file)
@@ -359,6 +359,10 @@ int cpufreq_table_validate_and_sort(struct cpufreq_policy *policy)
        if (ret)
                return ret;
 
+       /* Driver's may have set this field already */
+       if (policy_has_boost_freq(policy))
+               policy->boost_supported = true;
+
        return set_freq_table_sorted(policy);
 }
 
index c7d1fe5ebf7a79da4088404e3b7a30b41861f3b5..b017af4398b9d74b3bdeb78fcdf31ebe200569eb 100644 (file)
@@ -144,6 +144,9 @@ struct cpufreq_policy {
        /* Per policy boost enabled flag. */
        bool                    boost_enabled;
 
+       /* Per policy boost supported flag. */
+       bool                    boost_supported;
+
         /* Cached frequency lookup from cpufreq_driver_resolve_freq. */
        unsigned int cached_target_freq;
        unsigned int cached_resolved_idx;