• Home
  • Raw
  • Download

Lines Matching +full:boost +full:- +full:low +full:- +full:freq

1 // SPDX-License-Identifier: GPL-2.0-only
66 if (dm->type == DMI_ENTRY_PROCESSOR && in cppc_find_dmi_mhz()
67 dm->length >= DMI_ENTRY_PROCESSOR_MIN_LENGTH) { in cppc_find_dmi_mhz()
92 * use them to convert perf to freq and vice versa
94 * If the perf/freq point lies between Nominal and Lowest, we can treat
95 * (Low perf, Low freq) and (Nom Perf, Nom freq) as 2D co-ordinates of a line
97 * For perf/freq > Nominal, we use the ratio perf:freq at Nominal for conversion
103 struct cppc_perf_caps *caps = &cpu->perf_caps; in cppc_cpufreq_perf_to_khz()
106 if (caps->lowest_freq && caps->nominal_freq) { in cppc_cpufreq_perf_to_khz()
107 if (perf >= caps->nominal_perf) { in cppc_cpufreq_perf_to_khz()
108 mul = caps->nominal_freq; in cppc_cpufreq_perf_to_khz()
109 div = caps->nominal_perf; in cppc_cpufreq_perf_to_khz()
111 mul = caps->nominal_freq - caps->lowest_freq; in cppc_cpufreq_perf_to_khz()
112 div = caps->nominal_perf - caps->lowest_perf; in cppc_cpufreq_perf_to_khz()
118 div = caps->highest_perf; in cppc_cpufreq_perf_to_khz()
124 unsigned int freq) in cppc_cpufreq_khz_to_perf() argument
127 struct cppc_perf_caps *caps = &cpu->perf_caps; in cppc_cpufreq_khz_to_perf()
130 if (caps->lowest_freq && caps->nominal_freq) { in cppc_cpufreq_khz_to_perf()
131 if (freq >= caps->nominal_freq) { in cppc_cpufreq_khz_to_perf()
132 mul = caps->nominal_perf; in cppc_cpufreq_khz_to_perf()
133 div = caps->nominal_freq; in cppc_cpufreq_khz_to_perf()
135 mul = caps->lowest_perf; in cppc_cpufreq_khz_to_perf()
136 div = caps->lowest_freq; in cppc_cpufreq_khz_to_perf()
141 mul = caps->highest_perf; in cppc_cpufreq_khz_to_perf()
145 return (u64)freq * mul / div; in cppc_cpufreq_khz_to_perf()
157 cpu = all_cpu_data[policy->cpu]; in cppc_cpufreq_set_target()
161 if (desired_perf == cpu->perf_ctrls.desired_perf) in cppc_cpufreq_set_target()
164 cpu->perf_ctrls.desired_perf = desired_perf; in cppc_cpufreq_set_target()
165 freqs.old = policy->cur; in cppc_cpufreq_set_target()
169 ret = cppc_set_perf(cpu->cpu, &cpu->perf_ctrls); in cppc_cpufreq_set_target()
174 cpu->cpu, ret); in cppc_cpufreq_set_target()
187 int cpu_num = policy->cpu; in cppc_cpufreq_stop_cpu()
191 cpu->perf_ctrls.desired_perf = cpu->perf_caps.lowest_perf; in cppc_cpufreq_stop_cpu()
193 ret = cppc_set_perf(cpu_num, &cpu->perf_ctrls); in cppc_cpufreq_stop_cpu()
196 cpu->perf_caps.lowest_perf, cpu_num, ret); in cppc_cpufreq_stop_cpu()
201 * on the shared PCC channel (including READs which do not count towards freq
245 unsigned int cpu_num = policy->cpu; in cppc_cpufreq_cpu_init()
248 cpu = all_cpu_data[policy->cpu]; in cppc_cpufreq_cpu_init()
250 cpu->cpu = cpu_num; in cppc_cpufreq_cpu_init()
251 ret = cppc_get_perf_caps(policy->cpu, &cpu->perf_caps); in cppc_cpufreq_cpu_init()
259 /* Convert the lowest and nominal freq from MHz to KHz */ in cppc_cpufreq_cpu_init()
260 cpu->perf_caps.lowest_freq *= 1000; in cppc_cpufreq_cpu_init()
261 cpu->perf_caps.nominal_freq *= 1000; in cppc_cpufreq_cpu_init()
267 policy->min = cppc_cpufreq_perf_to_khz(cpu, cpu->perf_caps.lowest_nonlinear_perf); in cppc_cpufreq_cpu_init()
268 policy->max = cppc_cpufreq_perf_to_khz(cpu, cpu->perf_caps.nominal_perf); in cppc_cpufreq_cpu_init()
275 policy->cpuinfo.min_freq = cppc_cpufreq_perf_to_khz(cpu, cpu->perf_caps.lowest_perf); in cppc_cpufreq_cpu_init()
276 policy->cpuinfo.max_freq = cppc_cpufreq_perf_to_khz(cpu, cpu->perf_caps.nominal_perf); in cppc_cpufreq_cpu_init()
278 policy->transition_delay_us = cppc_cpufreq_get_transition_delay_us(cpu_num); in cppc_cpufreq_cpu_init()
279 policy->shared_type = cpu->shared_type; in cppc_cpufreq_cpu_init()
281 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { in cppc_cpufreq_cpu_init()
284 cpumask_copy(policy->cpus, cpu->shared_cpu_map); in cppc_cpufreq_cpu_init()
286 for_each_cpu(i, policy->cpus) { in cppc_cpufreq_cpu_init()
287 if (unlikely(i == policy->cpu)) in cppc_cpufreq_cpu_init()
290 memcpy(&all_cpu_data[i]->perf_caps, &cpu->perf_caps, in cppc_cpufreq_cpu_init()
291 sizeof(cpu->perf_caps)); in cppc_cpufreq_cpu_init()
293 } else if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL) { in cppc_cpufreq_cpu_init()
295 pr_debug("Unsupported CPU co-ord type\n"); in cppc_cpufreq_cpu_init()
296 return -EFAULT; in cppc_cpufreq_cpu_init()
299 cpu->cur_policy = policy; in cppc_cpufreq_cpu_init()
302 * If 'highest_perf' is greater than 'nominal_perf', we assume CPU Boost in cppc_cpufreq_cpu_init()
305 if (cpu->perf_caps.highest_perf > cpu->perf_caps.nominal_perf) in cppc_cpufreq_cpu_init()
308 /* Set policy->cur to max now. The governors will adjust later. */ in cppc_cpufreq_cpu_init()
309 policy->cur = cppc_cpufreq_perf_to_khz(cpu, in cppc_cpufreq_cpu_init()
310 cpu->perf_caps.highest_perf); in cppc_cpufreq_cpu_init()
311 cpu->perf_ctrls.desired_perf = cpu->perf_caps.highest_perf; in cppc_cpufreq_cpu_init()
313 ret = cppc_set_perf(cpu_num, &cpu->perf_ctrls); in cppc_cpufreq_cpu_init()
316 cpu->perf_caps.highest_perf, cpu_num, ret); in cppc_cpufreq_cpu_init()
324 return t1 - t0; in get_delta()
326 return (u32)t1 - (u32)t0; in get_delta()
343 /* Check to avoid divide-by zero */ in cppc_get_rate_from_fbctrs()
348 delivered_perf = cpu->perf_ctrls.desired_perf; in cppc_get_rate_from_fbctrs()
378 pr_err("BOOST not supported by CPU or firmware\n"); in cppc_cpufreq_set_boost()
379 return -EINVAL; in cppc_cpufreq_set_boost()
382 cpudata = all_cpu_data[policy->cpu]; in cppc_cpufreq_set_boost()
384 policy->max = cppc_cpufreq_perf_to_khz(cpudata, in cppc_cpufreq_set_boost()
385 cpudata->perf_caps.highest_perf); in cppc_cpufreq_set_boost()
387 policy->max = cppc_cpufreq_perf_to_khz(cpudata, in cppc_cpufreq_set_boost()
388 cpudata->perf_caps.nominal_perf); in cppc_cpufreq_set_boost()
389 policy->cpuinfo.max_freq = policy->max; in cppc_cpufreq_set_boost()
391 ret = freq_qos_update_request(policy->max_freq_req, policy->max); in cppc_cpufreq_set_boost()
423 return -EIO; in hisi_cppc_cpufreq_get_rate()
439 if (!memcmp(wa_info[i].oem_id, tbl->oem_id, ACPI_OEM_ID_SIZE) && in cppc_check_hisi_workaround()
440 !memcmp(wa_info[i].oem_table_id, tbl->oem_table_id, ACPI_OEM_TABLE_ID_SIZE) && in cppc_check_hisi_workaround()
441 wa_info[i].oem_revision == tbl->oem_revision) { in cppc_check_hisi_workaround()
457 return -ENODEV; in cppc_cpufreq_init()
462 return -ENOMEM; in cppc_cpufreq_init()
470 if (!zalloc_cpumask_var(&cpu->shared_cpu_map, GFP_KERNEL)) in cppc_cpufreq_init()
493 free_cpumask_var(cpu->shared_cpu_map); in cppc_cpufreq_init()
498 return -ENODEV; in cppc_cpufreq_init()
510 free_cpumask_var(cpu->shared_cpu_map); in cppc_cpufreq_exit()