Lines Matching refs:cpu
230 int cpu; member
288 int (*get_max)(int cpu);
289 int (*get_max_physical)(int cpu);
290 int (*get_min)(int cpu);
291 int (*get_turbo)(int cpu);
293 int (*get_cpu_scaling)(int cpu);
362 static void intel_pstate_set_itmt_prio(int cpu) in intel_pstate_set_itmt_prio() argument
368 ret = cppc_get_perf_caps(cpu, &cppc_perf); in intel_pstate_set_itmt_prio()
377 cppc_perf.highest_perf = HWP_HIGHEST_PERF(READ_ONCE(all_cpu_data[cpu]->hwp_cap_cached)); in intel_pstate_set_itmt_prio()
384 sched_set_itmt_core_prio(cppc_perf.highest_perf, cpu); in intel_pstate_set_itmt_prio()
405 static int intel_pstate_get_cppc_guaranteed(int cpu) in intel_pstate_get_cppc_guaranteed() argument
410 ret = cppc_get_perf_caps(cpu, &cppc_perf); in intel_pstate_get_cppc_guaranteed()
420 static int intel_pstate_cppc_get_scaling(int cpu) in intel_pstate_cppc_get_scaling() argument
428 if (!cppc_get_perf_caps(cpu, &cppc_perf) && in intel_pstate_cppc_get_scaling()
437 static inline void intel_pstate_set_itmt_prio(int cpu) in intel_pstate_set_itmt_prio() argument
444 struct cpudata *cpu; in intel_pstate_init_acpi_perf_limits() local
449 intel_pstate_set_itmt_prio(policy->cpu); in intel_pstate_init_acpi_perf_limits()
456 cpu = all_cpu_data[policy->cpu]; in intel_pstate_init_acpi_perf_limits()
458 ret = acpi_processor_register_performance(&cpu->acpi_perf_data, in intel_pstate_init_acpi_perf_limits()
459 policy->cpu); in intel_pstate_init_acpi_perf_limits()
468 if (cpu->acpi_perf_data.control_register.space_id != in intel_pstate_init_acpi_perf_limits()
476 if (cpu->acpi_perf_data.state_count < 2) in intel_pstate_init_acpi_perf_limits()
479 pr_debug("CPU%u - ACPI _PSS perf data\n", policy->cpu); in intel_pstate_init_acpi_perf_limits()
480 for (i = 0; i < cpu->acpi_perf_data.state_count; i++) { in intel_pstate_init_acpi_perf_limits()
482 (i == cpu->acpi_perf_data.state ? '*' : ' '), i, in intel_pstate_init_acpi_perf_limits()
483 (u32) cpu->acpi_perf_data.states[i].core_frequency, in intel_pstate_init_acpi_perf_limits()
484 (u32) cpu->acpi_perf_data.states[i].power, in intel_pstate_init_acpi_perf_limits()
485 (u32) cpu->acpi_perf_data.states[i].control); in intel_pstate_init_acpi_perf_limits()
488 cpu->valid_pss_table = true; in intel_pstate_init_acpi_perf_limits()
494 cpu->valid_pss_table = false; in intel_pstate_init_acpi_perf_limits()
495 acpi_processor_unregister_performance(policy->cpu); in intel_pstate_init_acpi_perf_limits()
500 struct cpudata *cpu; in intel_pstate_exit_perf_limits() local
502 cpu = all_cpu_data[policy->cpu]; in intel_pstate_exit_perf_limits()
503 if (!cpu->valid_pss_table) in intel_pstate_exit_perf_limits()
506 acpi_processor_unregister_performance(policy->cpu); in intel_pstate_exit_perf_limits()
524 static inline int intel_pstate_get_cppc_guaranteed(int cpu) in intel_pstate_get_cppc_guaranteed() argument
529 static int intel_pstate_cppc_get_scaling(int cpu) in intel_pstate_cppc_get_scaling() argument
535 static int intel_pstate_freq_to_hwp_rel(struct cpudata *cpu, int freq, in intel_pstate_freq_to_hwp_rel() argument
538 if (freq == cpu->pstate.turbo_freq) in intel_pstate_freq_to_hwp_rel()
539 return cpu->pstate.turbo_pstate; in intel_pstate_freq_to_hwp_rel()
541 if (freq == cpu->pstate.max_freq) in intel_pstate_freq_to_hwp_rel()
542 return cpu->pstate.max_pstate; in intel_pstate_freq_to_hwp_rel()
546 return freq / cpu->pstate.scaling; in intel_pstate_freq_to_hwp_rel()
548 return DIV_ROUND_CLOSEST(freq, cpu->pstate.scaling); in intel_pstate_freq_to_hwp_rel()
551 return DIV_ROUND_UP(freq, cpu->pstate.scaling); in intel_pstate_freq_to_hwp_rel()
554 static int intel_pstate_freq_to_hwp(struct cpudata *cpu, int freq) in intel_pstate_freq_to_hwp() argument
556 return intel_pstate_freq_to_hwp_rel(cpu, freq, CPUFREQ_RELATION_L); in intel_pstate_freq_to_hwp()
570 static void intel_pstate_hybrid_hwp_adjust(struct cpudata *cpu) in intel_pstate_hybrid_hwp_adjust() argument
572 int perf_ctl_max_phys = cpu->pstate.max_pstate_physical; in intel_pstate_hybrid_hwp_adjust()
573 int perf_ctl_scaling = cpu->pstate.perf_ctl_scaling; in intel_pstate_hybrid_hwp_adjust()
574 int perf_ctl_turbo = pstate_funcs.get_turbo(cpu->cpu); in intel_pstate_hybrid_hwp_adjust()
575 int scaling = cpu->pstate.scaling; in intel_pstate_hybrid_hwp_adjust()
578 pr_debug("CPU%d: perf_ctl_max_phys = %d\n", cpu->cpu, perf_ctl_max_phys); in intel_pstate_hybrid_hwp_adjust()
579 pr_debug("CPU%d: perf_ctl_turbo = %d\n", cpu->cpu, perf_ctl_turbo); in intel_pstate_hybrid_hwp_adjust()
580 pr_debug("CPU%d: perf_ctl_scaling = %d\n", cpu->cpu, perf_ctl_scaling); in intel_pstate_hybrid_hwp_adjust()
581 pr_debug("CPU%d: HWP_CAP guaranteed = %d\n", cpu->cpu, cpu->pstate.max_pstate); in intel_pstate_hybrid_hwp_adjust()
582 pr_debug("CPU%d: HWP_CAP highest = %d\n", cpu->cpu, cpu->pstate.turbo_pstate); in intel_pstate_hybrid_hwp_adjust()
583 pr_debug("CPU%d: HWP-to-frequency scaling factor: %d\n", cpu->cpu, scaling); in intel_pstate_hybrid_hwp_adjust()
585 cpu->pstate.turbo_freq = rounddown(cpu->pstate.turbo_pstate * scaling, in intel_pstate_hybrid_hwp_adjust()
587 cpu->pstate.max_freq = rounddown(cpu->pstate.max_pstate * scaling, in intel_pstate_hybrid_hwp_adjust()
591 cpu->pstate.max_pstate_physical = intel_pstate_freq_to_hwp(cpu, freq); in intel_pstate_hybrid_hwp_adjust()
593 freq = cpu->pstate.min_pstate * perf_ctl_scaling; in intel_pstate_hybrid_hwp_adjust()
594 cpu->pstate.min_freq = freq; in intel_pstate_hybrid_hwp_adjust()
599 cpu->pstate.min_pstate = intel_pstate_freq_to_hwp(cpu, freq); in intel_pstate_hybrid_hwp_adjust()
616 struct cpudata *cpu = all_cpu_data[0]; in min_perf_pct_min() local
617 int turbo_pstate = cpu->pstate.turbo_pstate; in min_perf_pct_min()
620 (cpu->pstate.min_pstate * 100 / turbo_pstate) : 0; in min_perf_pct_min()
633 epp = rdmsrq_on_cpu(cpu_data->cpu, MSR_HWP_REQUEST, in intel_pstate_get_epp()
718 static int intel_pstate_set_epp(struct cpudata *cpu, u32 epp) in intel_pstate_set_epp() argument
727 u64 value = READ_ONCE(cpu->hwp_req_cached); in intel_pstate_set_epp()
736 WRITE_ONCE(cpu->hwp_req_cached, value); in intel_pstate_set_epp()
737 ret = wrmsrq_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); in intel_pstate_set_epp()
739 cpu->epp_cached = epp; in intel_pstate_set_epp()
795 struct cpudata *cpu = all_cpu_data[policy->cpu]; in store_energy_performance_preference() local
831 ret = intel_pstate_set_energy_pref_index(cpu, ret, raw, epp); in store_energy_performance_preference()
840 epp = ret ? epp_values[ret] : cpu->epp_default; in store_energy_performance_preference()
842 if (cpu->epp_cached != epp) { in store_energy_performance_preference()
846 ret = intel_pstate_set_epp(cpu, epp); in store_energy_performance_preference()
863 struct cpudata *cpu_data = all_cpu_data[policy->cpu]; in show_energy_performance_preference()
880 struct cpudata *cpu = all_cpu_data[policy->cpu]; in show_base_frequency() local
883 ratio = intel_pstate_get_cppc_guaranteed(policy->cpu); in show_base_frequency()
887 rdmsrq_on_cpu(policy->cpu, MSR_HWP_CAPABILITIES, &cap); in show_base_frequency()
891 freq = ratio * cpu->pstate.scaling; in show_base_frequency()
892 if (cpu->pstate.scaling != cpu->pstate.perf_ctl_scaling) in show_base_frequency()
893 freq = rounddown(freq, cpu->pstate.perf_ctl_scaling); in show_base_frequency()
986 static bool hybrid_register_perf_domain(unsigned int cpu) in hybrid_register_perf_domain() argument
990 struct cpudata *cpudata = all_cpu_data[cpu]; in hybrid_register_perf_domain()
1001 cpu_dev = get_cpu_device(cpu); in hybrid_register_perf_domain()
1006 cpumask_of(cpu), false)) in hybrid_register_perf_domain()
1016 unsigned int cpu; in hybrid_register_all_perf_domains() local
1018 for_each_online_cpu(cpu) in hybrid_register_all_perf_domains()
1019 hybrid_register_perf_domain(cpu); in hybrid_register_all_perf_domains()
1022 static void hybrid_update_perf_domain(struct cpudata *cpu) in hybrid_update_perf_domain() argument
1024 if (cpu->pd_registered) in hybrid_update_perf_domain()
1025 em_adjust_cpu_capacity(cpu->cpu); in hybrid_update_perf_domain()
1028 static inline bool hybrid_register_perf_domain(unsigned int cpu) { return false; } in hybrid_register_perf_domain() argument
1030 static inline void hybrid_update_perf_domain(struct cpudata *cpu) {} in hybrid_update_perf_domain() argument
1033 static void hybrid_set_cpu_capacity(struct cpudata *cpu) in hybrid_set_cpu_capacity() argument
1035 arch_set_cpu_capacity(cpu->cpu, cpu->capacity_perf, in hybrid_set_cpu_capacity()
1037 cpu->capacity_perf, in hybrid_set_cpu_capacity()
1038 cpu->pstate.max_pstate_physical); in hybrid_set_cpu_capacity()
1039 hybrid_update_perf_domain(cpu); in hybrid_set_cpu_capacity()
1041 topology_set_cpu_scale(cpu->cpu, arch_scale_cpu_capacity(cpu->cpu)); in hybrid_set_cpu_capacity()
1043 pr_debug("CPU%d: perf = %u, max. perf = %u, base perf = %d\n", cpu->cpu, in hybrid_set_cpu_capacity()
1044 cpu->capacity_perf, hybrid_max_perf_cpu->capacity_perf, in hybrid_set_cpu_capacity()
1045 cpu->pstate.max_pstate_physical); in hybrid_set_cpu_capacity()
1053 static void hybrid_get_capacity_perf(struct cpudata *cpu) in hybrid_get_capacity_perf() argument
1056 cpu->capacity_perf = cpu->pstate.max_pstate_physical; in hybrid_get_capacity_perf()
1060 cpu->capacity_perf = HWP_HIGHEST_PERF(READ_ONCE(cpu->hwp_cap_cached)); in hybrid_get_capacity_perf()
1068 struct cpudata *cpu = all_cpu_data[cpunum]; in hybrid_set_capacity_of_cpus() local
1070 if (cpu) in hybrid_set_capacity_of_cpus()
1071 hybrid_set_cpu_capacity(cpu); in hybrid_set_capacity_of_cpus()
1082 struct cpudata *cpu = all_cpu_data[cpunum]; in hybrid_update_cpu_capacity_scaling() local
1084 if (!cpu) in hybrid_update_cpu_capacity_scaling()
1092 hybrid_get_capacity_perf(cpu); in hybrid_update_cpu_capacity_scaling()
1099 if (cpu == hybrid_max_perf_cpu) in hybrid_update_cpu_capacity_scaling()
1102 if (cpu->capacity_perf > max_cap_perf) { in hybrid_update_cpu_capacity_scaling()
1103 max_cap_perf = cpu->capacity_perf; in hybrid_update_cpu_capacity_scaling()
1104 max_perf_cpu = cpu; in hybrid_update_cpu_capacity_scaling()
1180 static void __intel_pstate_get_hwp_cap(struct cpudata *cpu) in __intel_pstate_get_hwp_cap() argument
1184 rdmsrq_on_cpu(cpu->cpu, MSR_HWP_CAPABILITIES, &cap); in __intel_pstate_get_hwp_cap()
1185 WRITE_ONCE(cpu->hwp_cap_cached, cap); in __intel_pstate_get_hwp_cap()
1186 cpu->pstate.max_pstate = HWP_GUARANTEED_PERF(cap); in __intel_pstate_get_hwp_cap()
1187 cpu->pstate.turbo_pstate = HWP_HIGHEST_PERF(cap); in __intel_pstate_get_hwp_cap()
1190 static void intel_pstate_get_hwp_cap(struct cpudata *cpu) in intel_pstate_get_hwp_cap() argument
1192 int scaling = cpu->pstate.scaling; in intel_pstate_get_hwp_cap()
1194 __intel_pstate_get_hwp_cap(cpu); in intel_pstate_get_hwp_cap()
1196 cpu->pstate.max_freq = cpu->pstate.max_pstate * scaling; in intel_pstate_get_hwp_cap()
1197 cpu->pstate.turbo_freq = cpu->pstate.turbo_pstate * scaling; in intel_pstate_get_hwp_cap()
1198 if (scaling != cpu->pstate.perf_ctl_scaling) { in intel_pstate_get_hwp_cap()
1199 int perf_ctl_scaling = cpu->pstate.perf_ctl_scaling; in intel_pstate_get_hwp_cap()
1201 cpu->pstate.max_freq = rounddown(cpu->pstate.max_freq, in intel_pstate_get_hwp_cap()
1203 cpu->pstate.turbo_freq = rounddown(cpu->pstate.turbo_freq, in intel_pstate_get_hwp_cap()
1208 static void hybrid_update_capacity(struct cpudata *cpu) in hybrid_update_capacity() argument
1223 intel_pstate_get_hwp_cap(cpu); in hybrid_update_capacity()
1225 hybrid_get_capacity_perf(cpu); in hybrid_update_capacity()
1227 if (cpu->capacity_perf > max_cap_perf) { in hybrid_update_capacity()
1228 hybrid_max_perf_cpu = cpu; in hybrid_update_capacity()
1234 if (cpu == hybrid_max_perf_cpu && cpu->capacity_perf < max_cap_perf) { in hybrid_update_capacity()
1239 hybrid_set_cpu_capacity(cpu); in hybrid_update_capacity()
1246 if (hybrid_register_perf_domain(cpu->cpu)) in hybrid_update_capacity()
1253 static void intel_pstate_hwp_set(unsigned int cpu) in intel_pstate_hwp_set() argument
1255 struct cpudata *cpu_data = all_cpu_data[cpu]; in intel_pstate_hwp_set()
1266 rdmsrq_on_cpu(cpu, MSR_HWP_REQUEST, &value); in intel_pstate_hwp_set()
1312 wrmsrq_on_cpu(cpu, MSR_HWP_REQUEST, value); in intel_pstate_hwp_set()
1317 static void intel_pstate_hwp_offline(struct cpudata *cpu) in intel_pstate_hwp_offline() argument
1319 u64 value = READ_ONCE(cpu->hwp_req_cached); in intel_pstate_hwp_offline()
1322 intel_pstate_disable_hwp_interrupt(cpu); in intel_pstate_hwp_offline()
1331 value |= HWP_ENERGY_PERF_PREFERENCE(cpu->epp_cached); in intel_pstate_hwp_offline()
1337 cpu->epp_policy = CPUFREQ_POLICY_UNKNOWN; in intel_pstate_hwp_offline()
1346 WRITE_ONCE(cpu->hwp_req_cached, value); in intel_pstate_hwp_offline()
1349 min_perf = HWP_LOWEST_PERF(READ_ONCE(cpu->hwp_cap_cached)); in intel_pstate_hwp_offline()
1359 wrmsrq_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); in intel_pstate_hwp_offline()
1369 if (hybrid_max_perf_cpu == cpu) in intel_pstate_hwp_offline()
1375 hybrid_clear_cpu_capacity(cpu->cpu); in intel_pstate_hwp_offline()
1405 static void intel_pstate_hwp_reenable(struct cpudata *cpu) in intel_pstate_hwp_reenable() argument
1407 intel_pstate_hwp_enable(cpu); in intel_pstate_hwp_reenable()
1408 wrmsrq_on_cpu(cpu->cpu, MSR_HWP_REQUEST, READ_ONCE(cpu->hwp_req_cached)); in intel_pstate_hwp_reenable()
1413 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_pstate_suspend() local
1415 pr_debug("CPU %d suspending\n", cpu->cpu); in intel_pstate_suspend()
1417 cpu->suspended = true; in intel_pstate_suspend()
1420 intel_pstate_disable_hwp_interrupt(cpu); in intel_pstate_suspend()
1427 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_pstate_resume() local
1429 pr_debug("CPU %d resuming\n", cpu->cpu); in intel_pstate_resume()
1437 if (cpu->suspended && hwp_active) { in intel_pstate_resume()
1441 intel_pstate_hwp_reenable(cpu); in intel_pstate_resume()
1446 cpu->suspended = false; in intel_pstate_resume()
1453 int cpu; in intel_pstate_update_policies() local
1455 for_each_possible_cpu(cpu) in intel_pstate_update_policies()
1456 cpufreq_update_policy(cpu); in intel_pstate_update_policies()
1475 struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpudata->cpu); in intel_pstate_update_max_freq()
1486 struct cpudata *cpudata = all_cpu_data[policy->cpu]; in intel_pstate_update_limits()
1495 int cpu; in intel_pstate_update_limits_for_all() local
1497 for_each_possible_cpu(cpu) in intel_pstate_update_limits_for_all()
1498 intel_pstate_update_max_freq(all_cpu_data[cpu]); in intel_pstate_update_limits_for_all()
1547 struct cpudata *cpu; in show_turbo_pct() local
1558 cpu = all_cpu_data[0]; in show_turbo_pct()
1560 total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1; in show_turbo_pct()
1561 no_turbo = cpu->pstate.max_pstate - cpu->pstate.min_pstate + 1; in show_turbo_pct()
1573 struct cpudata *cpu; in show_num_pstates() local
1583 cpu = all_cpu_data[0]; in show_num_pstates()
1584 total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1; in show_num_pstates()
1647 struct cpudata *cpu = all_cpu_data[0]; in store_no_turbo() local
1648 int pct = cpu->pstate.max_pstate * 100 / cpu->pstate.turbo_pstate; in store_no_turbo()
1666 static void update_cpu_qos_request(int cpu, enum freq_qos_req_type type) in update_cpu_qos_request() argument
1668 struct cpudata *cpudata = all_cpu_data[cpu]; in update_cpu_qos_request()
1672 struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpu); in update_cpu_qos_request()
1691 pr_warn("Failed to update freq constraint: CPU%d\n", cpu); in update_cpu_qos_request()
1947 wrmsrq_on_cpu(cpudata->cpu, MSR_HWP_STATUS, 0); in intel_pstate_notify_work()
1998 wrmsrq_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, 0x00); in intel_pstate_disable_hwp_interrupt()
2001 cancel_work = cpumask_test_and_clear_cpu(cpudata->cpu, &hwp_intr_enable_mask); in intel_pstate_disable_hwp_interrupt()
2019 cpumask_set_cpu(cpudata->cpu, &hwp_intr_enable_mask); in intel_pstate_enable_hwp_interrupt()
2026 wrmsrq_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, interrupt_mask); in intel_pstate_enable_hwp_interrupt()
2027 wrmsrq_on_cpu(cpudata->cpu, MSR_HWP_STATUS, 0); in intel_pstate_enable_hwp_interrupt()
2066 wrmsrq_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, 0x00); in intel_pstate_hwp_enable()
2068 wrmsrq_on_cpu(cpudata->cpu, MSR_PM_ENABLE, 0x1); in intel_pstate_hwp_enable()
2172 static int core_get_min_pstate(int cpu) in core_get_min_pstate() argument
2176 rdmsrq_on_cpu(cpu, MSR_PLATFORM_INFO, &value); in core_get_min_pstate()
2180 static int core_get_max_pstate_physical(int cpu) in core_get_max_pstate_physical() argument
2184 rdmsrq_on_cpu(cpu, MSR_PLATFORM_INFO, &value); in core_get_max_pstate_physical()
2188 static int core_get_tdp_ratio(int cpu, u64 plat_info) in core_get_tdp_ratio() argument
2198 err = rdmsrq_safe_on_cpu(cpu, MSR_CONFIG_TDP_CONTROL, &tdp_ctrl); in core_get_tdp_ratio()
2204 err = rdmsrq_safe_on_cpu(cpu, tdp_msr, &tdp_ratio); in core_get_tdp_ratio()
2221 static int core_get_max_pstate(int cpu) in core_get_max_pstate() argument
2229 rdmsrq_on_cpu(cpu, MSR_PLATFORM_INFO, &plat_info); in core_get_max_pstate()
2232 tdp_ratio = core_get_tdp_ratio(cpu, plat_info); in core_get_max_pstate()
2241 err = rdmsrq_safe_on_cpu(cpu, MSR_TURBO_ACTIVATION_RATIO, &tar); in core_get_max_pstate()
2256 static int core_get_turbo_pstate(int cpu) in core_get_turbo_pstate() argument
2261 rdmsrq_on_cpu(cpu, MSR_TURBO_RATIO_LIMIT, &value); in core_get_turbo_pstate()
2262 nont = core_get_max_pstate(cpu); in core_get_turbo_pstate()
2285 static int knl_get_turbo_pstate(int cpu) in knl_get_turbo_pstate() argument
2290 rdmsrq_on_cpu(cpu, MSR_TURBO_RATIO_LIMIT, &value); in knl_get_turbo_pstate()
2291 nont = core_get_max_pstate(cpu); in knl_get_turbo_pstate()
2298 static int hwp_get_cpu_scaling(int cpu) in hwp_get_cpu_scaling() argument
2301 struct cpuinfo_x86 *c = &cpu_data(cpu); in hwp_get_cpu_scaling()
2324 return intel_pstate_cppc_get_scaling(cpu); in hwp_get_cpu_scaling()
2327 static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate) in intel_pstate_set_pstate() argument
2329 trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu); in intel_pstate_set_pstate()
2330 cpu->pstate.current_pstate = pstate; in intel_pstate_set_pstate()
2336 wrmsrq_on_cpu(cpu->cpu, MSR_IA32_PERF_CTL, in intel_pstate_set_pstate()
2337 pstate_funcs.get_val(cpu, pstate)); in intel_pstate_set_pstate()
2340 static void intel_pstate_set_min_pstate(struct cpudata *cpu) in intel_pstate_set_min_pstate() argument
2342 intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate); in intel_pstate_set_min_pstate()
2345 static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) in intel_pstate_get_cpu_pstates() argument
2347 int perf_ctl_max_phys = pstate_funcs.get_max_physical(cpu->cpu); in intel_pstate_get_cpu_pstates()
2350 cpu->pstate.min_pstate = pstate_funcs.get_min(cpu->cpu); in intel_pstate_get_cpu_pstates()
2351 cpu->pstate.max_pstate_physical = perf_ctl_max_phys; in intel_pstate_get_cpu_pstates()
2352 cpu->pstate.perf_ctl_scaling = perf_ctl_scaling; in intel_pstate_get_cpu_pstates()
2355 __intel_pstate_get_hwp_cap(cpu); in intel_pstate_get_cpu_pstates()
2358 cpu->pstate.scaling = pstate_funcs.get_cpu_scaling(cpu->cpu); in intel_pstate_get_cpu_pstates()
2359 if (cpu->pstate.scaling != perf_ctl_scaling) { in intel_pstate_get_cpu_pstates()
2360 intel_pstate_hybrid_hwp_adjust(cpu); in intel_pstate_get_cpu_pstates()
2364 cpu->pstate.scaling = perf_ctl_scaling; in intel_pstate_get_cpu_pstates()
2370 hybrid_update_capacity(cpu); in intel_pstate_get_cpu_pstates()
2372 cpu->pstate.scaling = perf_ctl_scaling; in intel_pstate_get_cpu_pstates()
2373 cpu->pstate.max_pstate = pstate_funcs.get_max(cpu->cpu); in intel_pstate_get_cpu_pstates()
2374 cpu->pstate.turbo_pstate = pstate_funcs.get_turbo(cpu->cpu); in intel_pstate_get_cpu_pstates()
2377 if (cpu->pstate.scaling == perf_ctl_scaling) { in intel_pstate_get_cpu_pstates()
2378 cpu->pstate.min_freq = cpu->pstate.min_pstate * perf_ctl_scaling; in intel_pstate_get_cpu_pstates()
2379 cpu->pstate.max_freq = cpu->pstate.max_pstate * perf_ctl_scaling; in intel_pstate_get_cpu_pstates()
2380 cpu->pstate.turbo_freq = cpu->pstate.turbo_pstate * perf_ctl_scaling; in intel_pstate_get_cpu_pstates()
2384 cpu->aperf_mperf_shift = pstate_funcs.get_aperf_mperf_shift(); in intel_pstate_get_cpu_pstates()
2387 pstate_funcs.get_vid(cpu); in intel_pstate_get_cpu_pstates()
2389 intel_pstate_set_min_pstate(cpu); in intel_pstate_get_cpu_pstates()
2400 static inline void intel_pstate_hwp_boost_up(struct cpudata *cpu) in intel_pstate_hwp_boost_up() argument
2402 u64 hwp_req = READ_ONCE(cpu->hwp_req_cached); in intel_pstate_hwp_boost_up()
2403 u64 hwp_cap = READ_ONCE(cpu->hwp_cap_cached); in intel_pstate_hwp_boost_up()
2423 if (max_limit == min_limit || cpu->hwp_boost_min >= max_limit) in intel_pstate_hwp_boost_up()
2426 if (!cpu->hwp_boost_min) in intel_pstate_hwp_boost_up()
2427 cpu->hwp_boost_min = min_limit; in intel_pstate_hwp_boost_up()
2432 if (cpu->hwp_boost_min < boost_level1) in intel_pstate_hwp_boost_up()
2433 cpu->hwp_boost_min = boost_level1; in intel_pstate_hwp_boost_up()
2434 else if (cpu->hwp_boost_min < HWP_GUARANTEED_PERF(hwp_cap)) in intel_pstate_hwp_boost_up()
2435 cpu->hwp_boost_min = HWP_GUARANTEED_PERF(hwp_cap); in intel_pstate_hwp_boost_up()
2436 else if (cpu->hwp_boost_min == HWP_GUARANTEED_PERF(hwp_cap) && in intel_pstate_hwp_boost_up()
2438 cpu->hwp_boost_min = max_limit; in intel_pstate_hwp_boost_up()
2442 hwp_req = (hwp_req & ~GENMASK_ULL(7, 0)) | cpu->hwp_boost_min; in intel_pstate_hwp_boost_up()
2444 cpu->last_update = cpu->sample.time; in intel_pstate_hwp_boost_up()
2447 static inline void intel_pstate_hwp_boost_down(struct cpudata *cpu) in intel_pstate_hwp_boost_down() argument
2449 if (cpu->hwp_boost_min) { in intel_pstate_hwp_boost_down()
2453 expired = time_after64(cpu->sample.time, cpu->last_update + in intel_pstate_hwp_boost_down()
2456 wrmsrq(MSR_HWP_REQUEST, cpu->hwp_req_cached); in intel_pstate_hwp_boost_down()
2457 cpu->hwp_boost_min = 0; in intel_pstate_hwp_boost_down()
2460 cpu->last_update = cpu->sample.time; in intel_pstate_hwp_boost_down()
2463 static inline void intel_pstate_update_util_hwp_local(struct cpudata *cpu, in intel_pstate_update_util_hwp_local() argument
2466 cpu->sample.time = time; in intel_pstate_update_util_hwp_local()
2468 if (cpu->sched_flags & SCHED_CPUFREQ_IOWAIT) { in intel_pstate_update_util_hwp_local()
2471 cpu->sched_flags = 0; in intel_pstate_update_util_hwp_local()
2479 if (time_before64(time, cpu->last_io_update + 2 * TICK_NSEC)) in intel_pstate_update_util_hwp_local()
2482 cpu->last_io_update = time; in intel_pstate_update_util_hwp_local()
2485 intel_pstate_hwp_boost_up(cpu); in intel_pstate_update_util_hwp_local()
2488 intel_pstate_hwp_boost_down(cpu); in intel_pstate_update_util_hwp_local()
2495 struct cpudata *cpu = container_of(data, struct cpudata, update_util); in intel_pstate_update_util_hwp() local
2497 cpu->sched_flags |= flags; in intel_pstate_update_util_hwp()
2499 if (smp_processor_id() == cpu->cpu) in intel_pstate_update_util_hwp()
2500 intel_pstate_update_util_hwp_local(cpu, time); in intel_pstate_update_util_hwp()
2503 static inline void intel_pstate_calc_avg_perf(struct cpudata *cpu) in intel_pstate_calc_avg_perf() argument
2505 struct sample *sample = &cpu->sample; in intel_pstate_calc_avg_perf()
2510 static inline bool intel_pstate_sample(struct cpudata *cpu, u64 time) in intel_pstate_sample() argument
2520 if (cpu->prev_mperf == mperf || cpu->prev_tsc == tsc) { in intel_pstate_sample()
2526 cpu->last_sample_time = cpu->sample.time; in intel_pstate_sample()
2527 cpu->sample.time = time; in intel_pstate_sample()
2528 cpu->sample.aperf = aperf; in intel_pstate_sample()
2529 cpu->sample.mperf = mperf; in intel_pstate_sample()
2530 cpu->sample.tsc = tsc; in intel_pstate_sample()
2531 cpu->sample.aperf -= cpu->prev_aperf; in intel_pstate_sample()
2532 cpu->sample.mperf -= cpu->prev_mperf; in intel_pstate_sample()
2533 cpu->sample.tsc -= cpu->prev_tsc; in intel_pstate_sample()
2535 cpu->prev_aperf = aperf; in intel_pstate_sample()
2536 cpu->prev_mperf = mperf; in intel_pstate_sample()
2537 cpu->prev_tsc = tsc; in intel_pstate_sample()
2545 if (likely(cpu->last_sample_time)) { in intel_pstate_sample()
2546 intel_pstate_calc_avg_perf(cpu); in intel_pstate_sample()
2552 static inline int32_t get_avg_frequency(struct cpudata *cpu) in get_avg_frequency() argument
2554 return mul_ext_fp(cpu->sample.core_avg_perf, cpu_khz); in get_avg_frequency()
2557 static inline int32_t get_avg_pstate(struct cpudata *cpu) in get_avg_pstate() argument
2559 return mul_ext_fp(cpu->pstate.max_pstate_physical, in get_avg_pstate()
2560 cpu->sample.core_avg_perf); in get_avg_pstate()
2563 static inline int32_t get_target_pstate(struct cpudata *cpu) in get_target_pstate() argument
2565 struct sample *sample = &cpu->sample; in get_target_pstate()
2569 busy_frac = div_fp(sample->mperf << cpu->aperf_mperf_shift, in get_target_pstate()
2572 if (busy_frac < cpu->iowait_boost) in get_target_pstate()
2573 busy_frac = cpu->iowait_boost; in get_target_pstate()
2578 cpu->pstate.max_pstate : cpu->pstate.turbo_pstate; in get_target_pstate()
2581 if (target < cpu->pstate.min_pstate) in get_target_pstate()
2582 target = cpu->pstate.min_pstate; in get_target_pstate()
2591 avg_pstate = get_avg_pstate(cpu); in get_target_pstate()
2598 static int intel_pstate_prepare_request(struct cpudata *cpu, int pstate) in intel_pstate_prepare_request() argument
2600 int min_pstate = max(cpu->pstate.min_pstate, cpu->min_perf_ratio); in intel_pstate_prepare_request()
2601 int max_pstate = max(min_pstate, cpu->max_perf_ratio); in intel_pstate_prepare_request()
2606 static void intel_pstate_update_pstate(struct cpudata *cpu, int pstate) in intel_pstate_update_pstate() argument
2608 if (pstate == cpu->pstate.current_pstate) in intel_pstate_update_pstate()
2611 cpu->pstate.current_pstate = pstate; in intel_pstate_update_pstate()
2612 wrmsrq(MSR_IA32_PERF_CTL, pstate_funcs.get_val(cpu, pstate)); in intel_pstate_update_pstate()
2615 static void intel_pstate_adjust_pstate(struct cpudata *cpu) in intel_pstate_adjust_pstate() argument
2617 int from = cpu->pstate.current_pstate; in intel_pstate_adjust_pstate()
2621 target_pstate = get_target_pstate(cpu); in intel_pstate_adjust_pstate()
2622 target_pstate = intel_pstate_prepare_request(cpu, target_pstate); in intel_pstate_adjust_pstate()
2623 trace_cpu_frequency(target_pstate * cpu->pstate.scaling, cpu->cpu); in intel_pstate_adjust_pstate()
2624 intel_pstate_update_pstate(cpu, target_pstate); in intel_pstate_adjust_pstate()
2626 sample = &cpu->sample; in intel_pstate_adjust_pstate()
2630 cpu->pstate.current_pstate, in intel_pstate_adjust_pstate()
2634 get_avg_frequency(cpu), in intel_pstate_adjust_pstate()
2635 fp_toint(cpu->iowait_boost * 100)); in intel_pstate_adjust_pstate()
2641 struct cpudata *cpu = container_of(data, struct cpudata, update_util); in intel_pstate_update_util() local
2645 if (smp_processor_id() != cpu->cpu) in intel_pstate_update_util()
2648 delta_ns = time - cpu->last_update; in intel_pstate_update_util()
2652 cpu->iowait_boost = ONE_EIGHTH_FP; in intel_pstate_update_util()
2653 } else if (cpu->iowait_boost >= ONE_EIGHTH_FP) { in intel_pstate_update_util()
2654 cpu->iowait_boost <<= 1; in intel_pstate_update_util()
2655 if (cpu->iowait_boost > int_tofp(1)) in intel_pstate_update_util()
2656 cpu->iowait_boost = int_tofp(1); in intel_pstate_update_util()
2658 cpu->iowait_boost = ONE_EIGHTH_FP; in intel_pstate_update_util()
2660 } else if (cpu->iowait_boost) { in intel_pstate_update_util()
2663 cpu->iowait_boost = 0; in intel_pstate_update_util()
2665 cpu->iowait_boost >>= 1; in intel_pstate_update_util()
2667 cpu->last_update = time; in intel_pstate_update_util()
2668 delta_ns = time - cpu->sample.time; in intel_pstate_update_util()
2672 if (intel_pstate_sample(cpu, time)) in intel_pstate_update_util()
2673 intel_pstate_adjust_pstate(cpu); in intel_pstate_update_util()
2775 struct cpudata *cpu; in intel_pstate_init_cpu() local
2777 cpu = all_cpu_data[cpunum]; in intel_pstate_init_cpu()
2779 if (!cpu) { in intel_pstate_init_cpu()
2780 cpu = kzalloc(sizeof(*cpu), GFP_KERNEL); in intel_pstate_init_cpu()
2781 if (!cpu) in intel_pstate_init_cpu()
2784 WRITE_ONCE(all_cpu_data[cpunum], cpu); in intel_pstate_init_cpu()
2786 cpu->cpu = cpunum; in intel_pstate_init_cpu()
2788 cpu->epp_default = -EINVAL; in intel_pstate_init_cpu()
2791 intel_pstate_hwp_enable(cpu); in intel_pstate_init_cpu()
2802 intel_pstate_hwp_reenable(cpu); in intel_pstate_init_cpu()
2805 cpu->epp_powersave = -EINVAL; in intel_pstate_init_cpu()
2806 cpu->epp_policy = CPUFREQ_POLICY_UNKNOWN; in intel_pstate_init_cpu()
2808 intel_pstate_get_cpu_pstates(cpu); in intel_pstate_init_cpu()
2817 struct cpudata *cpu = all_cpu_data[cpu_num]; in intel_pstate_set_update_util_hook() local
2822 if (cpu->update_util_set) in intel_pstate_set_update_util_hook()
2826 cpu->sample.time = 0; in intel_pstate_set_update_util_hook()
2827 cpufreq_add_update_util_hook(cpu_num, &cpu->update_util, in intel_pstate_set_update_util_hook()
2831 cpu->update_util_set = true; in intel_pstate_set_update_util_hook()
2834 static void intel_pstate_clear_update_util_hook(unsigned int cpu) in intel_pstate_clear_update_util_hook() argument
2836 struct cpudata *cpu_data = all_cpu_data[cpu]; in intel_pstate_clear_update_util_hook()
2841 cpufreq_remove_update_util_hook(cpu); in intel_pstate_clear_update_util_hook()
2846 static int intel_pstate_get_max_freq(struct cpudata *cpu) in intel_pstate_get_max_freq() argument
2849 cpu->pstate.max_freq : cpu->pstate.turbo_freq; in intel_pstate_get_max_freq()
2852 static void intel_pstate_update_perf_limits(struct cpudata *cpu, in intel_pstate_update_perf_limits() argument
2856 int perf_ctl_scaling = cpu->pstate.perf_ctl_scaling; in intel_pstate_update_perf_limits()
2872 if (hwp_active && cpu->pstate.scaling != perf_ctl_scaling) { in intel_pstate_update_perf_limits()
2876 max_policy_perf = intel_pstate_freq_to_hwp(cpu, freq); in intel_pstate_update_perf_limits()
2878 min_policy_perf = intel_pstate_freq_to_hwp(cpu, freq); in intel_pstate_update_perf_limits()
2882 cpu->cpu, min_policy_perf, max_policy_perf); in intel_pstate_update_perf_limits()
2886 cpu->min_perf_ratio = min_policy_perf; in intel_pstate_update_perf_limits()
2887 cpu->max_perf_ratio = max_policy_perf; in intel_pstate_update_perf_limits()
2889 int turbo_max = cpu->pstate.turbo_pstate; in intel_pstate_update_perf_limits()
2897 pr_debug("cpu:%d global_min:%d global_max:%d\n", cpu->cpu, in intel_pstate_update_perf_limits()
2900 cpu->min_perf_ratio = max(min_policy_perf, global_min); in intel_pstate_update_perf_limits()
2901 cpu->min_perf_ratio = min(cpu->min_perf_ratio, max_policy_perf); in intel_pstate_update_perf_limits()
2902 cpu->max_perf_ratio = min(max_policy_perf, global_max); in intel_pstate_update_perf_limits()
2903 cpu->max_perf_ratio = max(min_policy_perf, cpu->max_perf_ratio); in intel_pstate_update_perf_limits()
2906 cpu->min_perf_ratio = min(cpu->min_perf_ratio, in intel_pstate_update_perf_limits()
2907 cpu->max_perf_ratio); in intel_pstate_update_perf_limits()
2910 pr_debug("cpu:%d max_perf_ratio:%d min_perf_ratio:%d\n", cpu->cpu, in intel_pstate_update_perf_limits()
2911 cpu->max_perf_ratio, in intel_pstate_update_perf_limits()
2912 cpu->min_perf_ratio); in intel_pstate_update_perf_limits()
2917 struct cpudata *cpu; in intel_pstate_set_policy() local
2925 cpu = all_cpu_data[policy->cpu]; in intel_pstate_set_policy()
2926 cpu->policy = policy->policy; in intel_pstate_set_policy()
2930 intel_pstate_update_perf_limits(cpu, policy->min, policy->max); in intel_pstate_set_policy()
2932 if (cpu->policy == CPUFREQ_POLICY_PERFORMANCE) { in intel_pstate_set_policy()
2933 int pstate = max(cpu->pstate.min_pstate, cpu->max_perf_ratio); in intel_pstate_set_policy()
2939 intel_pstate_clear_update_util_hook(policy->cpu); in intel_pstate_set_policy()
2940 intel_pstate_set_pstate(cpu, pstate); in intel_pstate_set_policy()
2942 intel_pstate_set_update_util_hook(policy->cpu); in intel_pstate_set_policy()
2952 intel_pstate_clear_update_util_hook(policy->cpu); in intel_pstate_set_policy()
2953 intel_pstate_hwp_set(policy->cpu); in intel_pstate_set_policy()
2966 static void intel_pstate_adjust_policy_max(struct cpudata *cpu, in intel_pstate_adjust_policy_max() argument
2970 cpu->pstate.max_pstate_physical > cpu->pstate.max_pstate && in intel_pstate_adjust_policy_max()
2972 policy->max > cpu->pstate.max_freq) { in intel_pstate_adjust_policy_max()
2978 static void intel_pstate_verify_cpu_policy(struct cpudata *cpu, in intel_pstate_verify_cpu_policy() argument
2984 intel_pstate_get_hwp_cap(cpu); in intel_pstate_verify_cpu_policy()
2986 cpu->pstate.max_freq : cpu->pstate.turbo_freq; in intel_pstate_verify_cpu_policy()
2988 max_freq = intel_pstate_get_max_freq(cpu); in intel_pstate_verify_cpu_policy()
2992 intel_pstate_adjust_policy_max(cpu, policy); in intel_pstate_verify_cpu_policy()
2997 intel_pstate_verify_cpu_policy(all_cpu_data[policy->cpu], policy); in intel_pstate_verify_policy()
3004 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_cpu_offline() local
3006 pr_debug("CPU %d going offline\n", cpu->cpu); in intel_cpufreq_cpu_offline()
3008 if (cpu->suspended) in intel_cpufreq_cpu_offline()
3018 intel_pstate_hwp_offline(cpu); in intel_cpufreq_cpu_offline()
3020 intel_pstate_set_min_pstate(cpu); in intel_cpufreq_cpu_offline()
3029 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_pstate_cpu_online() local
3031 pr_debug("CPU %d going online\n", cpu->cpu); in intel_pstate_cpu_online()
3040 intel_pstate_hwp_reenable(cpu); in intel_pstate_cpu_online()
3041 cpu->suspended = false; in intel_pstate_cpu_online()
3043 hybrid_update_capacity(cpu); in intel_pstate_cpu_online()
3051 intel_pstate_clear_update_util_hook(policy->cpu); in intel_pstate_cpu_offline()
3058 pr_debug("CPU %d exiting\n", policy->cpu); in intel_pstate_cpu_exit()
3065 struct cpudata *cpu; in __intel_pstate_cpu_init() local
3068 rc = intel_pstate_init_cpu(policy->cpu); in __intel_pstate_cpu_init()
3072 cpu = all_cpu_data[policy->cpu]; in __intel_pstate_cpu_init()
3074 cpu->max_perf_ratio = 0xFF; in __intel_pstate_cpu_init()
3075 cpu->min_perf_ratio = 0; in __intel_pstate_cpu_init()
3078 policy->cpuinfo.min_freq = cpu->pstate.min_freq; in __intel_pstate_cpu_init()
3080 cpu->pstate.max_freq : cpu->pstate.turbo_freq; in __intel_pstate_cpu_init()
3106 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_pstate_cpu_init() local
3108 cpu->epp_cached = intel_pstate_get_epp(cpu, 0); in intel_pstate_cpu_init()
3130 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_verify_policy() local
3132 intel_pstate_verify_cpu_policy(cpu, policy); in intel_cpufreq_verify_policy()
3133 intel_pstate_update_perf_limits(cpu, policy->min, policy->max); in intel_cpufreq_verify_policy()
3154 static void intel_cpufreq_trace(struct cpudata *cpu, unsigned int trace_type, int old_pstate) in intel_cpufreq_trace() argument
3161 if (!intel_pstate_sample(cpu, ktime_get())) in intel_cpufreq_trace()
3164 sample = &cpu->sample; in intel_cpufreq_trace()
3168 cpu->pstate.current_pstate, in intel_cpufreq_trace()
3172 get_avg_frequency(cpu), in intel_cpufreq_trace()
3173 fp_toint(cpu->iowait_boost * 100)); in intel_cpufreq_trace()
3176 static void intel_cpufreq_hwp_update(struct cpudata *cpu, u32 min, u32 max, in intel_cpufreq_hwp_update() argument
3179 u64 prev = READ_ONCE(cpu->hwp_req_cached), value = prev; in intel_cpufreq_hwp_update()
3193 WRITE_ONCE(cpu->hwp_req_cached, value); in intel_cpufreq_hwp_update()
3197 wrmsrq_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); in intel_cpufreq_hwp_update()
3200 static void intel_cpufreq_perf_ctl_update(struct cpudata *cpu, in intel_cpufreq_perf_ctl_update() argument
3205 pstate_funcs.get_val(cpu, target_pstate)); in intel_cpufreq_perf_ctl_update()
3207 wrmsrq_on_cpu(cpu->cpu, MSR_IA32_PERF_CTL, in intel_cpufreq_perf_ctl_update()
3208 pstate_funcs.get_val(cpu, target_pstate)); in intel_cpufreq_perf_ctl_update()
3214 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_update_pstate() local
3215 int old_pstate = cpu->pstate.current_pstate; in intel_cpufreq_update_pstate()
3217 target_pstate = intel_pstate_prepare_request(cpu, target_pstate); in intel_cpufreq_update_pstate()
3220 target_pstate : cpu->max_perf_ratio; in intel_cpufreq_update_pstate()
3222 intel_cpufreq_hwp_update(cpu, target_pstate, max_pstate, in intel_cpufreq_update_pstate()
3225 intel_cpufreq_perf_ctl_update(cpu, target_pstate, fast_switch); in intel_cpufreq_update_pstate()
3228 cpu->pstate.current_pstate = target_pstate; in intel_cpufreq_update_pstate()
3230 intel_cpufreq_trace(cpu, fast_switch ? INTEL_PSTATE_TRACE_FAST_SWITCH : in intel_cpufreq_update_pstate()
3240 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_target() local
3249 target_pstate = intel_pstate_freq_to_hwp_rel(cpu, freqs.new, relation); in intel_cpufreq_target()
3252 freqs.new = target_pstate * cpu->pstate.scaling; in intel_cpufreq_target()
3262 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_fast_switch() local
3265 target_pstate = intel_pstate_freq_to_hwp(cpu, target_freq); in intel_cpufreq_fast_switch()
3269 return target_pstate * cpu->pstate.scaling; in intel_cpufreq_fast_switch()
3277 struct cpudata *cpu = all_cpu_data[cpunum]; in intel_cpufreq_adjust_perf() local
3278 u64 hwp_cap = READ_ONCE(cpu->hwp_cap_cached); in intel_cpufreq_adjust_perf()
3279 int old_pstate = cpu->pstate.current_pstate; in intel_cpufreq_adjust_perf()
3296 if (min_pstate < cpu->pstate.min_pstate) in intel_cpufreq_adjust_perf()
3297 min_pstate = cpu->pstate.min_pstate; in intel_cpufreq_adjust_perf()
3299 if (min_pstate < cpu->min_perf_ratio) in intel_cpufreq_adjust_perf()
3300 min_pstate = cpu->min_perf_ratio; in intel_cpufreq_adjust_perf()
3302 if (min_pstate > cpu->max_perf_ratio) in intel_cpufreq_adjust_perf()
3303 min_pstate = cpu->max_perf_ratio; in intel_cpufreq_adjust_perf()
3305 max_pstate = min(cap_pstate, cpu->max_perf_ratio); in intel_cpufreq_adjust_perf()
3311 intel_cpufreq_hwp_update(cpu, min_pstate, max_pstate, target_pstate, true); in intel_cpufreq_adjust_perf()
3313 cpu->pstate.current_pstate = target_pstate; in intel_cpufreq_adjust_perf()
3314 intel_cpufreq_trace(cpu, INTEL_PSTATE_TRACE_FAST_SWITCH, old_pstate); in intel_cpufreq_adjust_perf()
3320 struct cpudata *cpu; in intel_cpufreq_cpu_init() local
3324 dev = get_cpu_device(policy->cpu); in intel_cpufreq_cpu_init()
3342 cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_cpu_init()
3349 intel_pstate_get_hwp_cap(cpu); in intel_cpufreq_cpu_init()
3351 rdmsrq_on_cpu(cpu->cpu, MSR_HWP_REQUEST, &value); in intel_cpufreq_cpu_init()
3352 WRITE_ONCE(cpu->hwp_req_cached, value); in intel_cpufreq_cpu_init()
3354 cpu->epp_cached = intel_pstate_get_epp(cpu, value); in intel_cpufreq_cpu_init()
3359 freq = DIV_ROUND_UP(cpu->pstate.turbo_freq * global.min_perf_pct, 100); in intel_cpufreq_cpu_init()
3368 freq = DIV_ROUND_UP(cpu->pstate.turbo_freq * global.max_perf_pct, 100); in intel_cpufreq_cpu_init()
3409 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_suspend() local
3410 u64 value = READ_ONCE(cpu->hwp_req_cached); in intel_cpufreq_suspend()
3418 wrmsrq_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); in intel_cpufreq_suspend()
3419 WRITE_ONCE(cpu->hwp_req_cached, value); in intel_cpufreq_suspend()
3444 unsigned int cpu; in intel_pstate_driver_cleanup() local
3447 for_each_online_cpu(cpu) { in intel_pstate_driver_cleanup()
3448 if (all_cpu_data[cpu]) { in intel_pstate_driver_cleanup()
3450 intel_pstate_clear_update_util_hook(cpu); in intel_pstate_driver_cleanup()
3452 kfree(all_cpu_data[cpu]); in intel_pstate_driver_cleanup()
3453 WRITE_ONCE(all_cpu_data[cpu], NULL); in intel_pstate_driver_cleanup()