diff options
Diffstat (limited to 'drivers/cpufreq/intel_pstate.c')
-rw-r--r-- | drivers/cpufreq/intel_pstate.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index f502d5b90c25..b230ebaae66c 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -453,6 +453,14 @@ static void intel_pstate_hwp_set(const struct cpumask *cpumask) | |||
453 | } | 453 | } |
454 | } | 454 | } |
455 | 455 | ||
456 | static int intel_pstate_hwp_set_policy(struct cpufreq_policy *policy) | ||
457 | { | ||
458 | if (hwp_active) | ||
459 | intel_pstate_hwp_set(policy->cpus); | ||
460 | |||
461 | return 0; | ||
462 | } | ||
463 | |||
456 | static void intel_pstate_hwp_set_online_cpus(void) | 464 | static void intel_pstate_hwp_set_online_cpus(void) |
457 | { | 465 | { |
458 | get_online_cpus(); | 466 | get_online_cpus(); |
@@ -1062,8 +1070,9 @@ static inline bool intel_pstate_sample(struct cpudata *cpu, u64 time) | |||
1062 | 1070 | ||
1063 | static inline int32_t get_avg_frequency(struct cpudata *cpu) | 1071 | static inline int32_t get_avg_frequency(struct cpudata *cpu) |
1064 | { | 1072 | { |
1065 | return div64_u64(cpu->pstate.max_pstate_physical * cpu->sample.aperf * | 1073 | return fp_toint(mul_fp(cpu->sample.core_pct_busy, |
1066 | cpu->pstate.scaling, cpu->sample.mperf); | 1074 | int_tofp(cpu->pstate.max_pstate_physical * |
1075 | cpu->pstate.scaling / 100))); | ||
1067 | } | 1076 | } |
1068 | 1077 | ||
1069 | static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu) | 1078 | static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu) |
@@ -1106,8 +1115,6 @@ static inline int32_t get_target_pstate_use_performance(struct cpudata *cpu) | |||
1106 | int32_t core_busy, max_pstate, current_pstate, sample_ratio; | 1115 | int32_t core_busy, max_pstate, current_pstate, sample_ratio; |
1107 | u64 duration_ns; | 1116 | u64 duration_ns; |
1108 | 1117 | ||
1109 | intel_pstate_calc_busy(cpu); | ||
1110 | |||
1111 | /* | 1118 | /* |
1112 | * core_busy is the ratio of actual performance to max | 1119 | * core_busy is the ratio of actual performance to max |
1113 | * max_pstate is the max non turbo pstate available | 1120 | * max_pstate is the max non turbo pstate available |
@@ -1191,8 +1198,11 @@ static void intel_pstate_update_util(struct update_util_data *data, u64 time, | |||
1191 | if ((s64)delta_ns >= pid_params.sample_rate_ns) { | 1198 | if ((s64)delta_ns >= pid_params.sample_rate_ns) { |
1192 | bool sample_taken = intel_pstate_sample(cpu, time); | 1199 | bool sample_taken = intel_pstate_sample(cpu, time); |
1193 | 1200 | ||
1194 | if (sample_taken && !hwp_active) | 1201 | if (sample_taken) { |
1195 | intel_pstate_adjust_busy_pstate(cpu); | 1202 | intel_pstate_calc_busy(cpu); |
1203 | if (!hwp_active) | ||
1204 | intel_pstate_adjust_busy_pstate(cpu); | ||
1205 | } | ||
1196 | } | 1206 | } |
1197 | } | 1207 | } |
1198 | 1208 | ||
@@ -1346,8 +1356,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) | |||
1346 | out: | 1356 | out: |
1347 | intel_pstate_set_update_util_hook(policy->cpu); | 1357 | intel_pstate_set_update_util_hook(policy->cpu); |
1348 | 1358 | ||
1349 | if (hwp_active) | 1359 | intel_pstate_hwp_set_policy(policy); |
1350 | intel_pstate_hwp_set(policy->cpus); | ||
1351 | 1360 | ||
1352 | return 0; | 1361 | return 0; |
1353 | } | 1362 | } |
@@ -1411,6 +1420,7 @@ static struct cpufreq_driver intel_pstate_driver = { | |||
1411 | .flags = CPUFREQ_CONST_LOOPS, | 1420 | .flags = CPUFREQ_CONST_LOOPS, |
1412 | .verify = intel_pstate_verify_policy, | 1421 | .verify = intel_pstate_verify_policy, |
1413 | .setpolicy = intel_pstate_set_policy, | 1422 | .setpolicy = intel_pstate_set_policy, |
1423 | .resume = intel_pstate_hwp_set_policy, | ||
1414 | .get = intel_pstate_get, | 1424 | .get = intel_pstate_get, |
1415 | .init = intel_pstate_cpu_init, | 1425 | .init = intel_pstate_cpu_init, |
1416 | .stop_cpu = intel_pstate_stop_cpu, | 1426 | .stop_cpu = intel_pstate_stop_cpu, |