Lines Matching refs:cpu
233 int cpu; member
341 static void intel_pstate_set_itmt_prio(int cpu) in intel_pstate_set_itmt_prio() argument
347 ret = cppc_get_perf_caps(cpu, &cppc_perf); in intel_pstate_set_itmt_prio()
356 sched_set_itmt_core_prio(cppc_perf.highest_perf, cpu); in intel_pstate_set_itmt_prio()
377 static void intel_pstate_set_itmt_prio(int cpu) in intel_pstate_set_itmt_prio() argument
384 struct cpudata *cpu; in intel_pstate_init_acpi_perf_limits() local
389 intel_pstate_set_itmt_prio(policy->cpu); in intel_pstate_init_acpi_perf_limits()
396 cpu = all_cpu_data[policy->cpu]; in intel_pstate_init_acpi_perf_limits()
398 ret = acpi_processor_register_performance(&cpu->acpi_perf_data, in intel_pstate_init_acpi_perf_limits()
399 policy->cpu); in intel_pstate_init_acpi_perf_limits()
408 if (cpu->acpi_perf_data.control_register.space_id != in intel_pstate_init_acpi_perf_limits()
416 if (cpu->acpi_perf_data.state_count < 2) in intel_pstate_init_acpi_perf_limits()
419 pr_debug("CPU%u - ACPI _PSS perf data\n", policy->cpu); in intel_pstate_init_acpi_perf_limits()
420 for (i = 0; i < cpu->acpi_perf_data.state_count; i++) { in intel_pstate_init_acpi_perf_limits()
422 (i == cpu->acpi_perf_data.state ? '*' : ' '), i, in intel_pstate_init_acpi_perf_limits()
423 (u32) cpu->acpi_perf_data.states[i].core_frequency, in intel_pstate_init_acpi_perf_limits()
424 (u32) cpu->acpi_perf_data.states[i].power, in intel_pstate_init_acpi_perf_limits()
425 (u32) cpu->acpi_perf_data.states[i].control); in intel_pstate_init_acpi_perf_limits()
440 cpu->acpi_perf_data.states[0].core_frequency = in intel_pstate_init_acpi_perf_limits()
442 cpu->valid_pss_table = true; in intel_pstate_init_acpi_perf_limits()
448 cpu->valid_pss_table = false; in intel_pstate_init_acpi_perf_limits()
449 acpi_processor_unregister_performance(policy->cpu); in intel_pstate_init_acpi_perf_limits()
454 struct cpudata *cpu; in intel_pstate_exit_perf_limits() local
456 cpu = all_cpu_data[policy->cpu]; in intel_pstate_exit_perf_limits()
457 if (!cpu->valid_pss_table) in intel_pstate_exit_perf_limits()
460 acpi_processor_unregister_performance(policy->cpu); in intel_pstate_exit_perf_limits()
480 struct cpudata *cpu; in update_turbo_state() local
482 cpu = all_cpu_data[0]; in update_turbo_state()
486 cpu->pstate.max_pstate == cpu->pstate.turbo_pstate); in update_turbo_state()
491 struct cpudata *cpu = all_cpu_data[0]; in min_perf_pct_min() local
492 int turbo_pstate = cpu->pstate.turbo_pstate; in min_perf_pct_min()
495 (cpu->pstate.min_pstate * 100 / turbo_pstate) : 0; in min_perf_pct_min()
506 ret = rdmsrl_on_cpu(cpu_data->cpu, MSR_IA32_ENERGY_PERF_BIAS, &epb); in intel_pstate_get_epb()
523 epp = rdmsrl_on_cpu(cpu_data->cpu, MSR_HWP_REQUEST, in intel_pstate_get_epp()
537 static int intel_pstate_set_epb(int cpu, s16 pref) in intel_pstate_set_epb() argument
545 ret = rdmsrl_on_cpu(cpu, MSR_IA32_ENERGY_PERF_BIAS, &epb); in intel_pstate_set_epb()
550 wrmsrl_on_cpu(cpu, MSR_IA32_ENERGY_PERF_BIAS, epb); in intel_pstate_set_epb()
630 ret = rdmsrl_on_cpu(cpu_data->cpu, MSR_HWP_REQUEST, &value); in intel_pstate_set_energy_pref_index()
640 ret = wrmsrl_on_cpu(cpu_data->cpu, MSR_HWP_REQUEST, value); in intel_pstate_set_energy_pref_index()
644 ret = intel_pstate_set_epb(cpu_data->cpu, epp); in intel_pstate_set_energy_pref_index()
671 struct cpudata *cpu_data = all_cpu_data[policy->cpu]; in store_energy_performance_preference()
690 struct cpudata *cpu_data = all_cpu_data[policy->cpu]; in show_energy_performance_preference()
708 static void intel_pstate_get_hwp_max(unsigned int cpu, int *phy_max, in intel_pstate_get_hwp_max() argument
713 rdmsrl_on_cpu(cpu, MSR_HWP_CAPABILITIES, &cap); in intel_pstate_get_hwp_max()
714 WRITE_ONCE(all_cpu_data[cpu]->hwp_cap_cached, cap); in intel_pstate_get_hwp_max()
723 static void intel_pstate_hwp_set(unsigned int cpu) in intel_pstate_hwp_set() argument
725 struct cpudata *cpu_data = all_cpu_data[cpu]; in intel_pstate_hwp_set()
736 rdmsrl_on_cpu(cpu, MSR_HWP_REQUEST, &value); in intel_pstate_hwp_set()
786 intel_pstate_set_epb(cpu, epp); in intel_pstate_hwp_set()
790 wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value); in intel_pstate_hwp_set()
795 struct cpudata *cpu_data = all_cpu_data[policy->cpu]; in intel_pstate_hwp_save_state()
814 if (policy->cpu == 0) in intel_pstate_resume()
815 intel_pstate_hwp_enable(all_cpu_data[policy->cpu]); in intel_pstate_resume()
817 all_cpu_data[policy->cpu]->epp_policy = 0; in intel_pstate_resume()
818 intel_pstate_hwp_set(policy->cpu); in intel_pstate_resume()
827 int cpu; in intel_pstate_update_policies() local
829 for_each_possible_cpu(cpu) in intel_pstate_update_policies()
830 cpufreq_update_policy(cpu); in intel_pstate_update_policies()
872 struct cpudata *cpu; in show_turbo_pct() local
883 cpu = all_cpu_data[0]; in show_turbo_pct()
885 total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1; in show_turbo_pct()
886 no_turbo = cpu->pstate.max_pstate - cpu->pstate.min_pstate + 1; in show_turbo_pct()
898 struct cpudata *cpu; in show_num_pstates() local
908 cpu = all_cpu_data[0]; in show_num_pstates()
909 total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1; in show_num_pstates()
969 struct cpudata *cpu = all_cpu_data[0]; in store_no_turbo() local
970 int pct = cpu->pstate.max_pstate * 100 / cpu->pstate.turbo_pstate; in store_no_turbo()
1133 wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, 0x00); in intel_pstate_hwp_enable()
1135 wrmsrl_on_cpu(cpudata->cpu, MSR_PM_ENABLE, 0x1); in intel_pstate_hwp_enable()
1144 static void intel_pstate_disable_ee(int cpu) in intel_pstate_disable_ee() argument
1149 ret = rdmsrl_on_cpu(cpu, MSR_IA32_POWER_CTL, &power_ctl); in intel_pstate_disable_ee()
1156 wrmsrl_on_cpu(cpu, MSR_IA32_POWER_CTL, power_ctl); in intel_pstate_disable_ee()
1385 static int intel_pstate_get_base_pstate(struct cpudata *cpu) in intel_pstate_get_base_pstate() argument
1388 cpu->pstate.max_pstate : cpu->pstate.turbo_pstate; in intel_pstate_get_base_pstate()
1391 static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate) in intel_pstate_set_pstate() argument
1393 trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu); in intel_pstate_set_pstate()
1394 cpu->pstate.current_pstate = pstate; in intel_pstate_set_pstate()
1400 wrmsrl_on_cpu(cpu->cpu, MSR_IA32_PERF_CTL, in intel_pstate_set_pstate()
1401 pstate_funcs.get_val(cpu, pstate)); in intel_pstate_set_pstate()
1404 static void intel_pstate_set_min_pstate(struct cpudata *cpu) in intel_pstate_set_min_pstate() argument
1406 intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate); in intel_pstate_set_min_pstate()
1409 static void intel_pstate_max_within_limits(struct cpudata *cpu) in intel_pstate_max_within_limits() argument
1414 pstate = intel_pstate_get_base_pstate(cpu); in intel_pstate_max_within_limits()
1415 pstate = max(cpu->pstate.min_pstate, cpu->max_perf_ratio); in intel_pstate_max_within_limits()
1416 intel_pstate_set_pstate(cpu, pstate); in intel_pstate_max_within_limits()
1419 static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) in intel_pstate_get_cpu_pstates() argument
1421 cpu->pstate.min_pstate = pstate_funcs.get_min(); in intel_pstate_get_cpu_pstates()
1422 cpu->pstate.max_pstate = pstate_funcs.get_max(); in intel_pstate_get_cpu_pstates()
1423 cpu->pstate.max_pstate_physical = pstate_funcs.get_max_physical(); in intel_pstate_get_cpu_pstates()
1424 cpu->pstate.turbo_pstate = pstate_funcs.get_turbo(); in intel_pstate_get_cpu_pstates()
1425 cpu->pstate.scaling = pstate_funcs.get_scaling(); in intel_pstate_get_cpu_pstates()
1426 cpu->pstate.max_freq = cpu->pstate.max_pstate * cpu->pstate.scaling; in intel_pstate_get_cpu_pstates()
1431 intel_pstate_get_hwp_max(cpu->cpu, &phy_max, ¤t_max); in intel_pstate_get_cpu_pstates()
1432 cpu->pstate.turbo_freq = phy_max * cpu->pstate.scaling; in intel_pstate_get_cpu_pstates()
1434 cpu->pstate.turbo_freq = cpu->pstate.turbo_pstate * cpu->pstate.scaling; in intel_pstate_get_cpu_pstates()
1438 cpu->aperf_mperf_shift = pstate_funcs.get_aperf_mperf_shift(); in intel_pstate_get_cpu_pstates()
1441 pstate_funcs.get_vid(cpu); in intel_pstate_get_cpu_pstates()
1443 intel_pstate_set_min_pstate(cpu); in intel_pstate_get_cpu_pstates()
1454 static inline void intel_pstate_hwp_boost_up(struct cpudata *cpu) in intel_pstate_hwp_boost_up() argument
1456 u64 hwp_req = READ_ONCE(cpu->hwp_req_cached); in intel_pstate_hwp_boost_up()
1476 if (max_limit == min_limit || cpu->hwp_boost_min >= max_limit) in intel_pstate_hwp_boost_up()
1479 if (!cpu->hwp_boost_min) in intel_pstate_hwp_boost_up()
1480 cpu->hwp_boost_min = min_limit; in intel_pstate_hwp_boost_up()
1483 boost_level1 = (HWP_GUARANTEED_PERF(cpu->hwp_cap_cached) + min_limit) >> 1; in intel_pstate_hwp_boost_up()
1485 if (cpu->hwp_boost_min < boost_level1) in intel_pstate_hwp_boost_up()
1486 cpu->hwp_boost_min = boost_level1; in intel_pstate_hwp_boost_up()
1487 else if (cpu->hwp_boost_min < HWP_GUARANTEED_PERF(cpu->hwp_cap_cached)) in intel_pstate_hwp_boost_up()
1488 cpu->hwp_boost_min = HWP_GUARANTEED_PERF(cpu->hwp_cap_cached); in intel_pstate_hwp_boost_up()
1489 else if (cpu->hwp_boost_min == HWP_GUARANTEED_PERF(cpu->hwp_cap_cached) && in intel_pstate_hwp_boost_up()
1490 max_limit != HWP_GUARANTEED_PERF(cpu->hwp_cap_cached)) in intel_pstate_hwp_boost_up()
1491 cpu->hwp_boost_min = max_limit; in intel_pstate_hwp_boost_up()
1495 hwp_req = (hwp_req & ~GENMASK_ULL(7, 0)) | cpu->hwp_boost_min; in intel_pstate_hwp_boost_up()
1497 cpu->last_update = cpu->sample.time; in intel_pstate_hwp_boost_up()
1500 static inline void intel_pstate_hwp_boost_down(struct cpudata *cpu) in intel_pstate_hwp_boost_down() argument
1502 if (cpu->hwp_boost_min) { in intel_pstate_hwp_boost_down()
1506 expired = time_after64(cpu->sample.time, cpu->last_update + in intel_pstate_hwp_boost_down()
1509 wrmsrl(MSR_HWP_REQUEST, cpu->hwp_req_cached); in intel_pstate_hwp_boost_down()
1510 cpu->hwp_boost_min = 0; in intel_pstate_hwp_boost_down()
1513 cpu->last_update = cpu->sample.time; in intel_pstate_hwp_boost_down()
1516 static inline void intel_pstate_update_util_hwp_local(struct cpudata *cpu, in intel_pstate_update_util_hwp_local() argument
1519 cpu->sample.time = time; in intel_pstate_update_util_hwp_local()
1521 if (cpu->sched_flags & SCHED_CPUFREQ_IOWAIT) { in intel_pstate_update_util_hwp_local()
1524 cpu->sched_flags = 0; in intel_pstate_update_util_hwp_local()
1532 if (time_before64(time, cpu->last_io_update + 2 * TICK_NSEC)) in intel_pstate_update_util_hwp_local()
1535 cpu->last_io_update = time; in intel_pstate_update_util_hwp_local()
1538 intel_pstate_hwp_boost_up(cpu); in intel_pstate_update_util_hwp_local()
1541 intel_pstate_hwp_boost_down(cpu); in intel_pstate_update_util_hwp_local()
1548 struct cpudata *cpu = container_of(data, struct cpudata, update_util); in intel_pstate_update_util_hwp() local
1550 cpu->sched_flags |= flags; in intel_pstate_update_util_hwp()
1552 if (smp_processor_id() == cpu->cpu) in intel_pstate_update_util_hwp()
1553 intel_pstate_update_util_hwp_local(cpu, time); in intel_pstate_update_util_hwp()
1556 static inline void intel_pstate_calc_avg_perf(struct cpudata *cpu) in intel_pstate_calc_avg_perf() argument
1558 struct sample *sample = &cpu->sample; in intel_pstate_calc_avg_perf()
1563 static inline bool intel_pstate_sample(struct cpudata *cpu, u64 time) in intel_pstate_sample() argument
1573 if (cpu->prev_mperf == mperf || cpu->prev_tsc == tsc) { in intel_pstate_sample()
1579 cpu->last_sample_time = cpu->sample.time; in intel_pstate_sample()
1580 cpu->sample.time = time; in intel_pstate_sample()
1581 cpu->sample.aperf = aperf; in intel_pstate_sample()
1582 cpu->sample.mperf = mperf; in intel_pstate_sample()
1583 cpu->sample.tsc = tsc; in intel_pstate_sample()
1584 cpu->sample.aperf -= cpu->prev_aperf; in intel_pstate_sample()
1585 cpu->sample.mperf -= cpu->prev_mperf; in intel_pstate_sample()
1586 cpu->sample.tsc -= cpu->prev_tsc; in intel_pstate_sample()
1588 cpu->prev_aperf = aperf; in intel_pstate_sample()
1589 cpu->prev_mperf = mperf; in intel_pstate_sample()
1590 cpu->prev_tsc = tsc; in intel_pstate_sample()
1598 if (cpu->last_sample_time) { in intel_pstate_sample()
1599 intel_pstate_calc_avg_perf(cpu); in intel_pstate_sample()
1605 static inline int32_t get_avg_frequency(struct cpudata *cpu) in get_avg_frequency() argument
1607 return mul_ext_fp(cpu->sample.core_avg_perf, cpu_khz); in get_avg_frequency()
1610 static inline int32_t get_avg_pstate(struct cpudata *cpu) in get_avg_pstate() argument
1612 return mul_ext_fp(cpu->pstate.max_pstate_physical, in get_avg_pstate()
1613 cpu->sample.core_avg_perf); in get_avg_pstate()
1616 static inline int32_t get_target_pstate(struct cpudata *cpu) in get_target_pstate() argument
1618 struct sample *sample = &cpu->sample; in get_target_pstate()
1622 busy_frac = div_fp(sample->mperf << cpu->aperf_mperf_shift, in get_target_pstate()
1625 boost = cpu->iowait_boost; in get_target_pstate()
1626 cpu->iowait_boost >>= 1; in get_target_pstate()
1634 cpu->pstate.max_pstate : cpu->pstate.turbo_pstate; in get_target_pstate()
1637 if (target < cpu->pstate.min_pstate) in get_target_pstate()
1638 target = cpu->pstate.min_pstate; in get_target_pstate()
1647 avg_pstate = get_avg_pstate(cpu); in get_target_pstate()
1654 static int intel_pstate_prepare_request(struct cpudata *cpu, int pstate) in intel_pstate_prepare_request() argument
1656 int max_pstate = intel_pstate_get_base_pstate(cpu); in intel_pstate_prepare_request()
1659 min_pstate = max(cpu->pstate.min_pstate, cpu->min_perf_ratio); in intel_pstate_prepare_request()
1660 max_pstate = max(min_pstate, cpu->max_perf_ratio); in intel_pstate_prepare_request()
1664 static void intel_pstate_update_pstate(struct cpudata *cpu, int pstate) in intel_pstate_update_pstate() argument
1666 if (pstate == cpu->pstate.current_pstate) in intel_pstate_update_pstate()
1669 cpu->pstate.current_pstate = pstate; in intel_pstate_update_pstate()
1670 wrmsrl(MSR_IA32_PERF_CTL, pstate_funcs.get_val(cpu, pstate)); in intel_pstate_update_pstate()
1673 static void intel_pstate_adjust_pstate(struct cpudata *cpu) in intel_pstate_adjust_pstate() argument
1675 int from = cpu->pstate.current_pstate; in intel_pstate_adjust_pstate()
1681 target_pstate = get_target_pstate(cpu); in intel_pstate_adjust_pstate()
1682 target_pstate = intel_pstate_prepare_request(cpu, target_pstate); in intel_pstate_adjust_pstate()
1683 trace_cpu_frequency(target_pstate * cpu->pstate.scaling, cpu->cpu); in intel_pstate_adjust_pstate()
1684 intel_pstate_update_pstate(cpu, target_pstate); in intel_pstate_adjust_pstate()
1686 sample = &cpu->sample; in intel_pstate_adjust_pstate()
1690 cpu->pstate.current_pstate, in intel_pstate_adjust_pstate()
1694 get_avg_frequency(cpu), in intel_pstate_adjust_pstate()
1695 fp_toint(cpu->iowait_boost * 100)); in intel_pstate_adjust_pstate()
1701 struct cpudata *cpu = container_of(data, struct cpudata, update_util); in intel_pstate_update_util() local
1705 if (smp_processor_id() != cpu->cpu) in intel_pstate_update_util()
1709 cpu->iowait_boost = int_tofp(1); in intel_pstate_update_util()
1710 cpu->last_update = time; in intel_pstate_update_util()
1715 if (fp_toint(cpu->sample.busy_scaled) == 100) in intel_pstate_update_util()
1719 } else if (cpu->iowait_boost) { in intel_pstate_update_util()
1721 delta_ns = time - cpu->last_update; in intel_pstate_update_util()
1723 cpu->iowait_boost = 0; in intel_pstate_update_util()
1725 cpu->last_update = time; in intel_pstate_update_util()
1726 delta_ns = time - cpu->sample.time; in intel_pstate_update_util()
1731 if (intel_pstate_sample(cpu, time)) in intel_pstate_update_util()
1732 intel_pstate_adjust_pstate(cpu); in intel_pstate_update_util()
1824 struct cpudata *cpu; in intel_pstate_init_cpu() local
1826 cpu = all_cpu_data[cpunum]; in intel_pstate_init_cpu()
1828 if (!cpu) { in intel_pstate_init_cpu()
1829 cpu = kzalloc(sizeof(*cpu), GFP_KERNEL); in intel_pstate_init_cpu()
1830 if (!cpu) in intel_pstate_init_cpu()
1833 all_cpu_data[cpunum] = cpu; in intel_pstate_init_cpu()
1835 cpu->epp_default = -EINVAL; in intel_pstate_init_cpu()
1836 cpu->epp_powersave = -EINVAL; in intel_pstate_init_cpu()
1837 cpu->epp_saved = -EINVAL; in intel_pstate_init_cpu()
1840 cpu = all_cpu_data[cpunum]; in intel_pstate_init_cpu()
1842 cpu->cpu = cpunum; in intel_pstate_init_cpu()
1851 intel_pstate_hwp_enable(cpu); in intel_pstate_init_cpu()
1858 intel_pstate_get_cpu_pstates(cpu); in intel_pstate_init_cpu()
1867 struct cpudata *cpu = all_cpu_data[cpu_num]; in intel_pstate_set_update_util_hook() local
1872 if (cpu->update_util_set) in intel_pstate_set_update_util_hook()
1876 cpu->sample.time = 0; in intel_pstate_set_update_util_hook()
1877 cpufreq_add_update_util_hook(cpu_num, &cpu->update_util, in intel_pstate_set_update_util_hook()
1881 cpu->update_util_set = true; in intel_pstate_set_update_util_hook()
1884 static void intel_pstate_clear_update_util_hook(unsigned int cpu) in intel_pstate_clear_update_util_hook() argument
1886 struct cpudata *cpu_data = all_cpu_data[cpu]; in intel_pstate_clear_update_util_hook()
1891 cpufreq_remove_update_util_hook(cpu); in intel_pstate_clear_update_util_hook()
1896 static int intel_pstate_get_max_freq(struct cpudata *cpu) in intel_pstate_get_max_freq() argument
1899 cpu->pstate.max_freq : cpu->pstate.turbo_freq; in intel_pstate_get_max_freq()
1903 struct cpudata *cpu) in intel_pstate_update_perf_limits() argument
1905 int max_freq = intel_pstate_get_max_freq(cpu); in intel_pstate_update_perf_limits()
1915 intel_pstate_get_hwp_max(cpu->cpu, &turbo_max, &max_state); in intel_pstate_update_perf_limits()
1917 max_state = intel_pstate_get_base_pstate(cpu); in intel_pstate_update_perf_limits()
1918 turbo_max = cpu->pstate.turbo_pstate; in intel_pstate_update_perf_limits()
1931 policy->cpu, max_state, in intel_pstate_update_perf_limits()
1936 cpu->min_perf_ratio = min_policy_perf; in intel_pstate_update_perf_limits()
1937 cpu->max_perf_ratio = max_policy_perf; in intel_pstate_update_perf_limits()
1946 pr_debug("cpu:%d global_min:%d global_max:%d\n", policy->cpu, in intel_pstate_update_perf_limits()
1949 cpu->min_perf_ratio = max(min_policy_perf, global_min); in intel_pstate_update_perf_limits()
1950 cpu->min_perf_ratio = min(cpu->min_perf_ratio, max_policy_perf); in intel_pstate_update_perf_limits()
1951 cpu->max_perf_ratio = min(max_policy_perf, global_max); in intel_pstate_update_perf_limits()
1952 cpu->max_perf_ratio = max(min_policy_perf, cpu->max_perf_ratio); in intel_pstate_update_perf_limits()
1955 cpu->min_perf_ratio = min(cpu->min_perf_ratio, in intel_pstate_update_perf_limits()
1956 cpu->max_perf_ratio); in intel_pstate_update_perf_limits()
1959 pr_debug("cpu:%d max_perf_ratio:%d min_perf_ratio:%d\n", policy->cpu, in intel_pstate_update_perf_limits()
1960 cpu->max_perf_ratio, in intel_pstate_update_perf_limits()
1961 cpu->min_perf_ratio); in intel_pstate_update_perf_limits()
1966 struct cpudata *cpu; in intel_pstate_set_policy() local
1974 cpu = all_cpu_data[policy->cpu]; in intel_pstate_set_policy()
1975 cpu->policy = policy->policy; in intel_pstate_set_policy()
1979 intel_pstate_update_perf_limits(policy, cpu); in intel_pstate_set_policy()
1981 if (cpu->policy == CPUFREQ_POLICY_PERFORMANCE) { in intel_pstate_set_policy()
1986 intel_pstate_clear_update_util_hook(policy->cpu); in intel_pstate_set_policy()
1987 intel_pstate_max_within_limits(cpu); in intel_pstate_set_policy()
1989 intel_pstate_set_update_util_hook(policy->cpu); in intel_pstate_set_policy()
1999 intel_pstate_clear_update_util_hook(policy->cpu); in intel_pstate_set_policy()
2000 intel_pstate_hwp_set(policy->cpu); in intel_pstate_set_policy()
2009 struct cpudata *cpu) in intel_pstate_adjust_policy_max() argument
2012 cpu->pstate.max_pstate_physical > cpu->pstate.max_pstate && in intel_pstate_adjust_policy_max()
2014 policy->max > cpu->pstate.max_freq) { in intel_pstate_adjust_policy_max()
2022 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_pstate_verify_policy() local
2026 intel_pstate_get_max_freq(cpu)); in intel_pstate_verify_policy()
2032 intel_pstate_adjust_policy_max(policy, cpu); in intel_pstate_verify_policy()
2039 intel_pstate_set_min_pstate(all_cpu_data[policy->cpu]); in intel_cpufreq_stop_cpu()
2044 pr_debug("CPU %d exiting\n", policy->cpu); in intel_pstate_stop_cpu()
2046 intel_pstate_clear_update_util_hook(policy->cpu); in intel_pstate_stop_cpu()
2064 struct cpudata *cpu; in __intel_pstate_cpu_init() local
2067 rc = intel_pstate_init_cpu(policy->cpu); in __intel_pstate_cpu_init()
2071 cpu = all_cpu_data[policy->cpu]; in __intel_pstate_cpu_init()
2073 cpu->max_perf_ratio = 0xFF; in __intel_pstate_cpu_init()
2074 cpu->min_perf_ratio = 0; in __intel_pstate_cpu_init()
2076 policy->min = cpu->pstate.min_pstate * cpu->pstate.scaling; in __intel_pstate_cpu_init()
2077 policy->max = cpu->pstate.turbo_pstate * cpu->pstate.scaling; in __intel_pstate_cpu_init()
2080 policy->cpuinfo.min_freq = cpu->pstate.min_pstate * cpu->pstate.scaling; in __intel_pstate_cpu_init()
2083 cpu->pstate.max_pstate : cpu->pstate.turbo_pstate; in __intel_pstate_cpu_init()
2084 policy->cpuinfo.max_freq *= cpu->pstate.scaling; in __intel_pstate_cpu_init()
2090 cpu->pstate.max_freq : cpu->pstate.turbo_freq; in __intel_pstate_cpu_init()
2131 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_verify_policy() local
2135 intel_pstate_get_max_freq(cpu)); in intel_cpufreq_verify_policy()
2137 intel_pstate_adjust_policy_max(policy, cpu); in intel_cpufreq_verify_policy()
2139 intel_pstate_update_perf_limits(policy, cpu); in intel_cpufreq_verify_policy()
2160 static void intel_cpufreq_trace(struct cpudata *cpu, unsigned int trace_type, int old_pstate) in intel_cpufreq_trace() argument
2167 if (!intel_pstate_sample(cpu, ktime_get())) in intel_cpufreq_trace()
2170 sample = &cpu->sample; in intel_cpufreq_trace()
2174 cpu->pstate.current_pstate, in intel_cpufreq_trace()
2178 get_avg_frequency(cpu), in intel_cpufreq_trace()
2179 fp_toint(cpu->iowait_boost * 100)); in intel_cpufreq_trace()
2186 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_target() local
2198 target_pstate = DIV_ROUND_UP(freqs.new, cpu->pstate.scaling); in intel_cpufreq_target()
2201 target_pstate = freqs.new / cpu->pstate.scaling; in intel_cpufreq_target()
2204 target_pstate = DIV_ROUND_CLOSEST(freqs.new, cpu->pstate.scaling); in intel_cpufreq_target()
2207 target_pstate = intel_pstate_prepare_request(cpu, target_pstate); in intel_cpufreq_target()
2208 old_pstate = cpu->pstate.current_pstate; in intel_cpufreq_target()
2209 if (target_pstate != cpu->pstate.current_pstate) { in intel_cpufreq_target()
2210 cpu->pstate.current_pstate = target_pstate; in intel_cpufreq_target()
2211 wrmsrl_on_cpu(policy->cpu, MSR_IA32_PERF_CTL, in intel_cpufreq_target()
2212 pstate_funcs.get_val(cpu, target_pstate)); in intel_cpufreq_target()
2214 freqs.new = target_pstate * cpu->pstate.scaling; in intel_cpufreq_target()
2215 intel_cpufreq_trace(cpu, INTEL_PSTATE_TRACE_TARGET, old_pstate); in intel_cpufreq_target()
2224 struct cpudata *cpu = all_cpu_data[policy->cpu]; in intel_cpufreq_fast_switch() local
2229 target_pstate = DIV_ROUND_UP(target_freq, cpu->pstate.scaling); in intel_cpufreq_fast_switch()
2230 target_pstate = intel_pstate_prepare_request(cpu, target_pstate); in intel_cpufreq_fast_switch()
2231 old_pstate = cpu->pstate.current_pstate; in intel_cpufreq_fast_switch()
2232 intel_pstate_update_pstate(cpu, target_pstate); in intel_cpufreq_fast_switch()
2233 intel_cpufreq_trace(cpu, INTEL_PSTATE_TRACE_FAST_SWITCH, old_pstate); in intel_cpufreq_fast_switch()
2234 return target_pstate * cpu->pstate.scaling; in intel_cpufreq_fast_switch()
2267 unsigned int cpu; in intel_pstate_driver_cleanup() local
2270 for_each_online_cpu(cpu) { in intel_pstate_driver_cleanup()
2271 if (all_cpu_data[cpu]) { in intel_pstate_driver_cleanup()
2273 intel_pstate_clear_update_util_hook(cpu); in intel_pstate_driver_cleanup()
2275 kfree(all_cpu_data[cpu]); in intel_pstate_driver_cleanup()
2276 all_cpu_data[cpu] = NULL; in intel_pstate_driver_cleanup()