Lines Matching +full:min +full:- +full:sample +full:- +full:time

1 // SPDX-License-Identifier: GPL-2.0-only
38 #include <asm/intel-family.h>
56 #define ONE_EIGHTH_FP ((int64_t)1 << (FRAC_BITS - 3))
78 mask = (1 << FRAC_BITS) - 1; in ceiling_fp()
95 * struct sample - Store performance sample
97 * performance during last sample period
102 * read from APERF MSR between last and current sample
104 * read from MPERF MSR between last and current sample
105 * @tsc: Difference of time stamp counter between last and
106 * current sample
107 * @time: Current time from scheduler
109 * This structure is used in the cpudata structure to store performance sample
112 struct sample { struct
118 u64 time; member
122 * struct pstate_data - Store P state data
124 * @min_pstate: Min P state possible for this platform
129 * @perf_ctl_scaling: PERF_CTL P-state to frequency scaling factor
152 * struct vid_data - Stores voltage information data
153 * @min: VID data for this platform corresponding to
157 * @ratio: Ratio of (vid max - vid min) /
158 * (max P state - Min P State)
165 int min; member
172 * struct global_params - Global parameters, mostly tunable via sysfs.
173 * @no_turbo: Whether or not to use turbo P-states.
174 * @turbo_disabled: Whether or not turbo P-states are available at all,
176 * not the maximum reported turbo P-state is different from
177 * the maximum reported non-turbo one.
179 * P-state capacity.
181 * P-state capacity.
191 * struct cpudata - Per CPU instance data storage
196 * @iowait_boost: iowait-related boost fraction
197 * @last_update: Time of the last update.
200 * @last_sample_time: Last Sample time
205 * @sample: Storage for storing last Sample data
216 * @epp_cached: Cached HWP energy-performance preference value
219 * @last_io_update: Last time when IO wake flag was set
222 * @hwp_boost_min: Last HWP boosted min performance
244 struct sample sample; member
269 * struct pstate_funcs - Per CPU model specific callbacks
372 cppc_perf.highest_perf = HWP_HIGHEST_PERF(READ_ONCE(all_cpu_data[cpu]->hwp_cap_cached)); in intel_pstate_set_itmt_prio()
377 * update them at any time after it has been called. in intel_pstate_set_itmt_prio()
420 * Compute the perf-to-frequency scaling factor for the given CPU if in intel_pstate_cppc_get_scaling()
444 intel_pstate_set_itmt_prio(policy->cpu); in intel_pstate_init_acpi_perf_limits()
451 cpu = all_cpu_data[policy->cpu]; in intel_pstate_init_acpi_perf_limits()
453 ret = acpi_processor_register_performance(&cpu->acpi_perf_data, in intel_pstate_init_acpi_perf_limits()
454 policy->cpu); in intel_pstate_init_acpi_perf_limits()
463 if (cpu->acpi_perf_data.control_register.space_id != in intel_pstate_init_acpi_perf_limits()
471 if (cpu->acpi_perf_data.state_count < 2) in intel_pstate_init_acpi_perf_limits()
474 pr_debug("CPU%u - ACPI _PSS perf data\n", policy->cpu); in intel_pstate_init_acpi_perf_limits()
475 for (i = 0; i < cpu->acpi_perf_data.state_count; i++) { in intel_pstate_init_acpi_perf_limits()
477 (i == cpu->acpi_perf_data.state ? '*' : ' '), i, in intel_pstate_init_acpi_perf_limits()
478 (u32) cpu->acpi_perf_data.states[i].core_frequency, in intel_pstate_init_acpi_perf_limits()
479 (u32) cpu->acpi_perf_data.states[i].power, in intel_pstate_init_acpi_perf_limits()
480 (u32) cpu->acpi_perf_data.states[i].control); in intel_pstate_init_acpi_perf_limits()
483 cpu->valid_pss_table = true; in intel_pstate_init_acpi_perf_limits()
489 cpu->valid_pss_table = false; in intel_pstate_init_acpi_perf_limits()
490 acpi_processor_unregister_performance(policy->cpu); in intel_pstate_init_acpi_perf_limits()
497 cpu = all_cpu_data[policy->cpu]; in intel_pstate_exit_perf_limits()
498 if (!cpu->valid_pss_table) in intel_pstate_exit_perf_limits()
501 acpi_processor_unregister_performance(policy->cpu); in intel_pstate_exit_perf_limits()
521 return -ENOTSUPP; in intel_pstate_get_cppc_guaranteed()
533 if (freq == cpu->pstate.turbo_freq) in intel_pstate_freq_to_hwp_rel()
534 return cpu->pstate.turbo_pstate; in intel_pstate_freq_to_hwp_rel()
536 if (freq == cpu->pstate.max_freq) in intel_pstate_freq_to_hwp_rel()
537 return cpu->pstate.max_pstate; in intel_pstate_freq_to_hwp_rel()
541 return freq / cpu->pstate.scaling; in intel_pstate_freq_to_hwp_rel()
543 return DIV_ROUND_CLOSEST(freq, cpu->pstate.scaling); in intel_pstate_freq_to_hwp_rel()
546 return DIV_ROUND_UP(freq, cpu->pstate.scaling); in intel_pstate_freq_to_hwp_rel()
555 * intel_pstate_hybrid_hwp_adjust - Calibrate HWP performance levels.
559 * P-states accessible through the PERF_CTL interface. If that happens, the
561 * than the scaling factor between P-state values and CPU frequency.
567 int perf_ctl_max_phys = cpu->pstate.max_pstate_physical; in intel_pstate_hybrid_hwp_adjust()
568 int perf_ctl_scaling = cpu->pstate.perf_ctl_scaling; in intel_pstate_hybrid_hwp_adjust()
569 int perf_ctl_turbo = pstate_funcs.get_turbo(cpu->cpu); in intel_pstate_hybrid_hwp_adjust()
570 int scaling = cpu->pstate.scaling; in intel_pstate_hybrid_hwp_adjust()
573 pr_debug("CPU%d: perf_ctl_max_phys = %d\n", cpu->cpu, perf_ctl_max_phys); in intel_pstate_hybrid_hwp_adjust()
574 pr_debug("CPU%d: perf_ctl_turbo = %d\n", cpu->cpu, perf_ctl_turbo); in intel_pstate_hybrid_hwp_adjust()
575 pr_debug("CPU%d: perf_ctl_scaling = %d\n", cpu->cpu, perf_ctl_scaling); in intel_pstate_hybrid_hwp_adjust()
576 pr_debug("CPU%d: HWP_CAP guaranteed = %d\n", cpu->cpu, cpu->pstate.max_pstate); in intel_pstate_hybrid_hwp_adjust()
577 pr_debug("CPU%d: HWP_CAP highest = %d\n", cpu->cpu, cpu->pstate.turbo_pstate); in intel_pstate_hybrid_hwp_adjust()
578 pr_debug("CPU%d: HWP-to-frequency scaling factor: %d\n", cpu->cpu, scaling); in intel_pstate_hybrid_hwp_adjust()
580 cpu->pstate.turbo_freq = rounddown(cpu->pstate.turbo_pstate * scaling, in intel_pstate_hybrid_hwp_adjust()
582 cpu->pstate.max_freq = rounddown(cpu->pstate.max_pstate * scaling, in intel_pstate_hybrid_hwp_adjust()
586 cpu->pstate.max_pstate_physical = intel_pstate_freq_to_hwp(cpu, freq); in intel_pstate_hybrid_hwp_adjust()
588 freq = cpu->pstate.min_pstate * perf_ctl_scaling; in intel_pstate_hybrid_hwp_adjust()
589 cpu->pstate.min_freq = freq; in intel_pstate_hybrid_hwp_adjust()
591 * Cast the min P-state value retrieved via pstate_funcs.get_min() to in intel_pstate_hybrid_hwp_adjust()
594 cpu->pstate.min_pstate = intel_pstate_freq_to_hwp(cpu, freq); in intel_pstate_hybrid_hwp_adjust()
609 int turbo_pstate = cpu->pstate.turbo_pstate; in min_perf_pct_min()
612 (cpu->pstate.min_pstate * 100 / turbo_pstate) : 0; in min_perf_pct_min()
621 return -ENXIO; in intel_pstate_get_epb()
623 ret = rdmsrl_on_cpu(cpu_data->cpu, MSR_IA32_ENERGY_PERF_BIAS, &epb); in intel_pstate_get_epb()
640 epp = rdmsrl_on_cpu(cpu_data->cpu, MSR_HWP_REQUEST, in intel_pstate_get_epp()
660 return -ENXIO; in intel_pstate_set_epb()
676 *-------------------------------------
711 int index = -EINVAL; in intel_pstate_get_energy_pref_index()
732 * 0x00-0x03 : Performance in intel_pstate_get_energy_pref_index()
733 * 0x04-0x07 : Balance performance in intel_pstate_get_energy_pref_index()
734 * 0x08-0x0B : Balance power in intel_pstate_get_energy_pref_index()
735 * 0x0C-0x0F : Power in intel_pstate_get_energy_pref_index()
753 * intel_pstate_hwp_boost_down() at any time. in intel_pstate_set_epp()
755 u64 value = READ_ONCE(cpu->hwp_req_cached); in intel_pstate_set_epp()
764 WRITE_ONCE(cpu->hwp_req_cached, value); in intel_pstate_set_epp()
765 ret = wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); in intel_pstate_set_epp()
767 cpu->epp_cached = epp; in intel_pstate_set_epp()
776 int epp = -EINVAL; in intel_pstate_set_energy_pref_index()
780 epp = cpu_data->epp_default; in intel_pstate_set_energy_pref_index()
785 else if (epp == -EINVAL) in intel_pstate_set_energy_pref_index()
793 if (epp > 0 && cpu_data->policy == CPUFREQ_POLICY_PERFORMANCE) in intel_pstate_set_energy_pref_index()
794 return -EBUSY; in intel_pstate_set_energy_pref_index()
798 if (epp == -EINVAL) in intel_pstate_set_energy_pref_index()
799 epp = (pref_index - 1) << 2; in intel_pstate_set_energy_pref_index()
800 ret = intel_pstate_set_epb(cpu_data->cpu, epp); in intel_pstate_set_energy_pref_index()
827 struct cpudata *cpu = all_cpu_data[policy->cpu]; in store_energy_performance_preference()
835 return -EINVAL; in store_energy_performance_preference()
837 ret = match_string(energy_perf_strings, -1, str_preference); in store_energy_performance_preference()
847 return -EINVAL; in store_energy_performance_preference()
858 return -EAGAIN; in store_energy_performance_preference()
868 * which is super-heavy-weight, so make sure it is worth doing in store_energy_performance_preference()
872 epp = ret ? epp_values[ret] : cpu->epp_default; in store_energy_performance_preference()
874 if (cpu->epp_cached != epp) { in store_energy_performance_preference()
895 struct cpudata *cpu_data = all_cpu_data[policy->cpu]; in show_energy_performance_preference()
912 struct cpudata *cpu = all_cpu_data[policy->cpu]; in show_base_frequency()
915 ratio = intel_pstate_get_cppc_guaranteed(policy->cpu); in show_base_frequency()
919 rdmsrl_on_cpu(policy->cpu, MSR_HWP_CAPABILITIES, &cap); in show_base_frequency()
923 freq = ratio * cpu->pstate.scaling; in show_base_frequency()
924 if (cpu->pstate.scaling != cpu->pstate.perf_ctl_scaling) in show_base_frequency()
925 freq = rounddown(freq, cpu->pstate.perf_ctl_scaling); in show_base_frequency()
942 * and the x86 arch scale-invariance information from concurrent updates.
948 arch_set_cpu_capacity(cpu->cpu, cpu->capacity_perf, in hybrid_set_cpu_capacity()
949 hybrid_max_perf_cpu->capacity_perf, in hybrid_set_cpu_capacity()
950 cpu->capacity_perf, in hybrid_set_cpu_capacity()
951 cpu->pstate.max_pstate_physical); in hybrid_set_cpu_capacity()
953 pr_debug("CPU%d: perf = %u, max. perf = %u, base perf = %d\n", cpu->cpu, in hybrid_set_cpu_capacity()
954 cpu->capacity_perf, hybrid_max_perf_cpu->capacity_perf, in hybrid_set_cpu_capacity()
955 cpu->pstate.max_pstate_physical); in hybrid_set_cpu_capacity()
966 cpu->capacity_perf = cpu->pstate.max_pstate_physical; in hybrid_get_capacity_perf()
970 cpu->capacity_perf = HWP_HIGHEST_PERF(READ_ONCE(cpu->hwp_cap_cached)); in hybrid_get_capacity_perf()
1012 if (cpu->capacity_perf > max_cap_perf) { in hybrid_update_cpu_capacity_scaling()
1013 max_cap_perf = cpu->capacity_perf; in hybrid_update_cpu_capacity_scaling()
1085 rdmsrl_on_cpu(cpu->cpu, MSR_HWP_CAPABILITIES, &cap); in __intel_pstate_get_hwp_cap()
1086 WRITE_ONCE(cpu->hwp_cap_cached, cap); in __intel_pstate_get_hwp_cap()
1087 cpu->pstate.max_pstate = HWP_GUARANTEED_PERF(cap); in __intel_pstate_get_hwp_cap()
1088 cpu->pstate.turbo_pstate = HWP_HIGHEST_PERF(cap); in __intel_pstate_get_hwp_cap()
1093 int scaling = cpu->pstate.scaling; in intel_pstate_get_hwp_cap()
1097 cpu->pstate.max_freq = cpu->pstate.max_pstate * scaling; in intel_pstate_get_hwp_cap()
1098 cpu->pstate.turbo_freq = cpu->pstate.turbo_pstate * scaling; in intel_pstate_get_hwp_cap()
1099 if (scaling != cpu->pstate.perf_ctl_scaling) { in intel_pstate_get_hwp_cap()
1100 int perf_ctl_scaling = cpu->pstate.perf_ctl_scaling; in intel_pstate_get_hwp_cap()
1102 cpu->pstate.max_freq = rounddown(cpu->pstate.max_freq, in intel_pstate_get_hwp_cap()
1104 cpu->pstate.turbo_freq = rounddown(cpu->pstate.turbo_freq, in intel_pstate_get_hwp_cap()
1122 max_cap_perf = hybrid_max_perf_cpu->capacity_perf; in hybrid_update_capacity()
1128 if (cpu->capacity_perf > max_cap_perf) { in hybrid_update_capacity()
1135 if (cpu == hybrid_max_perf_cpu && cpu->capacity_perf < max_cap_perf) { in hybrid_update_capacity()
1149 int max, min; in intel_pstate_hwp_set() local
1153 max = cpu_data->max_perf_ratio; in intel_pstate_hwp_set()
1154 min = cpu_data->min_perf_ratio; in intel_pstate_hwp_set()
1156 if (cpu_data->policy == CPUFREQ_POLICY_PERFORMANCE) in intel_pstate_hwp_set()
1157 min = max; in intel_pstate_hwp_set()
1162 value |= HWP_MIN_PERF(min); in intel_pstate_hwp_set()
1167 if (cpu_data->epp_policy == cpu_data->policy) in intel_pstate_hwp_set()
1170 cpu_data->epp_policy = cpu_data->policy; in intel_pstate_hwp_set()
1172 if (cpu_data->policy == CPUFREQ_POLICY_PERFORMANCE) { in intel_pstate_hwp_set()
1174 cpu_data->epp_powersave = epp; in intel_pstate_hwp_set()
1182 if (cpu_data->epp_powersave < 0) in intel_pstate_hwp_set()
1188 * - Policy is not changed in intel_pstate_hwp_set()
1189 * - user has manually changed in intel_pstate_hwp_set()
1190 * - Error reading EPB in intel_pstate_hwp_set()
1196 epp = cpu_data->epp_powersave; in intel_pstate_hwp_set()
1205 WRITE_ONCE(cpu_data->hwp_req_cached, value); in intel_pstate_hwp_set()
1213 u64 value = READ_ONCE(cpu->hwp_req_cached); in intel_pstate_hwp_offline()
1225 value |= HWP_ENERGY_PERF_PREFERENCE(cpu->epp_cached); in intel_pstate_hwp_offline()
1231 cpu->epp_policy = CPUFREQ_POLICY_UNKNOWN; in intel_pstate_hwp_offline()
1240 WRITE_ONCE(cpu->hwp_req_cached, value); in intel_pstate_hwp_offline()
1243 min_perf = HWP_LOWEST_PERF(READ_ONCE(cpu->hwp_cap_cached)); in intel_pstate_hwp_offline()
1249 /* Set EPP to min */ in intel_pstate_hwp_offline()
1253 wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); in intel_pstate_hwp_offline()
1269 hybrid_clear_cpu_capacity(cpu->cpu); in intel_pstate_hwp_offline()
1299 wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, READ_ONCE(cpu->hwp_req_cached)); in intel_pstate_hwp_reenable()
1304 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_pstate_suspend()
1306 pr_debug("CPU %d suspending\n", cpu->cpu); in intel_pstate_suspend()
1308 cpu->suspended = true; in intel_pstate_suspend()
1318 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_pstate_resume()
1320 pr_debug("CPU %d resuming\n", cpu->cpu); in intel_pstate_resume()
1328 if (cpu->suspended && hwp_active) { in intel_pstate_resume()
1331 /* Re-enable HWP, because "online" has not done that. */ in intel_pstate_resume()
1337 cpu->suspended = false; in intel_pstate_resume()
1356 policy->cpuinfo.max_freq = READ_ONCE(global.no_turbo) ? in __intel_pstate_update_max_freq()
1357 cpudata->pstate.max_freq : cpudata->pstate.turbo_freq; in __intel_pstate_update_max_freq()
1437 ret = intel_pstate_update_status(buf, p ? p - buf : count); in store_status()
1454 return -EAGAIN; in show_turbo_pct()
1459 total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1; in show_turbo_pct()
1460 no_turbo = cpu->pstate.max_pstate - cpu->pstate.min_pstate + 1; in show_turbo_pct()
1462 turbo_pct = 100 - fp_toint(mul_fp(turbo_fp, int_tofp(100))); in show_turbo_pct()
1479 return -EAGAIN; in show_num_pstates()
1483 total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1; in show_num_pstates()
1499 return -EAGAIN; in show_no_turbo()
1516 return -EINVAL; in store_no_turbo()
1521 count = -EAGAIN; in store_no_turbo()
1530 count = -EPERM; in store_no_turbo()
1547 int pct = cpu->pstate.max_pstate * 100 / cpu->pstate.turbo_pstate; in store_no_turbo()
1579 req = policy->driver_data; in update_qos_request()
1595 freq = DIV_ROUND_UP(cpu->pstate.turbo_freq * perf_pct, 100); in update_qos_request()
1610 return -EINVAL; in store_max_perf_pct()
1616 return -EAGAIN; in store_max_perf_pct()
1643 return -EINVAL; in store_min_perf_pct()
1649 return -EAGAIN; in store_min_perf_pct()
1752 intel_pstate_kobject = kobject_create_and_add("intel_pstate", &dev_root->kobj); in intel_pstate_sysfs_expose_params()
1837 struct cpufreq_policy *policy = cpufreq_cpu_acquire(cpudata->cpu); in intel_pstate_notify_work()
1852 wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_STATUS, 0); in intel_pstate_notify_work()
1883 schedule_delayed_work(&all_cpu_data[this_cpu]->hwp_notify_work, in notify_hwp_interrupt()
1903 wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, 0x00); in intel_pstate_disable_hwp_interrupt()
1906 cancel_work = cpumask_test_and_clear_cpu(cpudata->cpu, &hwp_intr_enable_mask); in intel_pstate_disable_hwp_interrupt()
1910 cancel_delayed_work_sync(&cpudata->hwp_notify_work); in intel_pstate_disable_hwp_interrupt()
1923 INIT_DELAYED_WORK(&cpudata->hwp_notify_work, intel_pstate_notify_work); in intel_pstate_enable_hwp_interrupt()
1924 cpumask_set_cpu(cpudata->cpu, &hwp_intr_enable_mask); in intel_pstate_enable_hwp_interrupt()
1931 wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, interrupt_mask); in intel_pstate_enable_hwp_interrupt()
1932 wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_STATUS, 0); in intel_pstate_enable_hwp_interrupt()
1938 cpudata->epp_default = intel_pstate_get_epp(cpudata, 0); in intel_pstate_update_epp_defaults()
1942 * - Is equal or less than 0x80 (default balance_perf EPP) in intel_pstate_update_epp_defaults()
1943 * - But less performance oriented than performance EPP in intel_pstate_update_epp_defaults()
1946 if (hwp_forced && cpudata->epp_default <= HWP_EPP_BALANCE_PERFORMANCE && in intel_pstate_update_epp_defaults()
1947 cpudata->epp_default > HWP_EPP_PERFORMANCE) { in intel_pstate_update_epp_defaults()
1948 epp_values[EPP_INDEX_BALANCE_PERFORMANCE] = cpudata->epp_default; in intel_pstate_update_epp_defaults()
1963 cpudata->epp_default = epp_values[EPP_INDEX_BALANCE_PERFORMANCE]; in intel_pstate_update_epp_defaults()
1964 intel_pstate_set_epp(cpudata, cpudata->epp_default); in intel_pstate_update_epp_defaults()
1971 wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, 0x00); in intel_pstate_hwp_enable()
1973 wrmsrl_on_cpu(cpudata->cpu, MSR_PM_ENABLE, 0x1); in intel_pstate_hwp_enable()
1977 if (cpudata->epp_default >= 0) in intel_pstate_hwp_enable()
2017 vid_fp = cpudata->vid.min + mul_fp( in atom_get_val()
2018 int_tofp(pstate - cpudata->pstate.min_pstate), in atom_get_val()
2019 cpudata->vid.ratio); in atom_get_val()
2021 vid_fp = clamp_t(int32_t, vid_fp, cpudata->vid.min, cpudata->vid.max); in atom_get_val()
2024 if (pstate > cpudata->pstate.max_pstate) in atom_get_val()
2025 vid = cpudata->vid.turbo; in atom_get_val()
2034 /* Defined in Table 35-6 from SDM (Sept 2015) */ in silvermont_get_scaling()
2049 /* Defined in Table 35-10 from SDM (Sept 2015) */ in airmont_get_scaling()
2066 cpudata->vid.min = int_tofp((value >> 8) & 0x7f); in atom_get_vid()
2067 cpudata->vid.max = int_tofp((value >> 16) & 0x7f); in atom_get_vid()
2068 cpudata->vid.ratio = div_fp( in atom_get_vid()
2069 cpudata->vid.max - cpudata->vid.min, in atom_get_vid()
2070 int_tofp(cpudata->pstate.max_pstate - in atom_get_vid()
2071 cpudata->pstate.min_pstate)); in atom_get_vid()
2074 cpudata->vid.turbo = value & 0x7f; in atom_get_vid()
2123 return -ENXIO; in core_get_tdp_ratio()
2152 if (tdp_ratio - 1 == tar_levels) { in core_get_max_pstate()
2218 * Return the hybrid scaling factor for P-cores and use the in hwp_get_cpu_scaling()
2219 * default core scaling for E-cores. in hwp_get_cpu_scaling()
2228 /* Use core scaling on non-hybrid systems. */ in hwp_get_cpu_scaling()
2242 trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu); in intel_pstate_set_pstate()
2243 cpu->pstate.current_pstate = pstate; in intel_pstate_set_pstate()
2249 wrmsrl_on_cpu(cpu->cpu, MSR_IA32_PERF_CTL, in intel_pstate_set_pstate()
2255 intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate); in intel_pstate_set_min_pstate()
2260 int perf_ctl_max_phys = pstate_funcs.get_max_physical(cpu->cpu); in intel_pstate_get_cpu_pstates()
2263 cpu->pstate.min_pstate = pstate_funcs.get_min(cpu->cpu); in intel_pstate_get_cpu_pstates()
2264 cpu->pstate.max_pstate_physical = perf_ctl_max_phys; in intel_pstate_get_cpu_pstates()
2265 cpu->pstate.perf_ctl_scaling = perf_ctl_scaling; in intel_pstate_get_cpu_pstates()
2271 cpu->pstate.scaling = pstate_funcs.get_cpu_scaling(cpu->cpu); in intel_pstate_get_cpu_pstates()
2272 if (cpu->pstate.scaling != perf_ctl_scaling) { in intel_pstate_get_cpu_pstates()
2277 cpu->pstate.scaling = perf_ctl_scaling; in intel_pstate_get_cpu_pstates()
2280 * If the CPU is going online for the first time and it was in intel_pstate_get_cpu_pstates()
2285 cpu->pstate.scaling = perf_ctl_scaling; in intel_pstate_get_cpu_pstates()
2286 cpu->pstate.max_pstate = pstate_funcs.get_max(cpu->cpu); in intel_pstate_get_cpu_pstates()
2287 cpu->pstate.turbo_pstate = pstate_funcs.get_turbo(cpu->cpu); in intel_pstate_get_cpu_pstates()
2290 if (cpu->pstate.scaling == perf_ctl_scaling) { in intel_pstate_get_cpu_pstates()
2291 cpu->pstate.min_freq = cpu->pstate.min_pstate * perf_ctl_scaling; in intel_pstate_get_cpu_pstates()
2292 cpu->pstate.max_freq = cpu->pstate.max_pstate * perf_ctl_scaling; in intel_pstate_get_cpu_pstates()
2293 cpu->pstate.turbo_freq = cpu->pstate.turbo_pstate * perf_ctl_scaling; in intel_pstate_get_cpu_pstates()
2297 cpu->aperf_mperf_shift = pstate_funcs.get_aperf_mperf_shift(); in intel_pstate_get_cpu_pstates()
2306 * Long hold time will keep high perf limits for long time,
2315 u64 hwp_req = READ_ONCE(cpu->hwp_req_cached); in intel_pstate_hwp_boost_up()
2316 u64 hwp_cap = READ_ONCE(cpu->hwp_cap_cached); in intel_pstate_hwp_boost_up()
2322 * Cases to consider (User changes via sysfs or boot time): in intel_pstate_hwp_boost_up()
2323 * If, P0 (Turbo max) = P1 (Guaranteed max) = min: in intel_pstate_hwp_boost_up()
2325 * If, P0 (Turbo max) > P1 (Guaranteed max) = min: in intel_pstate_hwp_boost_up()
2327 * If, P0 (Turbo max) = P1 (Guaranteed max) > min: in intel_pstate_hwp_boost_up()
2329 * (min + p1)/2 and P1. in intel_pstate_hwp_boost_up()
2330 * If, P0 (Turbo max) > P1 (Guaranteed max) > min: in intel_pstate_hwp_boost_up()
2332 * (min + p1)/2, P1 and P0. in intel_pstate_hwp_boost_up()
2335 /* If max and min are equal or already at max, nothing to boost */ in intel_pstate_hwp_boost_up()
2336 if (max_limit == min_limit || cpu->hwp_boost_min >= max_limit) in intel_pstate_hwp_boost_up()
2339 if (!cpu->hwp_boost_min) in intel_pstate_hwp_boost_up()
2340 cpu->hwp_boost_min = min_limit; in intel_pstate_hwp_boost_up()
2342 /* level at half way mark between min and guranteed */ in intel_pstate_hwp_boost_up()
2345 if (cpu->hwp_boost_min < boost_level1) in intel_pstate_hwp_boost_up()
2346 cpu->hwp_boost_min = boost_level1; in intel_pstate_hwp_boost_up()
2347 else if (cpu->hwp_boost_min < HWP_GUARANTEED_PERF(hwp_cap)) in intel_pstate_hwp_boost_up()
2348 cpu->hwp_boost_min = HWP_GUARANTEED_PERF(hwp_cap); in intel_pstate_hwp_boost_up()
2349 else if (cpu->hwp_boost_min == HWP_GUARANTEED_PERF(hwp_cap) && in intel_pstate_hwp_boost_up()
2351 cpu->hwp_boost_min = max_limit; in intel_pstate_hwp_boost_up()
2355 hwp_req = (hwp_req & ~GENMASK_ULL(7, 0)) | cpu->hwp_boost_min; in intel_pstate_hwp_boost_up()
2357 cpu->last_update = cpu->sample.time; in intel_pstate_hwp_boost_up()
2362 if (cpu->hwp_boost_min) { in intel_pstate_hwp_boost_down()
2365 /* Check if we are idle for hold time to boost down */ in intel_pstate_hwp_boost_down()
2366 expired = time_after64(cpu->sample.time, cpu->last_update + in intel_pstate_hwp_boost_down()
2369 wrmsrl(MSR_HWP_REQUEST, cpu->hwp_req_cached); in intel_pstate_hwp_boost_down()
2370 cpu->hwp_boost_min = 0; in intel_pstate_hwp_boost_down()
2373 cpu->last_update = cpu->sample.time; in intel_pstate_hwp_boost_down()
2377 u64 time) in intel_pstate_update_util_hwp_local() argument
2379 cpu->sample.time = time; in intel_pstate_update_util_hwp_local()
2381 if (cpu->sched_flags & SCHED_CPUFREQ_IOWAIT) { in intel_pstate_update_util_hwp_local()
2384 cpu->sched_flags = 0; in intel_pstate_update_util_hwp_local()
2386 * Set iowait_boost flag and update time. Since IO WAIT flag in intel_pstate_update_util_hwp_local()
2387 * is set all the time, we can't just conclude that there is in intel_pstate_update_util_hwp_local()
2392 if (time_before64(time, cpu->last_io_update + 2 * TICK_NSEC)) in intel_pstate_update_util_hwp_local()
2395 cpu->last_io_update = time; in intel_pstate_update_util_hwp_local()
2406 u64 time, unsigned int flags) in intel_pstate_update_util_hwp() argument
2410 cpu->sched_flags |= flags; in intel_pstate_update_util_hwp()
2412 if (smp_processor_id() == cpu->cpu) in intel_pstate_update_util_hwp()
2413 intel_pstate_update_util_hwp_local(cpu, time); in intel_pstate_update_util_hwp()
2418 struct sample *sample = &cpu->sample; in intel_pstate_calc_avg_perf() local
2420 sample->core_avg_perf = div_ext_fp(sample->aperf, sample->mperf); in intel_pstate_calc_avg_perf()
2423 static inline bool intel_pstate_sample(struct cpudata *cpu, u64 time) in intel_pstate_sample() argument
2433 if (cpu->prev_mperf == mperf || cpu->prev_tsc == tsc) { in intel_pstate_sample()
2439 cpu->last_sample_time = cpu->sample.time; in intel_pstate_sample()
2440 cpu->sample.time = time; in intel_pstate_sample()
2441 cpu->sample.aperf = aperf; in intel_pstate_sample()
2442 cpu->sample.mperf = mperf; in intel_pstate_sample()
2443 cpu->sample.tsc = tsc; in intel_pstate_sample()
2444 cpu->sample.aperf -= cpu->prev_aperf; in intel_pstate_sample()
2445 cpu->sample.mperf -= cpu->prev_mperf; in intel_pstate_sample()
2446 cpu->sample.tsc -= cpu->prev_tsc; in intel_pstate_sample()
2448 cpu->prev_aperf = aperf; in intel_pstate_sample()
2449 cpu->prev_mperf = mperf; in intel_pstate_sample()
2450 cpu->prev_tsc = tsc; in intel_pstate_sample()
2452 * First time this function is invoked in a given cycle, all of the in intel_pstate_sample()
2453 * previous sample data fields are equal to zero or stale and they must in intel_pstate_sample()
2455 * that sample.time will always be reset before setting the utilization in intel_pstate_sample()
2456 * update hook and make the caller skip the sample then. in intel_pstate_sample()
2458 if (cpu->last_sample_time) { in intel_pstate_sample()
2467 return mul_ext_fp(cpu->sample.core_avg_perf, cpu_khz); in get_avg_frequency()
2472 return mul_ext_fp(cpu->pstate.max_pstate_physical, in get_avg_pstate()
2473 cpu->sample.core_avg_perf); in get_avg_pstate()
2478 struct sample *sample = &cpu->sample; in get_target_pstate() local
2482 busy_frac = div_fp(sample->mperf << cpu->aperf_mperf_shift, in get_target_pstate()
2483 sample->tsc); in get_target_pstate()
2485 if (busy_frac < cpu->iowait_boost) in get_target_pstate()
2486 busy_frac = cpu->iowait_boost; in get_target_pstate()
2488 sample->busy_scaled = busy_frac * 100; in get_target_pstate()
2491 cpu->pstate.max_pstate : cpu->pstate.turbo_pstate; in get_target_pstate()
2494 if (target < cpu->pstate.min_pstate) in get_target_pstate()
2495 target = cpu->pstate.min_pstate; in get_target_pstate()
2498 * If the average P-state during the previous cycle was higher than the in get_target_pstate()
2506 target += (avg_pstate - target) >> 1; in get_target_pstate()
2513 int min_pstate = max(cpu->pstate.min_pstate, cpu->min_perf_ratio); in intel_pstate_prepare_request()
2514 int max_pstate = max(min_pstate, cpu->max_perf_ratio); in intel_pstate_prepare_request()
2521 if (pstate == cpu->pstate.current_pstate) in intel_pstate_update_pstate()
2524 cpu->pstate.current_pstate = pstate; in intel_pstate_update_pstate()
2530 int from = cpu->pstate.current_pstate; in intel_pstate_adjust_pstate()
2531 struct sample *sample; in intel_pstate_adjust_pstate() local
2536 trace_cpu_frequency(target_pstate * cpu->pstate.scaling, cpu->cpu); in intel_pstate_adjust_pstate()
2539 sample = &cpu->sample; in intel_pstate_adjust_pstate()
2540 trace_pstate_sample(mul_ext_fp(100, sample->core_avg_perf), in intel_pstate_adjust_pstate()
2541 fp_toint(sample->busy_scaled), in intel_pstate_adjust_pstate()
2543 cpu->pstate.current_pstate, in intel_pstate_adjust_pstate()
2544 sample->mperf, in intel_pstate_adjust_pstate()
2545 sample->aperf, in intel_pstate_adjust_pstate()
2546 sample->tsc, in intel_pstate_adjust_pstate()
2548 fp_toint(cpu->iowait_boost * 100)); in intel_pstate_adjust_pstate()
2551 static void intel_pstate_update_util(struct update_util_data *data, u64 time, in intel_pstate_update_util() argument
2558 if (smp_processor_id() != cpu->cpu) in intel_pstate_update_util()
2561 delta_ns = time - cpu->last_update; in intel_pstate_update_util()
2565 cpu->iowait_boost = ONE_EIGHTH_FP; in intel_pstate_update_util()
2566 } else if (cpu->iowait_boost >= ONE_EIGHTH_FP) { in intel_pstate_update_util()
2567 cpu->iowait_boost <<= 1; in intel_pstate_update_util()
2568 if (cpu->iowait_boost > int_tofp(1)) in intel_pstate_update_util()
2569 cpu->iowait_boost = int_tofp(1); in intel_pstate_update_util()
2571 cpu->iowait_boost = ONE_EIGHTH_FP; in intel_pstate_update_util()
2573 } else if (cpu->iowait_boost) { in intel_pstate_update_util()
2576 cpu->iowait_boost = 0; in intel_pstate_update_util()
2578 cpu->iowait_boost >>= 1; in intel_pstate_update_util()
2580 cpu->last_update = time; in intel_pstate_update_util()
2581 delta_ns = time - cpu->sample.time; in intel_pstate_update_util()
2585 if (intel_pstate_sample(cpu, time)) in intel_pstate_update_util()
2692 return -ENOMEM; in intel_pstate_init_cpu()
2696 cpu->cpu = cpunum; in intel_pstate_init_cpu()
2698 cpu->epp_default = -EINVAL; in intel_pstate_init_cpu()
2708 * Re-enable HWP in case this happens after a resume from ACPI in intel_pstate_init_cpu()
2715 cpu->epp_powersave = -EINVAL; in intel_pstate_init_cpu()
2716 cpu->epp_policy = CPUFREQ_POLICY_UNKNOWN; in intel_pstate_init_cpu()
2732 if (cpu->update_util_set) in intel_pstate_set_update_util_hook()
2736 cpu->sample.time = 0; in intel_pstate_set_update_util_hook()
2737 cpufreq_add_update_util_hook(cpu_num, &cpu->update_util, in intel_pstate_set_update_util_hook()
2741 cpu->update_util_set = true; in intel_pstate_set_update_util_hook()
2748 if (!cpu_data->update_util_set) in intel_pstate_clear_update_util_hook()
2752 cpu_data->update_util_set = false; in intel_pstate_clear_update_util_hook()
2759 cpu->pstate.max_freq : cpu->pstate.turbo_freq; in intel_pstate_get_max_freq()
2766 int perf_ctl_scaling = cpu->pstate.perf_ctl_scaling; in intel_pstate_update_perf_limits()
2782 if (hwp_active && cpu->pstate.scaling != perf_ctl_scaling) { in intel_pstate_update_perf_limits()
2792 cpu->cpu, min_policy_perf, max_policy_perf); in intel_pstate_update_perf_limits()
2796 cpu->min_perf_ratio = min_policy_perf; in intel_pstate_update_perf_limits()
2797 cpu->max_perf_ratio = max_policy_perf; in intel_pstate_update_perf_limits()
2799 int turbo_max = cpu->pstate.turbo_pstate; in intel_pstate_update_perf_limits()
2802 /* Global limits are in percent of the maximum turbo P-state. */ in intel_pstate_update_perf_limits()
2807 pr_debug("cpu:%d global_min:%d global_max:%d\n", cpu->cpu, in intel_pstate_update_perf_limits()
2810 cpu->min_perf_ratio = max(min_policy_perf, global_min); in intel_pstate_update_perf_limits()
2811 cpu->min_perf_ratio = min(cpu->min_perf_ratio, max_policy_perf); in intel_pstate_update_perf_limits()
2812 cpu->max_perf_ratio = min(max_policy_perf, global_max); in intel_pstate_update_perf_limits()
2813 cpu->max_perf_ratio = max(min_policy_perf, cpu->max_perf_ratio); in intel_pstate_update_perf_limits()
2816 cpu->min_perf_ratio = min(cpu->min_perf_ratio, in intel_pstate_update_perf_limits()
2817 cpu->max_perf_ratio); in intel_pstate_update_perf_limits()
2820 pr_debug("cpu:%d max_perf_ratio:%d min_perf_ratio:%d\n", cpu->cpu, in intel_pstate_update_perf_limits()
2821 cpu->max_perf_ratio, in intel_pstate_update_perf_limits()
2822 cpu->min_perf_ratio); in intel_pstate_update_perf_limits()
2829 if (!policy->cpuinfo.max_freq) in intel_pstate_set_policy()
2830 return -ENODEV; in intel_pstate_set_policy()
2832 pr_debug("set_policy cpuinfo.max %u policy->max %u\n", in intel_pstate_set_policy()
2833 policy->cpuinfo.max_freq, policy->max); in intel_pstate_set_policy()
2835 cpu = all_cpu_data[policy->cpu]; in intel_pstate_set_policy()
2836 cpu->policy = policy->policy; in intel_pstate_set_policy()
2840 intel_pstate_update_perf_limits(cpu, policy->min, policy->max); in intel_pstate_set_policy()
2842 if (cpu->policy == CPUFREQ_POLICY_PERFORMANCE) { in intel_pstate_set_policy()
2843 int pstate = max(cpu->pstate.min_pstate, cpu->max_perf_ratio); in intel_pstate_set_policy()
2849 intel_pstate_clear_update_util_hook(policy->cpu); in intel_pstate_set_policy()
2852 intel_pstate_set_update_util_hook(policy->cpu); in intel_pstate_set_policy()
2862 intel_pstate_clear_update_util_hook(policy->cpu); in intel_pstate_set_policy()
2863 intel_pstate_hwp_set(policy->cpu); in intel_pstate_set_policy()
2866 * policy->cur is never updated with the intel_pstate driver, but it in intel_pstate_set_policy()
2869 policy->cur = policy->min; in intel_pstate_set_policy()
2880 cpu->pstate.max_pstate_physical > cpu->pstate.max_pstate && in intel_pstate_adjust_policy_max()
2881 policy->max < policy->cpuinfo.max_freq && in intel_pstate_adjust_policy_max()
2882 policy->max > cpu->pstate.max_freq) { in intel_pstate_adjust_policy_max()
2883 pr_debug("policy->max > max non turbo frequency\n"); in intel_pstate_adjust_policy_max()
2884 policy->max = policy->cpuinfo.max_freq; in intel_pstate_adjust_policy_max()
2896 cpu->pstate.max_freq : cpu->pstate.turbo_freq; in intel_pstate_verify_cpu_policy()
2900 cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, max_freq); in intel_pstate_verify_cpu_policy()
2907 intel_pstate_verify_cpu_policy(all_cpu_data[policy->cpu], policy); in intel_pstate_verify_policy()
2914 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_cpu_offline()
2916 pr_debug("CPU %d going offline\n", cpu->cpu); in intel_cpufreq_cpu_offline()
2918 if (cpu->suspended) in intel_cpufreq_cpu_offline()
2939 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_pstate_cpu_online()
2941 pr_debug("CPU %d going online\n", cpu->cpu); in intel_pstate_cpu_online()
2947 * Re-enable HWP and clear the "suspended" flag to let "resume" in intel_pstate_cpu_online()
2951 cpu->suspended = false; in intel_pstate_cpu_online()
2961 intel_pstate_clear_update_util_hook(policy->cpu); in intel_pstate_cpu_offline()
2968 pr_debug("CPU %d exiting\n", policy->cpu); in intel_pstate_cpu_exit()
2970 policy->fast_switch_possible = false; in intel_pstate_cpu_exit()
2978 rc = intel_pstate_init_cpu(policy->cpu); in __intel_pstate_cpu_init()
2982 cpu = all_cpu_data[policy->cpu]; in __intel_pstate_cpu_init()
2984 cpu->max_perf_ratio = 0xFF; in __intel_pstate_cpu_init()
2985 cpu->min_perf_ratio = 0; in __intel_pstate_cpu_init()
2988 policy->cpuinfo.min_freq = cpu->pstate.min_freq; in __intel_pstate_cpu_init()
2989 policy->cpuinfo.max_freq = READ_ONCE(global.no_turbo) ? in __intel_pstate_cpu_init()
2990 cpu->pstate.max_freq : cpu->pstate.turbo_freq; in __intel_pstate_cpu_init()
2992 policy->min = policy->cpuinfo.min_freq; in __intel_pstate_cpu_init()
2993 policy->max = policy->cpuinfo.max_freq; in __intel_pstate_cpu_init()
2997 policy->fast_switch_possible = true; in __intel_pstate_cpu_init()
3013 policy->policy = CPUFREQ_POLICY_POWERSAVE; in intel_pstate_cpu_init()
3016 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_pstate_cpu_init()
3018 cpu->epp_cached = intel_pstate_get_epp(cpu, 0); in intel_pstate_cpu_init()
3040 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_verify_policy()
3043 intel_pstate_update_perf_limits(cpu, policy->min, policy->max); in intel_cpufreq_verify_policy()
3052 * core_avg_perf) is not needed and so is re-assigned to indicate if the
3055 * (or performance or core_avg_perf) have a fixed y-axis from 0 to 100%,
3066 struct sample *sample; in intel_cpufreq_trace() local
3074 sample = &cpu->sample; in intel_cpufreq_trace()
3078 cpu->pstate.current_pstate, in intel_cpufreq_trace()
3079 sample->mperf, in intel_cpufreq_trace()
3080 sample->aperf, in intel_cpufreq_trace()
3081 sample->tsc, in intel_cpufreq_trace()
3083 fp_toint(cpu->iowait_boost * 100)); in intel_cpufreq_trace()
3086 static void intel_cpufreq_hwp_update(struct cpudata *cpu, u32 min, u32 max, in intel_cpufreq_hwp_update() argument
3089 u64 prev = READ_ONCE(cpu->hwp_req_cached), value = prev; in intel_cpufreq_hwp_update()
3092 value |= HWP_MIN_PERF(min); in intel_cpufreq_hwp_update()
3103 WRITE_ONCE(cpu->hwp_req_cached, value); in intel_cpufreq_hwp_update()
3107 wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); in intel_cpufreq_hwp_update()
3117 wrmsrl_on_cpu(cpu->cpu, MSR_IA32_PERF_CTL, in intel_cpufreq_perf_ctl_update()
3124 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_update_pstate()
3125 int old_pstate = cpu->pstate.current_pstate; in intel_cpufreq_update_pstate()
3129 int max_pstate = policy->strict_target ? in intel_cpufreq_update_pstate()
3130 target_pstate : cpu->max_perf_ratio; in intel_cpufreq_update_pstate()
3138 cpu->pstate.current_pstate = target_pstate; in intel_cpufreq_update_pstate()
3150 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_target()
3154 freqs.old = policy->cur; in intel_cpufreq_target()
3162 freqs.new = target_pstate * cpu->pstate.scaling; in intel_cpufreq_target()
3172 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_fast_switch()
3179 return target_pstate * cpu->pstate.scaling; in intel_cpufreq_fast_switch()
3188 u64 hwp_cap = READ_ONCE(cpu->hwp_cap_cached); in intel_cpufreq_adjust_perf()
3189 int old_pstate = cpu->pstate.current_pstate; in intel_cpufreq_adjust_perf()
3206 if (min_pstate < cpu->pstate.min_pstate) in intel_cpufreq_adjust_perf()
3207 min_pstate = cpu->pstate.min_pstate; in intel_cpufreq_adjust_perf()
3209 if (min_pstate < cpu->min_perf_ratio) in intel_cpufreq_adjust_perf()
3210 min_pstate = cpu->min_perf_ratio; in intel_cpufreq_adjust_perf()
3212 if (min_pstate > cpu->max_perf_ratio) in intel_cpufreq_adjust_perf()
3213 min_pstate = cpu->max_perf_ratio; in intel_cpufreq_adjust_perf()
3215 max_pstate = min(cap_pstate, cpu->max_perf_ratio); in intel_cpufreq_adjust_perf()
3223 cpu->pstate.current_pstate = target_pstate; in intel_cpufreq_adjust_perf()
3234 dev = get_cpu_device(policy->cpu); in intel_cpufreq_cpu_init()
3236 return -ENODEV; in intel_cpufreq_cpu_init()
3242 policy->cpuinfo.transition_latency = INTEL_CPUFREQ_TRANSITION_LATENCY; in intel_cpufreq_cpu_init()
3244 policy->cur = policy->cpuinfo.min_freq; in intel_cpufreq_cpu_init()
3248 ret = -ENOMEM; in intel_cpufreq_cpu_init()
3252 cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_cpu_init()
3257 policy->transition_delay_us = INTEL_CPUFREQ_TRANSITION_DELAY_HWP; in intel_cpufreq_cpu_init()
3261 rdmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, &value); in intel_cpufreq_cpu_init()
3262 WRITE_ONCE(cpu->hwp_req_cached, value); in intel_cpufreq_cpu_init()
3264 cpu->epp_cached = intel_pstate_get_epp(cpu, value); in intel_cpufreq_cpu_init()
3266 policy->transition_delay_us = INTEL_CPUFREQ_TRANSITION_DELAY; in intel_cpufreq_cpu_init()
3269 freq = DIV_ROUND_UP(cpu->pstate.turbo_freq * global.min_perf_pct, 100); in intel_cpufreq_cpu_init()
3271 ret = freq_qos_add_request(&policy->constraints, req, FREQ_QOS_MIN, in intel_cpufreq_cpu_init()
3274 dev_err(dev, "Failed to add min-freq constraint (%d)\n", ret); in intel_cpufreq_cpu_init()
3278 freq = DIV_ROUND_UP(cpu->pstate.turbo_freq * global.max_perf_pct, 100); in intel_cpufreq_cpu_init()
3280 ret = freq_qos_add_request(&policy->constraints, req + 1, FREQ_QOS_MAX, in intel_cpufreq_cpu_init()
3283 dev_err(dev, "Failed to add max-freq constraint (%d)\n", ret); in intel_cpufreq_cpu_init()
3287 policy->driver_data = req; in intel_cpufreq_cpu_init()
3305 req = policy->driver_data; in intel_cpufreq_cpu_exit()
3319 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_suspend()
3320 u64 value = READ_ONCE(cpu->hwp_req_cached); in intel_cpufreq_suspend()
3328 wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); in intel_cpufreq_suspend()
3329 WRITE_ONCE(cpu->hwp_req_cached, value); in intel_cpufreq_suspend()
3415 return -EINVAL; in intel_pstate_update_status()
3418 return -EBUSY; in intel_pstate_update_status()
3448 return -EINVAL; in intel_pstate_update_status()
3461 return -ENODEV; in intel_pstate_msrs_not_valid()
3468 pstate_funcs.get_max = funcs->get_max; in copy_cpu_funcs()
3469 pstate_funcs.get_max_physical = funcs->get_max_physical; in copy_cpu_funcs()
3470 pstate_funcs.get_min = funcs->get_min; in copy_cpu_funcs()
3471 pstate_funcs.get_turbo = funcs->get_turbo; in copy_cpu_funcs()
3472 pstate_funcs.get_scaling = funcs->get_scaling; in copy_cpu_funcs()
3473 pstate_funcs.get_val = funcs->get_val; in copy_cpu_funcs()
3474 pstate_funcs.get_vid = funcs->get_vid; in copy_cpu_funcs()
3475 pstate_funcs.get_aperf_mperf_shift = funcs->get_aperf_mperf_shift; in copy_cpu_funcs()
3493 status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); in intel_pstate_no_acpi_pss()
3498 if (pss && pss->type == ACPI_TYPE_PACKAGE) { in intel_pstate_no_acpi_pss()
3536 if (acpi_has_method(pr->handle, "_PPC")) in intel_pstate_has_acpi_ppc()
3548 /* Hardware vendor-specific info that has its own power management modes */
3551 {"ORACLE", "X4-2 ", 0, ACPI_SIG_FADT, all_versions, NULL, PPC},
3552 {"ORACLE", "X4-2L ", 0, ACPI_SIG_FADT, all_versions, NULL, PPC},
3553 {"ORACLE", "X4-2B ", 0, ACPI_SIG_FADT, all_versions, NULL, PPC},
3554 {"ORACLE", "X3-2 ", 0, ACPI_SIG_FADT, all_versions, NULL, PPC},
3555 {"ORACLE", "X3-2L ", 0, ACPI_SIG_FADT, all_versions, NULL, PPC},
3556 {"ORACLE", "X3-2B ", 0, ACPI_SIG_FADT, all_versions, NULL, PPC},
3563 {"ORACLE", "X6-2 ", 0, ACPI_SIG_FADT, all_versions, NULL, PPC},
3606 * It may be unsafe to request P-states control from SMM if _PPC support in intel_pstate_request_control_from_smm()
3689 return -ENODEV; in intel_pstate_init()
3698 return -ENODEV; in intel_pstate_init()
3711 hwp_mode_bdw = id->driver_data; in intel_pstate_init()
3726 return -ENODEV; in intel_pstate_init()
3731 return -ENODEV; in intel_pstate_init()
3734 copy_cpu_funcs((struct pstate_funcs *)id->driver_data); in intel_pstate_init()
3739 return -ENODEV; in intel_pstate_init()
3751 pr_info("P-states controlled by the platform\n"); in intel_pstate_init()
3752 return -ENODEV; in intel_pstate_init()
3756 return -ENOTSUPP; in intel_pstate_init()
3758 pr_info("Intel P-state driver initializing\n"); in intel_pstate_init()
3762 return -ENOMEM; in intel_pstate_init()
3776 FIELD_GET(POWERSAVE_MASK, id->driver_data); in intel_pstate_init()
3778 FIELD_GET(BALANCE_POWER_MASK, id->driver_data); in intel_pstate_init()
3780 FIELD_GET(BALANCE_PERFORMANCE_MASK, id->driver_data); in intel_pstate_init()
3782 FIELD_GET(PERFORMANCE_MASK, id->driver_data); in intel_pstate_init()
3791 hybrid_scaling_factor = hybrid_id->driver_data; in intel_pstate_init()
3826 return -EINVAL; in intel_pstate_setup()
3855 MODULE_DESCRIPTION("'intel_pstate' - P state driver Intel Core processors");