aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2017-07-28 02:46:39 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-08-01 08:24:54 -0400
commit99d14d0e16fadb4de001bacc0ac0786a9ebecf2a (patch)
treef09808829ea602773845903f05ca6699b5fb16c6
parent674e75411fc260b0d4532701228cfe12fc090da8 (diff)
cpufreq: Process remote callbacks from any CPU if the platform permits
On many platforms, CPUs can do DVFS across cpufreq policies. i.e CPU from policy-A can change frequency of CPUs belonging to policy-B. This is quite common in case of ARM platforms where we don't configure any per-cpu register. Add a flag to identify such platforms and update cpufreq_can_do_remote_dvfs() to allow remote callbacks if this flag is set. Also enable the flag for cpufreq-dt driver which is used only on ARM platforms currently. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Saravana Kannan <skannan@codeaurora.org> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/cpufreq/cpufreq-dt.c1
-rw-r--r--include/linux/cpufreq.h18
2 files changed, 17 insertions, 2 deletions
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index fef3c2160691..d83ab94d041a 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -274,6 +274,7 @@ static int cpufreq_init(struct cpufreq_policy *policy)
274 transition_latency = CPUFREQ_ETERNAL; 274 transition_latency = CPUFREQ_ETERNAL;
275 275
276 policy->cpuinfo.transition_latency = transition_latency; 276 policy->cpuinfo.transition_latency = transition_latency;
277 policy->dvfs_possible_from_any_cpu = true;
277 278
278 return 0; 279 return 0;
279 280
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index c4035964e6b3..1981a4a167ce 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -127,6 +127,15 @@ struct cpufreq_policy {
127 */ 127 */
128 unsigned int transition_delay_us; 128 unsigned int transition_delay_us;
129 129
130 /*
131 * Remote DVFS flag (Not added to the driver structure as we don't want
132 * to access another structure from scheduler hotpath).
133 *
134 * Should be set if CPUs can do DVFS on behalf of other CPUs from
135 * different cpufreq policies.
136 */
137 bool dvfs_possible_from_any_cpu;
138
130 /* Cached frequency lookup from cpufreq_driver_resolve_freq. */ 139 /* Cached frequency lookup from cpufreq_driver_resolve_freq. */
131 unsigned int cached_target_freq; 140 unsigned int cached_target_freq;
132 int cached_resolved_idx; 141 int cached_resolved_idx;
@@ -564,8 +573,13 @@ struct governor_attr {
564 573
565static inline bool cpufreq_can_do_remote_dvfs(struct cpufreq_policy *policy) 574static inline bool cpufreq_can_do_remote_dvfs(struct cpufreq_policy *policy)
566{ 575{
567 /* Allow remote callbacks only on the CPUs sharing cpufreq policy */ 576 /*
568 if (cpumask_test_cpu(smp_processor_id(), policy->cpus)) 577 * Allow remote callbacks if:
578 * - dvfs_possible_from_any_cpu flag is set
579 * - the local and remote CPUs share cpufreq policy
580 */
581 if (policy->dvfs_possible_from_any_cpu ||
582 cpumask_test_cpu(smp_processor_id(), policy->cpus))
569 return true; 583 return true;
570 584
571 return false; 585 return false;