Lines Matching refs:cpu
103 int cpu; member
252 static inline void intel_pstate_busy_pid_reset(struct cpudata *cpu) in intel_pstate_busy_pid_reset() argument
254 pid_p_gain_set(&cpu->pid, pid_params.p_gain_pct); in intel_pstate_busy_pid_reset()
255 pid_d_gain_set(&cpu->pid, pid_params.d_gain_pct); in intel_pstate_busy_pid_reset()
256 pid_i_gain_set(&cpu->pid, pid_params.i_gain_pct); in intel_pstate_busy_pid_reset()
258 pid_reset(&cpu->pid, pid_params.setpoint, 100, pid_params.deadband, 0); in intel_pstate_busy_pid_reset()
263 unsigned int cpu; in intel_pstate_reset_all_pid() local
265 for_each_online_cpu(cpu) { in intel_pstate_reset_all_pid()
266 if (all_cpu_data[cpu]) in intel_pstate_reset_all_pid()
267 intel_pstate_busy_pid_reset(all_cpu_data[cpu]); in intel_pstate_reset_all_pid()
274 struct cpudata *cpu; in update_turbo_state() local
276 cpu = all_cpu_data[0]; in update_turbo_state()
280 cpu->pstate.max_pstate == cpu->pstate.turbo_pstate); in update_turbo_state()
285 int min, hw_min, max, hw_max, cpu, range, adj_range; in intel_pstate_hwp_set() local
295 for_each_online_cpu(cpu) { in intel_pstate_hwp_set()
296 rdmsrl_on_cpu(cpu, MSR_HWP_REQUEST, &value); in intel_pstate_hwp_set()
312 wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value); in intel_pstate_hwp_set()
379 struct cpudata *cpu; in show_turbo_pct() local
383 cpu = all_cpu_data[0]; in show_turbo_pct()
385 total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1; in show_turbo_pct()
386 no_turbo = cpu->pstate.max_pstate - cpu->pstate.min_pstate + 1; in show_turbo_pct()
395 struct cpudata *cpu; in show_num_pstates() local
398 cpu = all_cpu_data[0]; in show_num_pstates()
399 total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1; in show_num_pstates()
528 wrmsrl_on_cpu(cpudata->cpu, MSR_PM_ENABLE, 0x1); in intel_pstate_hwp_enable()
577 wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val); in atom_set_pstate()
714 wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val); in core_set_pstate()
808 static void intel_pstate_get_min_max(struct cpudata *cpu, int *min, int *max) in intel_pstate_get_min_max() argument
810 int max_perf = cpu->pstate.turbo_pstate; in intel_pstate_get_min_max()
815 max_perf = cpu->pstate.max_pstate; in intel_pstate_get_min_max()
824 cpu->pstate.min_pstate, cpu->pstate.turbo_pstate); in intel_pstate_get_min_max()
827 *min = clamp_t(int, min_perf, cpu->pstate.min_pstate, max_perf); in intel_pstate_get_min_max()
830 static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate, bool force) in intel_pstate_set_pstate() argument
837 intel_pstate_get_min_max(cpu, &min_perf, &max_perf); in intel_pstate_set_pstate()
841 if (pstate == cpu->pstate.current_pstate) in intel_pstate_set_pstate()
844 trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu); in intel_pstate_set_pstate()
846 cpu->pstate.current_pstate = pstate; in intel_pstate_set_pstate()
848 pstate_funcs.set(cpu, pstate); in intel_pstate_set_pstate()
851 static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) in intel_pstate_get_cpu_pstates() argument
853 cpu->pstate.min_pstate = pstate_funcs.get_min(); in intel_pstate_get_cpu_pstates()
854 cpu->pstate.max_pstate = pstate_funcs.get_max(); in intel_pstate_get_cpu_pstates()
855 cpu->pstate.max_pstate_physical = pstate_funcs.get_max_physical(); in intel_pstate_get_cpu_pstates()
856 cpu->pstate.turbo_pstate = pstate_funcs.get_turbo(); in intel_pstate_get_cpu_pstates()
857 cpu->pstate.scaling = pstate_funcs.get_scaling(); in intel_pstate_get_cpu_pstates()
860 pstate_funcs.get_vid(cpu); in intel_pstate_get_cpu_pstates()
861 intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate, false); in intel_pstate_get_cpu_pstates()
864 static inline void intel_pstate_calc_busy(struct cpudata *cpu) in intel_pstate_calc_busy() argument
866 struct sample *sample = &cpu->sample; in intel_pstate_calc_busy()
874 cpu->pstate.max_pstate_physical * in intel_pstate_calc_busy()
875 cpu->pstate.scaling / 100), in intel_pstate_calc_busy()
881 static inline void intel_pstate_sample(struct cpudata *cpu) in intel_pstate_sample() argument
890 if (cpu->prev_mperf == mperf) { in intel_pstate_sample()
898 cpu->last_sample_time = cpu->sample.time; in intel_pstate_sample()
899 cpu->sample.time = ktime_get(); in intel_pstate_sample()
900 cpu->sample.aperf = aperf; in intel_pstate_sample()
901 cpu->sample.mperf = mperf; in intel_pstate_sample()
902 cpu->sample.tsc = tsc; in intel_pstate_sample()
903 cpu->sample.aperf -= cpu->prev_aperf; in intel_pstate_sample()
904 cpu->sample.mperf -= cpu->prev_mperf; in intel_pstate_sample()
905 cpu->sample.tsc -= cpu->prev_tsc; in intel_pstate_sample()
907 intel_pstate_calc_busy(cpu); in intel_pstate_sample()
909 cpu->prev_aperf = aperf; in intel_pstate_sample()
910 cpu->prev_mperf = mperf; in intel_pstate_sample()
911 cpu->prev_tsc = tsc; in intel_pstate_sample()
914 static inline void intel_hwp_set_sample_time(struct cpudata *cpu) in intel_hwp_set_sample_time() argument
919 mod_timer_pinned(&cpu->timer, jiffies + delay); in intel_hwp_set_sample_time()
922 static inline void intel_pstate_set_sample_time(struct cpudata *cpu) in intel_pstate_set_sample_time() argument
927 mod_timer_pinned(&cpu->timer, jiffies + delay); in intel_pstate_set_sample_time()
930 static inline int32_t intel_pstate_get_scaled_busy(struct cpudata *cpu) in intel_pstate_get_scaled_busy() argument
947 core_busy = cpu->sample.core_pct_busy; in intel_pstate_get_scaled_busy()
948 max_pstate = int_tofp(cpu->pstate.max_pstate_physical); in intel_pstate_get_scaled_busy()
949 current_pstate = int_tofp(cpu->pstate.current_pstate); in intel_pstate_get_scaled_busy()
960 duration_us = ktime_us_delta(cpu->sample.time, in intel_pstate_get_scaled_busy()
961 cpu->last_sample_time); in intel_pstate_get_scaled_busy()
971 static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu) in intel_pstate_adjust_busy_pstate() argument
979 from = cpu->pstate.current_pstate; in intel_pstate_adjust_busy_pstate()
981 pid = &cpu->pid; in intel_pstate_adjust_busy_pstate()
982 busy_scaled = intel_pstate_get_scaled_busy(cpu); in intel_pstate_adjust_busy_pstate()
987 intel_pstate_set_pstate(cpu, cpu->pstate.current_pstate - ctl, true); in intel_pstate_adjust_busy_pstate()
989 sample = &cpu->sample; in intel_pstate_adjust_busy_pstate()
993 cpu->pstate.current_pstate, in intel_pstate_adjust_busy_pstate()
1002 struct cpudata *cpu = (struct cpudata *) __data; in intel_hwp_timer_func() local
1004 intel_pstate_sample(cpu); in intel_hwp_timer_func()
1005 intel_hwp_set_sample_time(cpu); in intel_hwp_timer_func()
1010 struct cpudata *cpu = (struct cpudata *) __data; in intel_pstate_timer_func() local
1012 intel_pstate_sample(cpu); in intel_pstate_timer_func()
1014 intel_pstate_adjust_busy_pstate(cpu); in intel_pstate_timer_func()
1016 intel_pstate_set_sample_time(cpu); in intel_pstate_timer_func()
1052 struct cpudata *cpu; in intel_pstate_init_cpu() local
1060 cpu = all_cpu_data[cpunum]; in intel_pstate_init_cpu()
1062 cpu->cpu = cpunum; in intel_pstate_init_cpu()
1065 intel_pstate_hwp_enable(cpu); in intel_pstate_init_cpu()
1067 intel_pstate_get_cpu_pstates(cpu); in intel_pstate_init_cpu()
1069 init_timer_deferrable(&cpu->timer); in intel_pstate_init_cpu()
1070 cpu->timer.data = (unsigned long)cpu; in intel_pstate_init_cpu()
1071 cpu->timer.expires = jiffies + HZ/100; in intel_pstate_init_cpu()
1074 cpu->timer.function = intel_pstate_timer_func; in intel_pstate_init_cpu()
1076 cpu->timer.function = intel_hwp_timer_func; in intel_pstate_init_cpu()
1078 intel_pstate_busy_pid_reset(cpu); in intel_pstate_init_cpu()
1079 intel_pstate_sample(cpu); in intel_pstate_init_cpu()
1081 add_timer_on(&cpu->timer, cpunum); in intel_pstate_init_cpu()
1091 struct cpudata *cpu; in intel_pstate_get() local
1093 cpu = all_cpu_data[cpu_num]; in intel_pstate_get()
1094 if (!cpu) in intel_pstate_get()
1096 sample = &cpu->sample; in intel_pstate_get()
1160 int cpu_num = policy->cpu; in intel_pstate_stop_cpu()
1161 struct cpudata *cpu = all_cpu_data[cpu_num]; in intel_pstate_stop_cpu() local
1169 intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate, false); in intel_pstate_stop_cpu()
1174 struct cpudata *cpu; in intel_pstate_cpu_init() local
1177 rc = intel_pstate_init_cpu(policy->cpu); in intel_pstate_cpu_init()
1181 cpu = all_cpu_data[policy->cpu]; in intel_pstate_cpu_init()
1188 policy->min = cpu->pstate.min_pstate * cpu->pstate.scaling; in intel_pstate_cpu_init()
1189 policy->max = cpu->pstate.turbo_pstate * cpu->pstate.scaling; in intel_pstate_cpu_init()
1192 policy->cpuinfo.min_freq = cpu->pstate.min_pstate * cpu->pstate.scaling; in intel_pstate_cpu_init()
1194 cpu->pstate.turbo_pstate * cpu->pstate.scaling; in intel_pstate_cpu_init()
1196 cpumask_set_cpu(policy->cpu, policy->cpus); in intel_pstate_cpu_init()
1366 int cpu, rc = 0; in intel_pstate_init() local
1416 for_each_online_cpu(cpu) { in intel_pstate_init()
1417 if (all_cpu_data[cpu]) { in intel_pstate_init()
1418 del_timer_sync(&all_cpu_data[cpu]->timer); in intel_pstate_init()
1419 kfree(all_cpu_data[cpu]); in intel_pstate_init()