From: Dhananjay Ugwekar Date: Wed, 23 Oct 2024 10:21:08 +0000 (+0000) Subject: cpufreq/amd-pstate: Do not attempt to clear MSR_AMD_CPPC_ENABLE X-Git-Tag: v6.13-rc1~194^2~2^2~3^2^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=73070a9169b16e08b191066e513bce6c237c9221;p=thirdparty%2Fkernel%2Flinux.git cpufreq/amd-pstate: Do not attempt to clear MSR_AMD_CPPC_ENABLE MSR_AMD_CPPC_ENABLE is a write once register, i.e. attempting to clear it is futile, it will not take effect. Hence, return if disable (0) argument is passed to the msr_cppc_enable() Signed-off-by: Dhananjay Ugwekar Reviewed-by: Mario Limonciello Reviewed-by: Gautham R. Shenoy Link: https://lore.kernel.org/r/20241023102108.5980-3-Dhananjay.Ugwekar@amd.com Signed-off-by: Mario Limonciello --- diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 0b4a4d69c14d7..576251e61ce07 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -311,6 +311,12 @@ static inline int msr_cppc_enable(bool enable) int ret, cpu; unsigned long logical_proc_id_mask = 0; + /* + * MSR_AMD_CPPC_ENABLE is write-once, once set it cannot be cleared. + */ + if (!enable) + return 0; + if (enable == cppc_enabled) return 0;