Lines Matching full:cpu
16 #include <linux/cpu.h>
33 * These structs contain information parsed from per CPU
35 * e.g. For each CPU the highest, lowest supported
61 static unsigned int cppc_cpufreq_perf_to_khz(struct cppc_cpudata *cpu,
140 static unsigned int cppc_cpufreq_perf_to_khz(struct cppc_cpudata *cpu, in cppc_cpufreq_perf_to_khz() argument
144 struct cppc_perf_caps *caps = &cpu->perf_caps; in cppc_cpufreq_perf_to_khz()
159 div = cpu->perf_caps.highest_perf; in cppc_cpufreq_perf_to_khz()
164 static unsigned int cppc_cpufreq_khz_to_perf(struct cppc_cpudata *cpu, in cppc_cpufreq_khz_to_perf() argument
168 struct cppc_perf_caps *caps = &cpu->perf_caps; in cppc_cpufreq_khz_to_perf()
182 mul = cpu->perf_caps.highest_perf; in cppc_cpufreq_khz_to_perf()
193 struct cppc_cpudata *cpu; in cppc_cpufreq_set_target() local
198 cpu = all_cpu_data[policy->cpu]; in cppc_cpufreq_set_target()
200 desired_perf = cppc_cpufreq_khz_to_perf(cpu, target_freq); in cppc_cpufreq_set_target()
202 if (desired_perf == cpu->perf_ctrls.desired_perf) in cppc_cpufreq_set_target()
205 cpu->perf_ctrls.desired_perf = desired_perf; in cppc_cpufreq_set_target()
210 ret = cppc_set_perf(cpu->cpu, &cpu->perf_ctrls); in cppc_cpufreq_set_target()
214 pr_debug("Failed to set target on CPU:%d. ret:%d\n", in cppc_cpufreq_set_target()
215 cpu->cpu, ret); in cppc_cpufreq_set_target()
228 int cpu_num = policy->cpu; in cppc_cpufreq_stop_cpu()
229 struct cppc_cpudata *cpu = all_cpu_data[cpu_num]; in cppc_cpufreq_stop_cpu() local
232 cpu->perf_ctrls.desired_perf = cpu->perf_caps.lowest_perf; in cppc_cpufreq_stop_cpu()
234 ret = cppc_set_perf(cpu_num, &cpu->perf_ctrls); in cppc_cpufreq_stop_cpu()
236 pr_debug("Err setting perf value:%d on CPU:%d. ret:%d\n", in cppc_cpufreq_stop_cpu()
237 cpu->perf_caps.lowest_perf, cpu_num, ret); in cppc_cpufreq_stop_cpu()
249 static unsigned int cppc_cpufreq_get_transition_delay_us(int cpu) in cppc_cpufreq_get_transition_delay_us() argument
263 delay_us = cppc_get_transition_latency(cpu) / NSEC_PER_USEC; in cppc_cpufreq_get_transition_delay_us()
268 delay_us = cppc_get_transition_latency(cpu) / NSEC_PER_USEC; in cppc_cpufreq_get_transition_delay_us()
277 static unsigned int cppc_cpufreq_get_transition_delay_us(int cpu) in cppc_cpufreq_get_transition_delay_us() argument
279 return cppc_get_transition_latency(cpu) / NSEC_PER_USEC; in cppc_cpufreq_get_transition_delay_us()
285 struct cppc_cpudata *cpu; in cppc_cpufreq_cpu_init() local
286 unsigned int cpu_num = policy->cpu; in cppc_cpufreq_cpu_init()
289 cpu = all_cpu_data[policy->cpu]; in cppc_cpufreq_cpu_init()
291 cpu->cpu = cpu_num; in cppc_cpufreq_cpu_init()
292 ret = cppc_get_perf_caps(policy->cpu, &cpu->perf_caps); in cppc_cpufreq_cpu_init()
295 pr_debug("Err reading CPU%d perf capabilities. ret:%d\n", in cppc_cpufreq_cpu_init()
301 cpu->perf_caps.lowest_freq *= 1000; in cppc_cpufreq_cpu_init()
302 cpu->perf_caps.nominal_freq *= 1000; in cppc_cpufreq_cpu_init()
308 policy->min = cppc_cpufreq_perf_to_khz(cpu, cpu->perf_caps.lowest_nonlinear_perf); in cppc_cpufreq_cpu_init()
309 policy->max = cppc_cpufreq_perf_to_khz(cpu, cpu->perf_caps.highest_perf); in cppc_cpufreq_cpu_init()
316 policy->cpuinfo.min_freq = cppc_cpufreq_perf_to_khz(cpu, cpu->perf_caps.lowest_perf); in cppc_cpufreq_cpu_init()
317 policy->cpuinfo.max_freq = cppc_cpufreq_perf_to_khz(cpu, cpu->perf_caps.highest_perf); in cppc_cpufreq_cpu_init()
320 policy->shared_type = cpu->shared_type; in cppc_cpufreq_cpu_init()
325 cpumask_copy(policy->cpus, cpu->shared_cpu_map); in cppc_cpufreq_cpu_init()
328 if (unlikely(i == policy->cpu)) in cppc_cpufreq_cpu_init()
331 memcpy(&all_cpu_data[i]->perf_caps, &cpu->perf_caps, in cppc_cpufreq_cpu_init()
332 sizeof(cpu->perf_caps)); in cppc_cpufreq_cpu_init()
336 pr_debug("Unsupported CPU co-ord type\n"); in cppc_cpufreq_cpu_init()
340 cpu->cur_policy = policy; in cppc_cpufreq_cpu_init()
343 policy->cur = cppc_cpufreq_perf_to_khz(cpu, in cppc_cpufreq_cpu_init()
344 cpu->perf_caps.highest_perf); in cppc_cpufreq_cpu_init()
345 cpu->perf_ctrls.desired_perf = cpu->perf_caps.highest_perf; in cppc_cpufreq_cpu_init()
347 ret = cppc_set_perf(cpu_num, &cpu->perf_ctrls); in cppc_cpufreq_cpu_init()
349 pr_debug("Err setting perf value:%d on CPU:%d. ret:%d\n", in cppc_cpufreq_cpu_init()
350 cpu->perf_caps.highest_perf, cpu_num, ret); in cppc_cpufreq_cpu_init()
363 static int cppc_get_rate_from_fbctrs(struct cppc_cpudata *cpu, in cppc_get_rate_from_fbctrs() argument
382 delivered_perf = cpu->perf_ctrls.desired_perf; in cppc_get_rate_from_fbctrs()
384 return cppc_cpufreq_perf_to_khz(cpu, delivered_perf); in cppc_get_rate_from_fbctrs()
390 struct cppc_cpudata *cpu = all_cpu_data[cpunum]; in cppc_cpufreq_get_rate() local
406 return cppc_get_rate_from_fbctrs(cpu, fb_ctrs_t0, fb_ctrs_t1); in cppc_cpufreq_get_rate()
422 struct cppc_cpudata *cpu; in cppc_cpufreq_init() local
437 cpu = all_cpu_data[i]; in cppc_cpufreq_init()
438 if (!zalloc_cpumask_var(&cpu->shared_cpu_map, GFP_KERNEL)) in cppc_cpufreq_init()
458 cpu = all_cpu_data[i]; in cppc_cpufreq_init()
459 if (!cpu) in cppc_cpufreq_init()
461 free_cpumask_var(cpu->shared_cpu_map); in cppc_cpufreq_init()
462 kfree(cpu); in cppc_cpufreq_init()
471 struct cppc_cpudata *cpu; in cppc_cpufreq_exit() local
477 cpu = all_cpu_data[i]; in cppc_cpufreq_exit()
478 free_cpumask_var(cpu->shared_cpu_map); in cppc_cpufreq_exit()
479 kfree(cpu); in cppc_cpufreq_exit()