Lines Matching full:cpu

20 #include <linux/cpu.h>
30 #include <asm/cpu.h>
97 * to account for cpu idle period
133 * Stores the per cpu model P state limits and current P state.
190 * struct cpudata - Per CPU instance data storage
191 * @cpu: CPU number for this instance data
197 * @pstate: Stores P state limits for this CPU
198 * @vid: Stores VID limits for this CPU
221 * @sched_flags: Store scheduler flags for possible cross CPU update
226 * This structure stores per CPU instance data for all CPUs.
229 int cpu; member
269 * struct pstate_funcs - Per CPU model specific callbacks
275 * @get_cpu_scaling: Get frequency scaling factor for a given cpu
280 * Core and Atom CPU models have different way to get P State limits. This
284 int (*get_max)(int cpu);
285 int (*get_max_physical)(int cpu);
286 int (*get_min)(int cpu);
287 int (*get_turbo)(int cpu);
289 int (*get_cpu_scaling)(int cpu);
342 /* The work item is needed to avoid CPU hotplug locking issues */
352 static void intel_pstate_set_itmt_prio(int cpu) in intel_pstate_set_itmt_prio() argument
358 ret = cppc_get_perf_caps(cpu, &cppc_perf); in intel_pstate_set_itmt_prio()
367 cppc_perf.highest_perf = HWP_HIGHEST_PERF(READ_ONCE(all_cpu_data[cpu]->hwp_cap_cached)); in intel_pstate_set_itmt_prio()
374 sched_set_itmt_core_prio(cppc_perf.highest_perf, cpu); in intel_pstate_set_itmt_prio()
385 * This code can be run during CPU online under the in intel_pstate_set_itmt_prio()
386 * CPU hotplug locks, so sched_set_itmt_support() in intel_pstate_set_itmt_prio()
395 static int intel_pstate_get_cppc_guaranteed(int cpu) in intel_pstate_get_cppc_guaranteed() argument
400 ret = cppc_get_perf_caps(cpu, &cppc_perf); in intel_pstate_get_cppc_guaranteed()
410 static int intel_pstate_cppc_get_scaling(int cpu) in intel_pstate_cppc_get_scaling() argument
415 ret = cppc_get_perf_caps(cpu, &cppc_perf); in intel_pstate_cppc_get_scaling()
430 static inline void intel_pstate_set_itmt_prio(int cpu) in intel_pstate_set_itmt_prio() argument
437 struct cpudata *cpu; in intel_pstate_init_acpi_perf_limits() local
442 intel_pstate_set_itmt_prio(policy->cpu); in intel_pstate_init_acpi_perf_limits()
449 cpu = all_cpu_data[policy->cpu]; in intel_pstate_init_acpi_perf_limits()
451 ret = acpi_processor_register_performance(&cpu->acpi_perf_data, in intel_pstate_init_acpi_perf_limits()
452 policy->cpu); in intel_pstate_init_acpi_perf_limits()
461 if (cpu->acpi_perf_data.control_register.space_id != in intel_pstate_init_acpi_perf_limits()
469 if (cpu->acpi_perf_data.state_count < 2) in intel_pstate_init_acpi_perf_limits()
472 pr_debug("CPU%u - ACPI _PSS perf data\n", policy->cpu); in intel_pstate_init_acpi_perf_limits()
473 for (i = 0; i < cpu->acpi_perf_data.state_count; i++) { in intel_pstate_init_acpi_perf_limits()
475 (i == cpu->acpi_perf_data.state ? '*' : ' '), i, in intel_pstate_init_acpi_perf_limits()
476 (u32) cpu->acpi_perf_data.states[i].core_frequency, in intel_pstate_init_acpi_perf_limits()
477 (u32) cpu->acpi_perf_data.states[i].power, in intel_pstate_init_acpi_perf_limits()
478 (u32) cpu->acpi_perf_data.states[i].control); in intel_pstate_init_acpi_perf_limits()
481 cpu->valid_pss_table = true; in intel_pstate_init_acpi_perf_limits()
487 cpu->valid_pss_table = false; in intel_pstate_init_acpi_perf_limits()
488 acpi_processor_unregister_performance(policy->cpu); in intel_pstate_init_acpi_perf_limits()
493 struct cpudata *cpu; in intel_pstate_exit_perf_limits() local
495 cpu = all_cpu_data[policy->cpu]; in intel_pstate_exit_perf_limits()
496 if (!cpu->valid_pss_table) in intel_pstate_exit_perf_limits()
499 acpi_processor_unregister_performance(policy->cpu); in intel_pstate_exit_perf_limits()
517 static inline int intel_pstate_get_cppc_guaranteed(int cpu) in intel_pstate_get_cppc_guaranteed() argument
522 static int intel_pstate_cppc_get_scaling(int cpu) in intel_pstate_cppc_get_scaling() argument
528 static int intel_pstate_freq_to_hwp_rel(struct cpudata *cpu, int freq, in intel_pstate_freq_to_hwp_rel() argument
531 if (freq == cpu->pstate.turbo_freq) in intel_pstate_freq_to_hwp_rel()
532 return cpu->pstate.turbo_pstate; in intel_pstate_freq_to_hwp_rel()
534 if (freq == cpu->pstate.max_freq) in intel_pstate_freq_to_hwp_rel()
535 return cpu->pstate.max_pstate; in intel_pstate_freq_to_hwp_rel()
539 return freq / cpu->pstate.scaling; in intel_pstate_freq_to_hwp_rel()
541 return DIV_ROUND_CLOSEST(freq, cpu->pstate.scaling); in intel_pstate_freq_to_hwp_rel()
544 return DIV_ROUND_UP(freq, cpu->pstate.scaling); in intel_pstate_freq_to_hwp_rel()
547 static int intel_pstate_freq_to_hwp(struct cpudata *cpu, int freq) in intel_pstate_freq_to_hwp() argument
549 return intel_pstate_freq_to_hwp_rel(cpu, freq, CPUFREQ_RELATION_L); in intel_pstate_freq_to_hwp()
554 * @cpu: Target CPU.
558 * scaling factor between HWP performance levels and CPU frequency will be less
559 * than the scaling factor between P-state values and CPU frequency.
561 * In that case, adjust the CPU parameters used in computations accordingly.
563 static void intel_pstate_hybrid_hwp_adjust(struct cpudata *cpu) in intel_pstate_hybrid_hwp_adjust() argument
565 int perf_ctl_max_phys = cpu->pstate.max_pstate_physical; in intel_pstate_hybrid_hwp_adjust()
566 int perf_ctl_scaling = cpu->pstate.perf_ctl_scaling; in intel_pstate_hybrid_hwp_adjust()
567 int perf_ctl_turbo = pstate_funcs.get_turbo(cpu->cpu); in intel_pstate_hybrid_hwp_adjust()
568 int scaling = cpu->pstate.scaling; in intel_pstate_hybrid_hwp_adjust()
571 pr_debug("CPU%d: perf_ctl_max_phys = %d\n", cpu->cpu, perf_ctl_max_phys); in intel_pstate_hybrid_hwp_adjust()
572 pr_debug("CPU%d: perf_ctl_turbo = %d\n", cpu->cpu, perf_ctl_turbo); in intel_pstate_hybrid_hwp_adjust()
573 pr_debug("CPU%d: perf_ctl_scaling = %d\n", cpu->cpu, perf_ctl_scaling); in intel_pstate_hybrid_hwp_adjust()
574 pr_debug("CPU%d: HWP_CAP guaranteed = %d\n", cpu->cpu, cpu->pstate.max_pstate); in intel_pstate_hybrid_hwp_adjust()
575 pr_debug("CPU%d: HWP_CAP highest = %d\n", cpu->cpu, cpu->pstate.turbo_pstate); in intel_pstate_hybrid_hwp_adjust()
576 pr_debug("CPU%d: HWP-to-frequency scaling factor: %d\n", cpu->cpu, scaling); in intel_pstate_hybrid_hwp_adjust()
578 cpu->pstate.turbo_freq = rounddown(cpu->pstate.turbo_pstate * scaling, in intel_pstate_hybrid_hwp_adjust()
580 cpu->pstate.max_freq = rounddown(cpu->pstate.max_pstate * scaling, in intel_pstate_hybrid_hwp_adjust()
584 cpu->pstate.max_pstate_physical = intel_pstate_freq_to_hwp(cpu, freq); in intel_pstate_hybrid_hwp_adjust()
586 freq = cpu->pstate.min_pstate * perf_ctl_scaling; in intel_pstate_hybrid_hwp_adjust()
587 cpu->pstate.min_freq = freq; in intel_pstate_hybrid_hwp_adjust()
592 cpu->pstate.min_pstate = intel_pstate_freq_to_hwp(cpu, freq); in intel_pstate_hybrid_hwp_adjust()
598 struct cpudata *cpu; in update_turbo_state() local
600 cpu = all_cpu_data[0]; in update_turbo_state()
604 cpu->pstate.max_pstate == cpu->pstate.turbo_pstate); in update_turbo_state()
609 struct cpudata *cpu = all_cpu_data[0]; in min_perf_pct_min() local
610 int turbo_pstate = cpu->pstate.turbo_pstate; in min_perf_pct_min()
613 (cpu->pstate.min_pstate * 100 / turbo_pstate) : 0; in min_perf_pct_min()
624 ret = rdmsrl_on_cpu(cpu_data->cpu, MSR_IA32_ENERGY_PERF_BIAS, &epb); in intel_pstate_get_epb()
641 epp = rdmsrl_on_cpu(cpu_data->cpu, MSR_HWP_REQUEST, in intel_pstate_get_epp()
655 static int intel_pstate_set_epb(int cpu, s16 pref) in intel_pstate_set_epb() argument
663 ret = rdmsrl_on_cpu(cpu, MSR_IA32_ENERGY_PERF_BIAS, &epb); in intel_pstate_set_epb()
668 wrmsrl_on_cpu(cpu, MSR_IA32_ENERGY_PERF_BIAS, epb); in intel_pstate_set_epb()
747 static int intel_pstate_set_epp(struct cpudata *cpu, u32 epp) in intel_pstate_set_epp() argument
756 u64 value = READ_ONCE(cpu->hwp_req_cached); in intel_pstate_set_epp()
765 WRITE_ONCE(cpu->hwp_req_cached, value); in intel_pstate_set_epp()
766 ret = wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); in intel_pstate_set_epp()
768 cpu->epp_cached = epp; in intel_pstate_set_epp()
801 ret = intel_pstate_set_epb(cpu_data->cpu, epp); in intel_pstate_set_energy_pref_index()
828 struct cpudata *cpu = all_cpu_data[policy->cpu]; in store_energy_performance_preference() local
864 ret = intel_pstate_set_energy_pref_index(cpu, ret, raw, epp); in store_energy_performance_preference()
868 * target CPU before the EPP update and restarted after it, in store_energy_performance_preference()
873 epp = ret ? epp_values[ret] : cpu->epp_default; in store_energy_performance_preference()
875 if (cpu->epp_cached != epp) { in store_energy_performance_preference()
879 ret = intel_pstate_set_epp(cpu, epp); in store_energy_performance_preference()
896 struct cpudata *cpu_data = all_cpu_data[policy->cpu]; in show_energy_performance_preference()
913 struct cpudata *cpu = all_cpu_data[policy->cpu]; in show_base_frequency() local
916 ratio = intel_pstate_get_cppc_guaranteed(policy->cpu); in show_base_frequency()
920 rdmsrl_on_cpu(policy->cpu, MSR_HWP_CAPABILITIES, &cap); in show_base_frequency()
924 freq = ratio * cpu->pstate.scaling; in show_base_frequency()
925 if (cpu->pstate.scaling != cpu->pstate.perf_ctl_scaling) in show_base_frequency()
926 freq = rounddown(freq, cpu->pstate.perf_ctl_scaling); in show_base_frequency()
940 static void __intel_pstate_get_hwp_cap(struct cpudata *cpu) in __intel_pstate_get_hwp_cap() argument
944 rdmsrl_on_cpu(cpu->cpu, MSR_HWP_CAPABILITIES, &cap); in __intel_pstate_get_hwp_cap()
945 WRITE_ONCE(cpu->hwp_cap_cached, cap); in __intel_pstate_get_hwp_cap()
946 cpu->pstate.max_pstate = HWP_GUARANTEED_PERF(cap); in __intel_pstate_get_hwp_cap()
947 cpu->pstate.turbo_pstate = HWP_HIGHEST_PERF(cap); in __intel_pstate_get_hwp_cap()
950 static void intel_pstate_get_hwp_cap(struct cpudata *cpu) in intel_pstate_get_hwp_cap() argument
952 int scaling = cpu->pstate.scaling; in intel_pstate_get_hwp_cap()
954 __intel_pstate_get_hwp_cap(cpu); in intel_pstate_get_hwp_cap()
956 cpu->pstate.max_freq = cpu->pstate.max_pstate * scaling; in intel_pstate_get_hwp_cap()
957 cpu->pstate.turbo_freq = cpu->pstate.turbo_pstate * scaling; in intel_pstate_get_hwp_cap()
958 if (scaling != cpu->pstate.perf_ctl_scaling) { in intel_pstate_get_hwp_cap()
959 int perf_ctl_scaling = cpu->pstate.perf_ctl_scaling; in intel_pstate_get_hwp_cap()
961 cpu->pstate.max_freq = rounddown(cpu->pstate.max_freq, in intel_pstate_get_hwp_cap()
963 cpu->pstate.turbo_freq = rounddown(cpu->pstate.turbo_freq, in intel_pstate_get_hwp_cap()
968 static void intel_pstate_hwp_set(unsigned int cpu) in intel_pstate_hwp_set() argument
970 struct cpudata *cpu_data = all_cpu_data[cpu]; in intel_pstate_hwp_set()
981 rdmsrl_on_cpu(cpu, MSR_HWP_REQUEST, &value); in intel_pstate_hwp_set()
1024 intel_pstate_set_epb(cpu, epp); in intel_pstate_hwp_set()
1028 wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value); in intel_pstate_hwp_set()
1033 static void intel_pstate_hwp_offline(struct cpudata *cpu) in intel_pstate_hwp_offline() argument
1035 u64 value = READ_ONCE(cpu->hwp_req_cached); in intel_pstate_hwp_offline()
1038 intel_pstate_disable_hwp_interrupt(cpu); in intel_pstate_hwp_offline()
1047 value |= HWP_ENERGY_PERF_PREFERENCE(cpu->epp_cached); in intel_pstate_hwp_offline()
1050 * the CPU is brought back online again and the "performance" in intel_pstate_hwp_offline()
1053 cpu->epp_policy = CPUFREQ_POLICY_UNKNOWN; in intel_pstate_hwp_offline()
1062 WRITE_ONCE(cpu->hwp_req_cached, value); in intel_pstate_hwp_offline()
1065 min_perf = HWP_LOWEST_PERF(READ_ONCE(cpu->hwp_cap_cached)); in intel_pstate_hwp_offline()
1075 wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); in intel_pstate_hwp_offline()
1102 static void intel_pstate_hwp_reenable(struct cpudata *cpu) in intel_pstate_hwp_reenable() argument
1104 intel_pstate_hwp_enable(cpu); in intel_pstate_hwp_reenable()
1105 wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, READ_ONCE(cpu->hwp_req_cached)); in intel_pstate_hwp_reenable()
1110 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_pstate_suspend() local
1112 pr_debug("CPU %d suspending\n", cpu->cpu); in intel_pstate_suspend()
1114 cpu->suspended = true; in intel_pstate_suspend()
1117 intel_pstate_disable_hwp_interrupt(cpu); in intel_pstate_suspend()
1124 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_pstate_resume() local
1126 pr_debug("CPU %d resuming\n", cpu->cpu); in intel_pstate_resume()
1134 if (cpu->suspended && hwp_active) { in intel_pstate_resume()
1138 intel_pstate_hwp_reenable(cpu); in intel_pstate_resume()
1143 cpu->suspended = false; in intel_pstate_resume()
1150 int cpu; in intel_pstate_update_policies() local
1152 for_each_possible_cpu(cpu) in intel_pstate_update_policies()
1153 cpufreq_update_policy(cpu); in intel_pstate_update_policies()
1164 static void intel_pstate_update_max_freq(unsigned int cpu) in intel_pstate_update_max_freq() argument
1166 struct cpufreq_policy *policy = cpufreq_cpu_acquire(cpu); in intel_pstate_update_max_freq()
1171 __intel_pstate_update_max_freq(all_cpu_data[cpu], policy); in intel_pstate_update_max_freq()
1176 static void intel_pstate_update_limits(unsigned int cpu) in intel_pstate_update_limits() argument
1188 for_each_possible_cpu(cpu) in intel_pstate_update_limits()
1189 intel_pstate_update_max_freq(cpu); in intel_pstate_update_limits()
1191 cpufreq_update_policy(cpu); in intel_pstate_update_limits()
1236 struct cpudata *cpu; in show_turbo_pct() local
1247 cpu = all_cpu_data[0]; in show_turbo_pct()
1249 total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1; in show_turbo_pct()
1250 no_turbo = cpu->pstate.max_pstate - cpu->pstate.min_pstate + 1; in show_turbo_pct()
1262 struct cpudata *cpu; in show_num_pstates() local
1272 cpu = all_cpu_data[0]; in show_num_pstates()
1273 total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1; in show_num_pstates()
1333 struct cpudata *cpu = all_cpu_data[0]; in store_no_turbo() local
1334 int pct = cpu->pstate.max_pstate * 100 / cpu->pstate.turbo_pstate; in store_no_turbo()
1358 struct cpudata *cpu = all_cpu_data[i]; in update_qos_request() local
1372 intel_pstate_get_hwp_cap(cpu); in update_qos_request()
1381 freq = DIV_ROUND_UP(cpu->pstate.turbo_freq * perf_pct, 100); in update_qos_request()
1384 pr_warn("Failed to update freq constraint: CPU%d\n", i); in update_qos_request()
1557 * If per cpu limits are enforced there are no global limits, so in intel_pstate_sysfs_expose_params()
1623 struct cpufreq_policy *policy = cpufreq_cpu_acquire(cpudata->cpu); in intel_pstate_notify_work()
1632 wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_STATUS, 0); in intel_pstate_notify_work()
1693 wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, 0x00); in intel_pstate_disable_hwp_interrupt()
1696 if (cpumask_test_and_clear_cpu(cpudata->cpu, &hwp_intr_enable_mask)) in intel_pstate_disable_hwp_interrupt()
1709 cpumask_set_cpu(cpudata->cpu, &hwp_intr_enable_mask); in intel_pstate_enable_hwp_interrupt()
1713 wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, 0x01); in intel_pstate_enable_hwp_interrupt()
1714 wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_STATUS, 0); in intel_pstate_enable_hwp_interrupt()
1723 * If this CPU gen doesn't call for change in balance_perf in intel_pstate_update_epp_defaults()
1753 wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, 0x00); in intel_pstate_hwp_enable()
1755 wrmsrl_on_cpu(cpudata->cpu, MSR_PM_ENABLE, 0x1); in intel_pstate_hwp_enable()
1859 static int core_get_min_pstate(int cpu) in core_get_min_pstate() argument
1863 rdmsrl_on_cpu(cpu, MSR_PLATFORM_INFO, &value); in core_get_min_pstate()
1867 static int core_get_max_pstate_physical(int cpu) in core_get_max_pstate_physical() argument
1871 rdmsrl_on_cpu(cpu, MSR_PLATFORM_INFO, &value); in core_get_max_pstate_physical()
1875 static int core_get_tdp_ratio(int cpu, u64 plat_info) in core_get_tdp_ratio() argument
1885 err = rdmsrl_safe_on_cpu(cpu, MSR_CONFIG_TDP_CONTROL, &tdp_ctrl); in core_get_tdp_ratio()
1891 err = rdmsrl_safe_on_cpu(cpu, tdp_msr, &tdp_ratio); in core_get_tdp_ratio()
1908 static int core_get_max_pstate(int cpu) in core_get_max_pstate() argument
1916 rdmsrl_on_cpu(cpu, MSR_PLATFORM_INFO, &plat_info); in core_get_max_pstate()
1919 tdp_ratio = core_get_tdp_ratio(cpu, plat_info); in core_get_max_pstate()
1928 err = rdmsrl_safe_on_cpu(cpu, MSR_TURBO_ACTIVATION_RATIO, &tar); in core_get_max_pstate()
1943 static int core_get_turbo_pstate(int cpu) in core_get_turbo_pstate() argument
1948 rdmsrl_on_cpu(cpu, MSR_TURBO_RATIO_LIMIT, &value); in core_get_turbo_pstate()
1949 nont = core_get_max_pstate(cpu); in core_get_turbo_pstate()
1972 static int knl_get_turbo_pstate(int cpu) in knl_get_turbo_pstate() argument
1977 rdmsrl_on_cpu(cpu, MSR_TURBO_RATIO_LIMIT, &value); in knl_get_turbo_pstate()
1978 nont = core_get_max_pstate(cpu); in knl_get_turbo_pstate()
1992 static int hwp_get_cpu_scaling(int cpu) in hwp_get_cpu_scaling() argument
1996 smp_call_function_single(cpu, hybrid_get_type, &cpu_type, 1); in hwp_get_cpu_scaling()
2013 return intel_pstate_cppc_get_scaling(cpu); in hwp_get_cpu_scaling()
2016 static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate) in intel_pstate_set_pstate() argument
2018 trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu); in intel_pstate_set_pstate()
2019 cpu->pstate.current_pstate = pstate; in intel_pstate_set_pstate()
2022 * the CPU being updated, so force the register update to run on the in intel_pstate_set_pstate()
2023 * right CPU. in intel_pstate_set_pstate()
2025 wrmsrl_on_cpu(cpu->cpu, MSR_IA32_PERF_CTL, in intel_pstate_set_pstate()
2026 pstate_funcs.get_val(cpu, pstate)); in intel_pstate_set_pstate()
2029 static void intel_pstate_set_min_pstate(struct cpudata *cpu) in intel_pstate_set_min_pstate() argument
2031 intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate); in intel_pstate_set_min_pstate()
2034 static void intel_pstate_max_within_limits(struct cpudata *cpu) in intel_pstate_max_within_limits() argument
2036 int pstate = max(cpu->pstate.min_pstate, cpu->max_perf_ratio); in intel_pstate_max_within_limits()
2039 intel_pstate_set_pstate(cpu, pstate); in intel_pstate_max_within_limits()
2042 static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) in intel_pstate_get_cpu_pstates() argument
2044 int perf_ctl_max_phys = pstate_funcs.get_max_physical(cpu->cpu); in intel_pstate_get_cpu_pstates()
2047 cpu->pstate.min_pstate = pstate_funcs.get_min(cpu->cpu); in intel_pstate_get_cpu_pstates()
2048 cpu->pstate.max_pstate_physical = perf_ctl_max_phys; in intel_pstate_get_cpu_pstates()
2049 cpu->pstate.perf_ctl_scaling = perf_ctl_scaling; in intel_pstate_get_cpu_pstates()
2052 __intel_pstate_get_hwp_cap(cpu); in intel_pstate_get_cpu_pstates()
2055 cpu->pstate.scaling = pstate_funcs.get_cpu_scaling(cpu->cpu); in intel_pstate_get_cpu_pstates()
2056 if (cpu->pstate.scaling != perf_ctl_scaling) in intel_pstate_get_cpu_pstates()
2057 intel_pstate_hybrid_hwp_adjust(cpu); in intel_pstate_get_cpu_pstates()
2059 cpu->pstate.scaling = perf_ctl_scaling; in intel_pstate_get_cpu_pstates()
2062 cpu->pstate.scaling = perf_ctl_scaling; in intel_pstate_get_cpu_pstates()
2063 cpu->pstate.max_pstate = pstate_funcs.get_max(cpu->cpu); in intel_pstate_get_cpu_pstates()
2064 cpu->pstate.turbo_pstate = pstate_funcs.get_turbo(cpu->cpu); in intel_pstate_get_cpu_pstates()
2067 if (cpu->pstate.scaling == perf_ctl_scaling) { in intel_pstate_get_cpu_pstates()
2068 cpu->pstate.min_freq = cpu->pstate.min_pstate * perf_ctl_scaling; in intel_pstate_get_cpu_pstates()
2069 cpu->pstate.max_freq = cpu->pstate.max_pstate * perf_ctl_scaling; in intel_pstate_get_cpu_pstates()
2070 cpu->pstate.turbo_freq = cpu->pstate.turbo_pstate * perf_ctl_scaling; in intel_pstate_get_cpu_pstates()
2074 cpu->aperf_mperf_shift = pstate_funcs.get_aperf_mperf_shift(); in intel_pstate_get_cpu_pstates()
2077 pstate_funcs.get_vid(cpu); in intel_pstate_get_cpu_pstates()
2079 intel_pstate_set_min_pstate(cpu); in intel_pstate_get_cpu_pstates()
2090 static inline void intel_pstate_hwp_boost_up(struct cpudata *cpu) in intel_pstate_hwp_boost_up() argument
2092 u64 hwp_req = READ_ONCE(cpu->hwp_req_cached); in intel_pstate_hwp_boost_up()
2093 u64 hwp_cap = READ_ONCE(cpu->hwp_cap_cached); in intel_pstate_hwp_boost_up()
2113 if (max_limit == min_limit || cpu->hwp_boost_min >= max_limit) in intel_pstate_hwp_boost_up()
2116 if (!cpu->hwp_boost_min) in intel_pstate_hwp_boost_up()
2117 cpu->hwp_boost_min = min_limit; in intel_pstate_hwp_boost_up()
2122 if (cpu->hwp_boost_min < boost_level1) in intel_pstate_hwp_boost_up()
2123 cpu->hwp_boost_min = boost_level1; in intel_pstate_hwp_boost_up()
2124 else if (cpu->hwp_boost_min < HWP_GUARANTEED_PERF(hwp_cap)) in intel_pstate_hwp_boost_up()
2125 cpu->hwp_boost_min = HWP_GUARANTEED_PERF(hwp_cap); in intel_pstate_hwp_boost_up()
2126 else if (cpu->hwp_boost_min == HWP_GUARANTEED_PERF(hwp_cap) && in intel_pstate_hwp_boost_up()
2128 cpu->hwp_boost_min = max_limit; in intel_pstate_hwp_boost_up()
2132 hwp_req = (hwp_req & ~GENMASK_ULL(7, 0)) | cpu->hwp_boost_min; in intel_pstate_hwp_boost_up()
2134 cpu->last_update = cpu->sample.time; in intel_pstate_hwp_boost_up()
2137 static inline void intel_pstate_hwp_boost_down(struct cpudata *cpu) in intel_pstate_hwp_boost_down() argument
2139 if (cpu->hwp_boost_min) { in intel_pstate_hwp_boost_down()
2143 expired = time_after64(cpu->sample.time, cpu->last_update + in intel_pstate_hwp_boost_down()
2146 wrmsrl(MSR_HWP_REQUEST, cpu->hwp_req_cached); in intel_pstate_hwp_boost_down()
2147 cpu->hwp_boost_min = 0; in intel_pstate_hwp_boost_down()
2150 cpu->last_update = cpu->sample.time; in intel_pstate_hwp_boost_down()
2153 static inline void intel_pstate_update_util_hwp_local(struct cpudata *cpu, in intel_pstate_update_util_hwp_local() argument
2156 cpu->sample.time = time; in intel_pstate_update_util_hwp_local()
2158 if (cpu->sched_flags & SCHED_CPUFREQ_IOWAIT) { in intel_pstate_update_util_hwp_local()
2161 cpu->sched_flags = 0; in intel_pstate_update_util_hwp_local()
2165 * some IO bound activity is scheduled on this CPU with just in intel_pstate_update_util_hwp_local()
2169 if (time_before64(time, cpu->last_io_update + 2 * TICK_NSEC)) in intel_pstate_update_util_hwp_local()
2172 cpu->last_io_update = time; in intel_pstate_update_util_hwp_local()
2175 intel_pstate_hwp_boost_up(cpu); in intel_pstate_update_util_hwp_local()
2178 intel_pstate_hwp_boost_down(cpu); in intel_pstate_update_util_hwp_local()
2185 struct cpudata *cpu = container_of(data, struct cpudata, update_util); in intel_pstate_update_util_hwp() local
2187 cpu->sched_flags |= flags; in intel_pstate_update_util_hwp()
2189 if (smp_processor_id() == cpu->cpu) in intel_pstate_update_util_hwp()
2190 intel_pstate_update_util_hwp_local(cpu, time); in intel_pstate_update_util_hwp()
2193 static inline void intel_pstate_calc_avg_perf(struct cpudata *cpu) in intel_pstate_calc_avg_perf() argument
2195 struct sample *sample = &cpu->sample; in intel_pstate_calc_avg_perf()
2200 static inline bool intel_pstate_sample(struct cpudata *cpu, u64 time) in intel_pstate_sample() argument
2210 if (cpu->prev_mperf == mperf || cpu->prev_tsc == tsc) { in intel_pstate_sample()
2216 cpu->last_sample_time = cpu->sample.time; in intel_pstate_sample()
2217 cpu->sample.time = time; in intel_pstate_sample()
2218 cpu->sample.aperf = aperf; in intel_pstate_sample()
2219 cpu->sample.mperf = mperf; in intel_pstate_sample()
2220 cpu->sample.tsc = tsc; in intel_pstate_sample()
2221 cpu->sample.aperf -= cpu->prev_aperf; in intel_pstate_sample()
2222 cpu->sample.mperf -= cpu->prev_mperf; in intel_pstate_sample()
2223 cpu->sample.tsc -= cpu->prev_tsc; in intel_pstate_sample()
2225 cpu->prev_aperf = aperf; in intel_pstate_sample()
2226 cpu->prev_mperf = mperf; in intel_pstate_sample()
2227 cpu->prev_tsc = tsc; in intel_pstate_sample()
2235 if (cpu->last_sample_time) { in intel_pstate_sample()
2236 intel_pstate_calc_avg_perf(cpu); in intel_pstate_sample()
2242 static inline int32_t get_avg_frequency(struct cpudata *cpu) in get_avg_frequency() argument
2244 return mul_ext_fp(cpu->sample.core_avg_perf, cpu_khz); in get_avg_frequency()
2247 static inline int32_t get_avg_pstate(struct cpudata *cpu) in get_avg_pstate() argument
2249 return mul_ext_fp(cpu->pstate.max_pstate_physical, in get_avg_pstate()
2250 cpu->sample.core_avg_perf); in get_avg_pstate()
2253 static inline int32_t get_target_pstate(struct cpudata *cpu) in get_target_pstate() argument
2255 struct sample *sample = &cpu->sample; in get_target_pstate()
2259 busy_frac = div_fp(sample->mperf << cpu->aperf_mperf_shift, in get_target_pstate()
2262 if (busy_frac < cpu->iowait_boost) in get_target_pstate()
2263 busy_frac = cpu->iowait_boost; in get_target_pstate()
2268 cpu->pstate.max_pstate : cpu->pstate.turbo_pstate; in get_target_pstate()
2271 if (target < cpu->pstate.min_pstate) in get_target_pstate()
2272 target = cpu->pstate.min_pstate; in get_target_pstate()
2278 * loss related to moving the workload from one CPU to another within in get_target_pstate()
2281 avg_pstate = get_avg_pstate(cpu); in get_target_pstate()
2288 static int intel_pstate_prepare_request(struct cpudata *cpu, int pstate) in intel_pstate_prepare_request() argument
2290 int min_pstate = max(cpu->pstate.min_pstate, cpu->min_perf_ratio); in intel_pstate_prepare_request()
2291 int max_pstate = max(min_pstate, cpu->max_perf_ratio); in intel_pstate_prepare_request()
2296 static void intel_pstate_update_pstate(struct cpudata *cpu, int pstate) in intel_pstate_update_pstate() argument
2298 if (pstate == cpu->pstate.current_pstate) in intel_pstate_update_pstate()
2301 cpu->pstate.current_pstate = pstate; in intel_pstate_update_pstate()
2302 wrmsrl(MSR_IA32_PERF_CTL, pstate_funcs.get_val(cpu, pstate)); in intel_pstate_update_pstate()
2305 static void intel_pstate_adjust_pstate(struct cpudata *cpu) in intel_pstate_adjust_pstate() argument
2307 int from = cpu->pstate.current_pstate; in intel_pstate_adjust_pstate()
2313 target_pstate = get_target_pstate(cpu); in intel_pstate_adjust_pstate()
2314 target_pstate = intel_pstate_prepare_request(cpu, target_pstate); in intel_pstate_adjust_pstate()
2315 trace_cpu_frequency(target_pstate * cpu->pstate.scaling, cpu->cpu); in intel_pstate_adjust_pstate()
2316 intel_pstate_update_pstate(cpu, target_pstate); in intel_pstate_adjust_pstate()
2318 sample = &cpu->sample; in intel_pstate_adjust_pstate()
2322 cpu->pstate.current_pstate, in intel_pstate_adjust_pstate()
2326 get_avg_frequency(cpu), in intel_pstate_adjust_pstate()
2327 fp_toint(cpu->iowait_boost * 100)); in intel_pstate_adjust_pstate()
2333 struct cpudata *cpu = container_of(data, struct cpudata, update_util); in intel_pstate_update_util() local
2337 if (smp_processor_id() != cpu->cpu) in intel_pstate_update_util()
2340 delta_ns = time - cpu->last_update; in intel_pstate_update_util()
2342 /* Start over if the CPU may have been idle. */ in intel_pstate_update_util()
2344 cpu->iowait_boost = ONE_EIGHTH_FP; in intel_pstate_update_util()
2345 } else if (cpu->iowait_boost >= ONE_EIGHTH_FP) { in intel_pstate_update_util()
2346 cpu->iowait_boost <<= 1; in intel_pstate_update_util()
2347 if (cpu->iowait_boost > int_tofp(1)) in intel_pstate_update_util()
2348 cpu->iowait_boost = int_tofp(1); in intel_pstate_update_util()
2350 cpu->iowait_boost = ONE_EIGHTH_FP; in intel_pstate_update_util()
2352 } else if (cpu->iowait_boost) { in intel_pstate_update_util()
2353 /* Clear iowait_boost if the CPU may have been idle. */ in intel_pstate_update_util()
2355 cpu->iowait_boost = 0; in intel_pstate_update_util()
2357 cpu->iowait_boost >>= 1; in intel_pstate_update_util()
2359 cpu->last_update = time; in intel_pstate_update_util()
2360 delta_ns = time - cpu->sample.time; in intel_pstate_update_util()
2364 if (intel_pstate_sample(cpu, time)) in intel_pstate_update_util()
2365 intel_pstate_adjust_pstate(cpu); in intel_pstate_update_util()
2457 struct cpudata *cpu; in intel_pstate_init_cpu() local
2459 cpu = all_cpu_data[cpunum]; in intel_pstate_init_cpu()
2461 if (!cpu) { in intel_pstate_init_cpu()
2462 cpu = kzalloc(sizeof(*cpu), GFP_KERNEL); in intel_pstate_init_cpu()
2463 if (!cpu) in intel_pstate_init_cpu()
2466 WRITE_ONCE(all_cpu_data[cpunum], cpu); in intel_pstate_init_cpu()
2468 cpu->cpu = cpunum; in intel_pstate_init_cpu()
2470 cpu->epp_default = -EINVAL; in intel_pstate_init_cpu()
2473 intel_pstate_hwp_enable(cpu); in intel_pstate_init_cpu()
2481 * S3 if the CPU was offline during the whole system/resume in intel_pstate_init_cpu()
2484 intel_pstate_hwp_reenable(cpu); in intel_pstate_init_cpu()
2487 cpu->epp_powersave = -EINVAL; in intel_pstate_init_cpu()
2488 cpu->epp_policy = 0; in intel_pstate_init_cpu()
2490 intel_pstate_get_cpu_pstates(cpu); in intel_pstate_init_cpu()
2492 pr_debug("controlling: cpu %d\n", cpunum); in intel_pstate_init_cpu()
2499 struct cpudata *cpu = all_cpu_data[cpu_num]; in intel_pstate_set_update_util_hook() local
2504 if (cpu->update_util_set) in intel_pstate_set_update_util_hook()
2508 cpu->sample.time = 0; in intel_pstate_set_update_util_hook()
2509 cpufreq_add_update_util_hook(cpu_num, &cpu->update_util, in intel_pstate_set_update_util_hook()
2513 cpu->update_util_set = true; in intel_pstate_set_update_util_hook()
2516 static void intel_pstate_clear_update_util_hook(unsigned int cpu) in intel_pstate_clear_update_util_hook() argument
2518 struct cpudata *cpu_data = all_cpu_data[cpu]; in intel_pstate_clear_update_util_hook()
2523 cpufreq_remove_update_util_hook(cpu); in intel_pstate_clear_update_util_hook()
2528 static int intel_pstate_get_max_freq(struct cpudata *cpu) in intel_pstate_get_max_freq() argument
2531 cpu->pstate.max_freq : cpu->pstate.turbo_freq; in intel_pstate_get_max_freq()
2534 static void intel_pstate_update_perf_limits(struct cpudata *cpu, in intel_pstate_update_perf_limits() argument
2538 int perf_ctl_scaling = cpu->pstate.perf_ctl_scaling; in intel_pstate_update_perf_limits()
2554 if (hwp_active && cpu->pstate.scaling != perf_ctl_scaling) { in intel_pstate_update_perf_limits()
2558 max_policy_perf = intel_pstate_freq_to_hwp(cpu, freq); in intel_pstate_update_perf_limits()
2560 min_policy_perf = intel_pstate_freq_to_hwp(cpu, freq); in intel_pstate_update_perf_limits()
2563 pr_debug("cpu:%d min_policy_perf:%d max_policy_perf:%d\n", in intel_pstate_update_perf_limits()
2564 cpu->cpu, min_policy_perf, max_policy_perf); in intel_pstate_update_perf_limits()
2568 cpu->min_perf_ratio = min_policy_perf; in intel_pstate_update_perf_limits()
2569 cpu->max_perf_ratio = max_policy_perf; in intel_pstate_update_perf_limits()
2571 int turbo_max = cpu->pstate.turbo_pstate; in intel_pstate_update_perf_limits()
2579 pr_debug("cpu:%d global_min:%d global_max:%d\n", cpu->cpu, in intel_pstate_update_perf_limits()
2582 cpu->min_perf_ratio = max(min_policy_perf, global_min); in intel_pstate_update_perf_limits()
2583 cpu->min_perf_ratio = min(cpu->min_perf_ratio, max_policy_perf); in intel_pstate_update_perf_limits()
2584 cpu->max_perf_ratio = min(max_policy_perf, global_max); in intel_pstate_update_perf_limits()
2585 cpu->max_perf_ratio = max(min_policy_perf, cpu->max_perf_ratio); in intel_pstate_update_perf_limits()
2588 cpu->min_perf_ratio = min(cpu->min_perf_ratio, in intel_pstate_update_perf_limits()
2589 cpu->max_perf_ratio); in intel_pstate_update_perf_limits()
2592 pr_debug("cpu:%d max_perf_ratio:%d min_perf_ratio:%d\n", cpu->cpu, in intel_pstate_update_perf_limits()
2593 cpu->max_perf_ratio, in intel_pstate_update_perf_limits()
2594 cpu->min_perf_ratio); in intel_pstate_update_perf_limits()
2599 struct cpudata *cpu; in intel_pstate_set_policy() local
2607 cpu = all_cpu_data[policy->cpu]; in intel_pstate_set_policy()
2608 cpu->policy = policy->policy; in intel_pstate_set_policy()
2612 intel_pstate_update_perf_limits(cpu, policy->min, policy->max); in intel_pstate_set_policy()
2614 if (cpu->policy == CPUFREQ_POLICY_PERFORMANCE) { in intel_pstate_set_policy()
2619 intel_pstate_clear_update_util_hook(policy->cpu); in intel_pstate_set_policy()
2620 intel_pstate_max_within_limits(cpu); in intel_pstate_set_policy()
2622 intel_pstate_set_update_util_hook(policy->cpu); in intel_pstate_set_policy()
2632 intel_pstate_clear_update_util_hook(policy->cpu); in intel_pstate_set_policy()
2633 intel_pstate_hwp_set(policy->cpu); in intel_pstate_set_policy()
2646 static void intel_pstate_adjust_policy_max(struct cpudata *cpu, in intel_pstate_adjust_policy_max() argument
2650 cpu->pstate.max_pstate_physical > cpu->pstate.max_pstate && in intel_pstate_adjust_policy_max()
2652 policy->max > cpu->pstate.max_freq) { in intel_pstate_adjust_policy_max()
2658 static void intel_pstate_verify_cpu_policy(struct cpudata *cpu, in intel_pstate_verify_cpu_policy() argument
2665 intel_pstate_get_hwp_cap(cpu); in intel_pstate_verify_cpu_policy()
2667 cpu->pstate.max_freq : cpu->pstate.turbo_freq; in intel_pstate_verify_cpu_policy()
2669 max_freq = intel_pstate_get_max_freq(cpu); in intel_pstate_verify_cpu_policy()
2673 intel_pstate_adjust_policy_max(cpu, policy); in intel_pstate_verify_cpu_policy()
2678 intel_pstate_verify_cpu_policy(all_cpu_data[policy->cpu], policy); in intel_pstate_verify_policy()
2685 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_cpu_offline() local
2687 pr_debug("CPU %d going offline\n", cpu->cpu); in intel_cpufreq_cpu_offline()
2689 if (cpu->suspended) in intel_cpufreq_cpu_offline()
2693 * If the CPU is an SMT thread and it goes offline with the performance in intel_cpufreq_cpu_offline()
2696 * performance on CPU offline to prevent that from happening. in intel_cpufreq_cpu_offline()
2699 intel_pstate_hwp_offline(cpu); in intel_cpufreq_cpu_offline()
2701 intel_pstate_set_min_pstate(cpu); in intel_cpufreq_cpu_offline()
2710 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_pstate_cpu_online() local
2712 pr_debug("CPU %d going online\n", cpu->cpu); in intel_pstate_cpu_online()
2721 intel_pstate_hwp_reenable(cpu); in intel_pstate_cpu_online()
2722 cpu->suspended = false; in intel_pstate_cpu_online()
2730 intel_pstate_clear_update_util_hook(policy->cpu); in intel_pstate_cpu_offline()
2737 pr_debug("CPU %d exiting\n", policy->cpu); in intel_pstate_cpu_exit()
2746 struct cpudata *cpu; in __intel_pstate_cpu_init() local
2749 rc = intel_pstate_init_cpu(policy->cpu); in __intel_pstate_cpu_init()
2753 cpu = all_cpu_data[policy->cpu]; in __intel_pstate_cpu_init()
2755 cpu->max_perf_ratio = 0xFF; in __intel_pstate_cpu_init()
2756 cpu->min_perf_ratio = 0; in __intel_pstate_cpu_init()
2759 policy->cpuinfo.min_freq = cpu->pstate.min_freq; in __intel_pstate_cpu_init()
2763 cpu->pstate.max_freq : cpu->pstate.turbo_freq; in __intel_pstate_cpu_init()
2789 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_pstate_cpu_init() local
2791 cpu->epp_cached = intel_pstate_get_epp(cpu, 0); in intel_pstate_cpu_init()
2813 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_verify_policy() local
2815 intel_pstate_verify_cpu_policy(cpu, policy); in intel_cpufreq_verify_policy()
2816 intel_pstate_update_perf_limits(cpu, policy->min, policy->max); in intel_cpufreq_verify_policy()
2837 static void intel_cpufreq_trace(struct cpudata *cpu, unsigned int trace_type, int old_pstate) in intel_cpufreq_trace() argument
2844 if (!intel_pstate_sample(cpu, ktime_get())) in intel_cpufreq_trace()
2847 sample = &cpu->sample; in intel_cpufreq_trace()
2851 cpu->pstate.current_pstate, in intel_cpufreq_trace()
2855 get_avg_frequency(cpu), in intel_cpufreq_trace()
2856 fp_toint(cpu->iowait_boost * 100)); in intel_cpufreq_trace()
2859 static void intel_cpufreq_hwp_update(struct cpudata *cpu, u32 min, u32 max, in intel_cpufreq_hwp_update() argument
2862 u64 prev = READ_ONCE(cpu->hwp_req_cached), value = prev; in intel_cpufreq_hwp_update()
2876 WRITE_ONCE(cpu->hwp_req_cached, value); in intel_cpufreq_hwp_update()
2880 wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); in intel_cpufreq_hwp_update()
2883 static void intel_cpufreq_perf_ctl_update(struct cpudata *cpu, in intel_cpufreq_perf_ctl_update() argument
2888 pstate_funcs.get_val(cpu, target_pstate)); in intel_cpufreq_perf_ctl_update()
2890 wrmsrl_on_cpu(cpu->cpu, MSR_IA32_PERF_CTL, in intel_cpufreq_perf_ctl_update()
2891 pstate_funcs.get_val(cpu, target_pstate)); in intel_cpufreq_perf_ctl_update()
2897 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_update_pstate() local
2898 int old_pstate = cpu->pstate.current_pstate; in intel_cpufreq_update_pstate()
2900 target_pstate = intel_pstate_prepare_request(cpu, target_pstate); in intel_cpufreq_update_pstate()
2903 target_pstate : cpu->max_perf_ratio; in intel_cpufreq_update_pstate()
2905 intel_cpufreq_hwp_update(cpu, target_pstate, max_pstate, 0, in intel_cpufreq_update_pstate()
2908 intel_cpufreq_perf_ctl_update(cpu, target_pstate, fast_switch); in intel_cpufreq_update_pstate()
2911 cpu->pstate.current_pstate = target_pstate; in intel_cpufreq_update_pstate()
2913 intel_cpufreq_trace(cpu, fast_switch ? INTEL_PSTATE_TRACE_FAST_SWITCH : in intel_cpufreq_update_pstate()
2923 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_target() local
2934 target_pstate = intel_pstate_freq_to_hwp_rel(cpu, freqs.new, relation); in intel_cpufreq_target()
2937 freqs.new = target_pstate * cpu->pstate.scaling; in intel_cpufreq_target()
2947 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_fast_switch() local
2952 target_pstate = intel_pstate_freq_to_hwp(cpu, target_freq); in intel_cpufreq_fast_switch()
2956 return target_pstate * cpu->pstate.scaling; in intel_cpufreq_fast_switch()
2964 struct cpudata *cpu = all_cpu_data[cpunum]; in intel_cpufreq_adjust_perf() local
2965 u64 hwp_cap = READ_ONCE(cpu->hwp_cap_cached); in intel_cpufreq_adjust_perf()
2966 int old_pstate = cpu->pstate.current_pstate; in intel_cpufreq_adjust_perf()
2983 if (min_pstate < cpu->pstate.min_pstate) in intel_cpufreq_adjust_perf()
2984 min_pstate = cpu->pstate.min_pstate; in intel_cpufreq_adjust_perf()
2986 if (min_pstate < cpu->min_perf_ratio) in intel_cpufreq_adjust_perf()
2987 min_pstate = cpu->min_perf_ratio; in intel_cpufreq_adjust_perf()
2989 if (min_pstate > cpu->max_perf_ratio) in intel_cpufreq_adjust_perf()
2990 min_pstate = cpu->max_perf_ratio; in intel_cpufreq_adjust_perf()
2992 max_pstate = min(cap_pstate, cpu->max_perf_ratio); in intel_cpufreq_adjust_perf()
2998 intel_cpufreq_hwp_update(cpu, min_pstate, max_pstate, target_pstate, true); in intel_cpufreq_adjust_perf()
3000 cpu->pstate.current_pstate = target_pstate; in intel_cpufreq_adjust_perf()
3001 intel_cpufreq_trace(cpu, INTEL_PSTATE_TRACE_FAST_SWITCH, old_pstate); in intel_cpufreq_adjust_perf()
3007 struct cpudata *cpu; in intel_cpufreq_cpu_init() local
3011 dev = get_cpu_device(policy->cpu); in intel_cpufreq_cpu_init()
3029 cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_cpu_init()
3036 intel_pstate_get_hwp_cap(cpu); in intel_cpufreq_cpu_init()
3038 rdmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, &value); in intel_cpufreq_cpu_init()
3039 WRITE_ONCE(cpu->hwp_req_cached, value); in intel_cpufreq_cpu_init()
3041 cpu->epp_cached = intel_pstate_get_epp(cpu, value); in intel_cpufreq_cpu_init()
3046 freq = DIV_ROUND_UP(cpu->pstate.turbo_freq * global.min_perf_pct, 100); in intel_cpufreq_cpu_init()
3055 freq = DIV_ROUND_UP(cpu->pstate.turbo_freq * global.max_perf_pct, 100); in intel_cpufreq_cpu_init()
3096 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_suspend() local
3097 u64 value = READ_ONCE(cpu->hwp_req_cached); in intel_cpufreq_suspend()
3105 wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); in intel_cpufreq_suspend()
3106 WRITE_ONCE(cpu->hwp_req_cached, value); in intel_cpufreq_suspend()
3131 unsigned int cpu; in intel_pstate_driver_cleanup() local
3134 for_each_online_cpu(cpu) { in intel_pstate_driver_cleanup()
3135 if (all_cpu_data[cpu]) { in intel_pstate_driver_cleanup()
3137 intel_pstate_clear_update_util_hook(cpu); in intel_pstate_driver_cleanup()
3140 kfree(all_cpu_data[cpu]); in intel_pstate_driver_cleanup()
3141 WRITE_ONCE(all_cpu_data[cpu], NULL); in intel_pstate_driver_cleanup()
3468 pr_info("CPU model not supported\n"); in intel_pstate_init()