[PATCH 5.3 062/193] cpufreq: intel_pstate: Fix invalid EPB setting

From: Greg Kroah-Hartman
Date: Mon Nov 11 2019 - 13:50:50 EST


From: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>

commit c31432fa7f825de0e19838f1ac7746381c509ec4 upstream.

The max value of EPB can only be 0x0F. Attempting to set more than that
triggers an "unchecked MSR access error" warning which happens in
intel_pstate_hwp_force_min_perf() called via cpufreq stop_cpu().

However, it is not even necessary to touch the EPB from intel_pstate,
because it is restored on every CPU online by the intel_epb.c code,
so let that code do the right thing and drop the redundant (and
incorrect) EPB update from intel_pstate.

Fixes: af3b7379e2d70 ("cpufreq: intel_pstate: Force HWP min perf before offline")
Reported-by: Qian Cai <cai@xxxxxx>
Cc: 5.2+ <stable@xxxxxxxxxxxxxxx> # 5.2+
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>
[ rjw: Changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/cpufreq/intel_pstate.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -846,11 +846,9 @@ static void intel_pstate_hwp_force_min_p
value |= HWP_MAX_PERF(min_perf);
value |= HWP_MIN_PERF(min_perf);

- /* Set EPP/EPB to min */
+ /* Set EPP to min */
if (boot_cpu_has(X86_FEATURE_HWP_EPP))
value |= HWP_ENERGY_PERF_PREFERENCE(HWP_EPP_POWERSAVE);
- else
- intel_pstate_set_epb(cpu, HWP_EPP_BALANCE_POWERSAVE);

wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value);
}