Lines Matching refs:cpu
101 int cpu; member
229 static inline void intel_pstate_busy_pid_reset(struct cpudata *cpu) in intel_pstate_busy_pid_reset() argument
231 pid_p_gain_set(&cpu->pid, pid_params.p_gain_pct); in intel_pstate_busy_pid_reset()
232 pid_d_gain_set(&cpu->pid, pid_params.d_gain_pct); in intel_pstate_busy_pid_reset()
233 pid_i_gain_set(&cpu->pid, pid_params.i_gain_pct); in intel_pstate_busy_pid_reset()
235 pid_reset(&cpu->pid, pid_params.setpoint, 100, pid_params.deadband, 0); in intel_pstate_busy_pid_reset()
240 unsigned int cpu; in intel_pstate_reset_all_pid() local
242 for_each_online_cpu(cpu) { in intel_pstate_reset_all_pid()
243 if (all_cpu_data[cpu]) in intel_pstate_reset_all_pid()
244 intel_pstate_busy_pid_reset(all_cpu_data[cpu]); in intel_pstate_reset_all_pid()
251 struct cpudata *cpu; in update_turbo_state() local
253 cpu = all_cpu_data[0]; in update_turbo_state()
257 cpu->pstate.max_pstate == cpu->pstate.turbo_pstate); in update_turbo_state()
263 int min, max, cpu; in intel_pstate_hwp_set() local
268 for_each_online_cpu(cpu) { in intel_pstate_hwp_set()
269 rdmsrl_on_cpu(cpu, MSR_HWP_REQUEST, &value); in intel_pstate_hwp_set()
282 wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value); in intel_pstate_hwp_set()
349 struct cpudata *cpu; in show_turbo_pct() local
353 cpu = all_cpu_data[0]; in show_turbo_pct()
355 total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1; in show_turbo_pct()
356 no_turbo = cpu->pstate.max_pstate - cpu->pstate.min_pstate + 1; in show_turbo_pct()
365 struct cpudata *cpu; in show_num_pstates() local
368 cpu = all_cpu_data[0]; in show_num_pstates()
369 total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1; in show_num_pstates()
538 wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val); in byt_set_pstate()
615 wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val); in core_set_pstate()
686 static void intel_pstate_get_min_max(struct cpudata *cpu, int *min, int *max) in intel_pstate_get_min_max() argument
688 int max_perf = cpu->pstate.turbo_pstate; in intel_pstate_get_min_max()
693 max_perf = cpu->pstate.max_pstate; in intel_pstate_get_min_max()
702 cpu->pstate.min_pstate, cpu->pstate.turbo_pstate); in intel_pstate_get_min_max()
705 *min = clamp_t(int, min_perf, cpu->pstate.min_pstate, max_perf); in intel_pstate_get_min_max()
708 static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate) in intel_pstate_set_pstate() argument
714 intel_pstate_get_min_max(cpu, &min_perf, &max_perf); in intel_pstate_set_pstate()
718 if (pstate == cpu->pstate.current_pstate) in intel_pstate_set_pstate()
721 trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu); in intel_pstate_set_pstate()
723 cpu->pstate.current_pstate = pstate; in intel_pstate_set_pstate()
725 pstate_funcs.set(cpu, pstate); in intel_pstate_set_pstate()
728 static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) in intel_pstate_get_cpu_pstates() argument
730 cpu->pstate.min_pstate = pstate_funcs.get_min(); in intel_pstate_get_cpu_pstates()
731 cpu->pstate.max_pstate = pstate_funcs.get_max(); in intel_pstate_get_cpu_pstates()
732 cpu->pstate.turbo_pstate = pstate_funcs.get_turbo(); in intel_pstate_get_cpu_pstates()
733 cpu->pstate.scaling = pstate_funcs.get_scaling(); in intel_pstate_get_cpu_pstates()
736 pstate_funcs.get_vid(cpu); in intel_pstate_get_cpu_pstates()
737 intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate); in intel_pstate_get_cpu_pstates()
740 static inline void intel_pstate_calc_busy(struct cpudata *cpu) in intel_pstate_calc_busy() argument
742 struct sample *sample = &cpu->sample; in intel_pstate_calc_busy()
750 cpu->pstate.max_pstate * cpu->pstate.scaling / 100), in intel_pstate_calc_busy()
756 static inline void intel_pstate_sample(struct cpudata *cpu) in intel_pstate_sample() argument
764 if (cpu->prev_mperf == mperf) { in intel_pstate_sample()
771 cpu->last_sample_time = cpu->sample.time; in intel_pstate_sample()
772 cpu->sample.time = ktime_get(); in intel_pstate_sample()
773 cpu->sample.aperf = aperf; in intel_pstate_sample()
774 cpu->sample.mperf = mperf; in intel_pstate_sample()
775 cpu->sample.aperf -= cpu->prev_aperf; in intel_pstate_sample()
776 cpu->sample.mperf -= cpu->prev_mperf; in intel_pstate_sample()
778 intel_pstate_calc_busy(cpu); in intel_pstate_sample()
780 cpu->prev_aperf = aperf; in intel_pstate_sample()
781 cpu->prev_mperf = mperf; in intel_pstate_sample()
784 static inline void intel_hwp_set_sample_time(struct cpudata *cpu) in intel_hwp_set_sample_time() argument
789 mod_timer_pinned(&cpu->timer, jiffies + delay); in intel_hwp_set_sample_time()
792 static inline void intel_pstate_set_sample_time(struct cpudata *cpu) in intel_pstate_set_sample_time() argument
797 mod_timer_pinned(&cpu->timer, jiffies + delay); in intel_pstate_set_sample_time()
800 static inline int32_t intel_pstate_get_scaled_busy(struct cpudata *cpu) in intel_pstate_get_scaled_busy() argument
817 core_busy = cpu->sample.core_pct_busy; in intel_pstate_get_scaled_busy()
818 max_pstate = int_tofp(cpu->pstate.max_pstate); in intel_pstate_get_scaled_busy()
819 current_pstate = int_tofp(cpu->pstate.current_pstate); in intel_pstate_get_scaled_busy()
830 duration_us = ktime_us_delta(cpu->sample.time, in intel_pstate_get_scaled_busy()
831 cpu->last_sample_time); in intel_pstate_get_scaled_busy()
841 static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu) in intel_pstate_adjust_busy_pstate() argument
847 pid = &cpu->pid; in intel_pstate_adjust_busy_pstate()
848 busy_scaled = intel_pstate_get_scaled_busy(cpu); in intel_pstate_adjust_busy_pstate()
853 intel_pstate_set_pstate(cpu, cpu->pstate.current_pstate - ctl); in intel_pstate_adjust_busy_pstate()
858 struct cpudata *cpu = (struct cpudata *) __data; in intel_hwp_timer_func() local
860 intel_pstate_sample(cpu); in intel_hwp_timer_func()
861 intel_hwp_set_sample_time(cpu); in intel_hwp_timer_func()
866 struct cpudata *cpu = (struct cpudata *) __data; in intel_pstate_timer_func() local
869 intel_pstate_sample(cpu); in intel_pstate_timer_func()
871 sample = &cpu->sample; in intel_pstate_timer_func()
873 intel_pstate_adjust_busy_pstate(cpu); in intel_pstate_timer_func()
876 fp_toint(intel_pstate_get_scaled_busy(cpu)), in intel_pstate_timer_func()
877 cpu->pstate.current_pstate, in intel_pstate_timer_func()
882 intel_pstate_set_sample_time(cpu); in intel_pstate_timer_func()
917 struct cpudata *cpu; in intel_pstate_init_cpu() local
925 cpu = all_cpu_data[cpunum]; in intel_pstate_init_cpu()
927 cpu->cpu = cpunum; in intel_pstate_init_cpu()
928 intel_pstate_get_cpu_pstates(cpu); in intel_pstate_init_cpu()
930 init_timer_deferrable(&cpu->timer); in intel_pstate_init_cpu()
931 cpu->timer.data = (unsigned long)cpu; in intel_pstate_init_cpu()
932 cpu->timer.expires = jiffies + HZ/100; in intel_pstate_init_cpu()
935 cpu->timer.function = intel_pstate_timer_func; in intel_pstate_init_cpu()
937 cpu->timer.function = intel_hwp_timer_func; in intel_pstate_init_cpu()
939 intel_pstate_busy_pid_reset(cpu); in intel_pstate_init_cpu()
940 intel_pstate_sample(cpu); in intel_pstate_init_cpu()
942 add_timer_on(&cpu->timer, cpunum); in intel_pstate_init_cpu()
952 struct cpudata *cpu; in intel_pstate_get() local
954 cpu = all_cpu_data[cpu_num]; in intel_pstate_get()
955 if (!cpu) in intel_pstate_get()
957 sample = &cpu->sample; in intel_pstate_get()
1007 int cpu_num = policy->cpu; in intel_pstate_stop_cpu()
1008 struct cpudata *cpu = all_cpu_data[cpu_num]; in intel_pstate_stop_cpu() local
1016 intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate); in intel_pstate_stop_cpu()
1021 struct cpudata *cpu; in intel_pstate_cpu_init() local
1024 rc = intel_pstate_init_cpu(policy->cpu); in intel_pstate_cpu_init()
1028 cpu = all_cpu_data[policy->cpu]; in intel_pstate_cpu_init()
1035 policy->min = cpu->pstate.min_pstate * cpu->pstate.scaling; in intel_pstate_cpu_init()
1036 policy->max = cpu->pstate.turbo_pstate * cpu->pstate.scaling; in intel_pstate_cpu_init()
1039 policy->cpuinfo.min_freq = cpu->pstate.min_pstate * cpu->pstate.scaling; in intel_pstate_cpu_init()
1042 cpu->pstate.max_pstate : cpu->pstate.turbo_pstate; in intel_pstate_cpu_init()
1043 policy->cpuinfo.max_freq *= cpu->pstate.scaling; in intel_pstate_cpu_init()
1046 cpumask_set_cpu(policy->cpu, policy->cpus); in intel_pstate_cpu_init()
1211 int cpu, rc = 0; in intel_pstate_init() local
1259 for_each_online_cpu(cpu) { in intel_pstate_init()
1260 if (all_cpu_data[cpu]) { in intel_pstate_init()
1261 del_timer_sync(&all_cpu_data[cpu]->timer); in intel_pstate_init()
1262 kfree(all_cpu_data[cpu]); in intel_pstate_init()