Power management fix for 6.10-rc4

Restore the behavior of the no_turbo sysfs attribute in the
 intel_pstate driver which allowed users to make the driver start
 using turbo P-states if they have been enabled on the fly by the
 firmware after OS initialization (Rafael Wysocki).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmZsQmUSHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxyEwP/jBBYEeXi5vBq+UqEOtHVwgvN5hwXaTe
 yrij1GhC25rea13itX2db3cffFXmrC+abixYa4tv1oXjtghKZtRofGJQe/URpLnG
 mAIDChu4OPb1WQkMWz+ZeE0FAjCEPNPi/2d63mA65ZZVRAj7T/gw0wjUq/5Ib2ZH
 Vcf3jUZ8sk92POb5EM1h1K5Nk57R8Ays3j5c8+D+w81Jzc2Cebm7K8kOEFoeWSVI
 1MlDyekfUh/9u7ndGdMt29NdSwATxBUDuC6BsbfbrqbLEub6LDtFowBj64aJBnwC
 HRsvIVvVbuMRhVPpodUmsBEPGCvwQCA/vBM8SuR0HDdvCBiRdxAm5kK3T0+I6TEU
 fGciNt5VJBmzrhfEJ8tBoko85RJmuuwxX1CAdUbNiUBMMy4B6kdE8A/Hwd3oBFgp
 fzMFxvk2e0YCgADdoCTI522M6IM9Mei7LfWa2E4jDC3E1Pjy78dpmL5fdiuQUlTD
 zZLTcqoT+v6ztSyukR8szVbzqXOPKDqdlnuXMh6RGs5RloD4R1BZHD7r/TPqM9I6
 I18BBKi63TexF0USYEwqia2kFDldW+u84XU0tgqIwBcOA0Y4u94RJXDkeymDLmhe
 pbHnF7T16VpJ9OqqwoplhXu4p4xwkKNIFmBf7hTg7IKfHLOSJqyXUymwJOdq/tiH
 OcXBuIkeTlRg
 =LBok
 -----END PGP SIGNATURE-----

Merge tag 'pm-6.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fix from Rafael Wysocki:
 "Restore the behavior of the no_turbo sysfs attribute in the
  intel_pstate driver which allowed users to make the driver start using
  turbo P-states if they have been enabled on the fly by the firmware
  after OS initialization (Rafael Wysocki)"

* tag 'pm-6.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  cpufreq: intel_pstate: Check turbo_is_disabled() in store_no_turbo()
This commit is contained in:
Linus Torvalds 2024-06-14 09:52:51 -07:00
commit 0cac73eb38

View File

@ -1302,12 +1302,17 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b,
no_turbo = !!clamp_t(int, input, 0, 1);
if (no_turbo == global.no_turbo)
goto unlock_driver;
if (global.turbo_disabled) {
pr_notice_once("Turbo disabled by BIOS or unavailable on processor\n");
WRITE_ONCE(global.turbo_disabled, turbo_is_disabled());
if (global.turbo_disabled && !no_turbo) {
pr_notice("Turbo disabled by BIOS or unavailable on processor\n");
count = -EPERM;
if (global.no_turbo)
goto unlock_driver;
else
no_turbo = 1;
}
if (no_turbo == global.no_turbo) {
goto unlock_driver;
}
@ -1762,7 +1767,7 @@ static u64 atom_get_val(struct cpudata *cpudata, int pstate)
u32 vid;
val = (u64)pstate << 8;
if (READ_ONCE(global.no_turbo) && !global.turbo_disabled)
if (READ_ONCE(global.no_turbo) && !READ_ONCE(global.turbo_disabled))
val |= (u64)1 << 32;
vid_fp = cpudata->vid.min + mul_fp(
@ -1927,7 +1932,7 @@ static u64 core_get_val(struct cpudata *cpudata, int pstate)
u64 val;
val = (u64)pstate << 8;
if (READ_ONCE(global.no_turbo) && !global.turbo_disabled)
if (READ_ONCE(global.no_turbo) && !READ_ONCE(global.turbo_disabled))
val |= (u64)1 << 32;
return val;