cpufreq: intel_pstate: Fix intel_pstate_get_hwp_max() for turbo disabled
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 1 Sep 2020 03:02:50 +0000 (20:02 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Sep 2020 11:55:36 +0000 (13:55 +0200)
commitd1df83979d57b8bd1e01c43dc44c2fe61c5b6d26
treea83e4ee8430ecffa41e1edac1059aa5f00d5940e
parent4b65cda38fc88c2796da2b19007f8f62447c8d85
cpufreq: intel_pstate: Fix intel_pstate_get_hwp_max() for turbo disabled

[ Upstream commit eacc9c5a927e474c173a5d53dd7fb8e306511768 ]

This fixes the behavior of the scaling_max_freq and scaling_min_freq
sysfs files in systems which had turbo disabled by the BIOS.

Caleb noticed that the HWP is programmed to operate in the wrong
P-state range on his system when the CPUFREQ policy min/max frequency
is set via sysfs.  This seems to be because in his system
intel_pstate_get_hwp_max() is returning the maximum turbo P-state even
though turbo was disabled by the BIOS, which causes intel_pstate to
scale kHz frequencies incorrectly e.g. setting the maximum turbo
frequency whenever the maximum guaranteed frequency is requested via
sysfs.

Tested-by: Caleb Callaway <caleb.callaway@intel.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ rjw: Minor subject edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/cpufreq/intel_pstate.c