aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cppc_cpufreq.c
diff options
context:
space:
mode:
authorShunyong Yang <shunyong.yang@hxt-semitech.com>2018-04-05 22:43:49 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-04-10 02:38:02 -0400
commit8913315e9459b146e5888ab5138e10daa061b885 (patch)
tree4090fd8c18406541ad0e73c9f3bf071be941d9f3 /drivers/cpufreq/cppc_cpufreq.c
parentbbcc328561040292f7d6796954d478e4a2335e6f (diff)
cpufreq: CPPC: Initialize shared perf capabilities of CPUs
When multiple CPUs are related in one cpufreq policy, the first online CPU will be chosen by default to handle cpufreq operations. Let's take cpu0 and cpu1 as an example. When cpu0 is offline, policy->cpu will be shifted to cpu1. cpu1's perf capabilities should be initialized. Otherwise, perf capabilities are 0s and speed change can not take effect. This patch copies perf capabilities of the first online CPU to other shared CPUs when policy shared type is CPUFREQ_SHARED_TYPE_ANY. Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Shunyong Yang <shunyong.yang@hxt-semitech.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/cppc_cpufreq.c')
-rw-r--r--drivers/cpufreq/cppc_cpufreq.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index 38f65c371139..bc5fc1630876 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -166,9 +166,19 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
166 NSEC_PER_USEC; 166 NSEC_PER_USEC;
167 policy->shared_type = cpu->shared_type; 167 policy->shared_type = cpu->shared_type;
168 168
169 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) 169 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
170 int i;
171
170 cpumask_copy(policy->cpus, cpu->shared_cpu_map); 172 cpumask_copy(policy->cpus, cpu->shared_cpu_map);
171 else if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL) { 173
174 for_each_cpu(i, policy->cpus) {
175 if (unlikely(i == policy->cpu))
176 continue;
177
178 memcpy(&all_cpu_data[i]->perf_caps, &cpu->perf_caps,
179 sizeof(cpu->perf_caps));
180 }
181 } else if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL) {
172 /* Support only SW_ANY for now. */ 182 /* Support only SW_ANY for now. */
173 pr_debug("Unsupported CPU co-ord type\n"); 183 pr_debug("Unsupported CPU co-ord type\n");
174 return -EFAULT; 184 return -EFAULT;