Skip to content

Commit b031365

Browse files
Richa Bhartigregkh
authored andcommitted
cpufreq: intel_pstate: Check IDA only before MSR_IA32_PERF_CTL writes
[ Upstream commit 4b747cc ] Commit ac4e04d ("cpufreq: intel_pstate: Unchecked MSR aceess in legacy mode") introduced a check for feature X86_FEATURE_IDA to verify turbo mode support. Although this is the correct way to check for turbo mode support, it causes issues on some platforms that disable turbo during OS boot, but enable it later [1]. Before adding this feature check, users were able to get turbo mode frequencies by writing 0 to /sys/devices/system/cpu/intel_pstate/no_turbo post-boot. To restore the old behavior on the affected systems while still addressing the unchecked MSR issue on some Skylake-X systems, check X86_FEATURE_IDA only immediately before updates of MSR_IA32_PERF_CTL that may involve setting the Turbo Engage Bit (bit 32). Fixes: ac4e04d ("cpufreq: intel_pstate: Unchecked MSR aceess in legacy mode") Reported-by: Aaron Rainbolt <arainbolt@kfocus.org> Closes: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2122531 [1] Tested-by: Aaron Rainbolt <arainbolt@kfocus.org> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> [ rjw: Subject adjustment, changelog edits ] Link: https://patch.msgid.link/20251111010840.141490-1-srinivas.pandruvada@linux.intel.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> [ richa: Backport to 6.12.y with context adjustments ] Signed-off-by: Richa Bharti <richa.bharti@siemens.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c4d18e9 commit b031365

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

drivers/cpufreq/intel_pstate.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -600,9 +600,6 @@ static bool turbo_is_disabled(void)
600600
{
601601
u64 misc_en;
602602

603-
if (!cpu_feature_enabled(X86_FEATURE_IDA))
604-
return true;
605-
606603
rdmsrl(MSR_IA32_MISC_ENABLE, misc_en);
607604

608605
return !!(misc_en & MSR_IA32_MISC_ENABLE_TURBO_DISABLE);
@@ -2018,7 +2015,8 @@ static u64 atom_get_val(struct cpudata *cpudata, int pstate)
20182015
u32 vid;
20192016

20202017
val = (u64)pstate << 8;
2021-
if (READ_ONCE(global.no_turbo) && !READ_ONCE(global.turbo_disabled))
2018+
if (READ_ONCE(global.no_turbo) && !READ_ONCE(global.turbo_disabled) &&
2019+
cpu_feature_enabled(X86_FEATURE_IDA))
20222020
val |= (u64)1 << 32;
20232021

20242022
vid_fp = cpudata->vid.min + mul_fp(
@@ -2183,7 +2181,8 @@ static u64 core_get_val(struct cpudata *cpudata, int pstate)
21832181
u64 val;
21842182

21852183
val = (u64)pstate << 8;
2186-
if (READ_ONCE(global.no_turbo) && !READ_ONCE(global.turbo_disabled))
2184+
if (READ_ONCE(global.no_turbo) && !READ_ONCE(global.turbo_disabled) &&
2185+
cpu_feature_enabled(X86_FEATURE_IDA))
21872186
val |= (u64)1 << 32;
21882187

21892188
return val;

0 commit comments

Comments
 (0)