]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
thermal: intel: Avoid updating unsupported THERM_STATUS_CLEAR mask bits
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Mon, 10 Apr 2023 17:35:01 +0000 (10:35 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 11 Apr 2023 16:12:19 +0000 (18:12 +0200)
commit117e4e5bd9d47b89777dbf6b37a709dcfe59520f
treed347d7e4a484256b0034a7048bf5a31e4b19b9bb
parent09a9639e56c01c7a00d6c0ca63f4c7c41abe075d
thermal: intel: Avoid updating unsupported THERM_STATUS_CLEAR mask bits

Some older processors don't allow BIT(13) and BIT(15) in the current
mask set by "THERM_STATUS_CLEAR_CORE_MASK". This results in:

unchecked MSR access error: WRMSR to 0x19c (tried to
write 0x000000000000aaa8) at rIP: 0xffffffff816f66a6
(throttle_active_work+0xa6/0x1d0)

To avoid unchecked MSR issues, check CPUID for each relevant feature and
use that information to set the supported feature bits only in the
"clear" mask for cores. Do the same for the analogous package mask set
by "THERM_STATUS_CLEAR_PKG_MASK".

Introduce functions thermal_intr_init_core_clear_mask() and
thermal_intr_init_pkg_clear_mask() to set core and package mask bits,
respectively. These functions are called during initialization.

Fixes: 6fe1e64b6026 ("thermal: intel: Prevent accidental clearing of HFI status")
Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
Link: https://lore.kernel.org/lkml/cdf43fb423368ee3994124a9e8c9b4f8d00712c6.camel@linux.intel.com/T/
Tested-by: Rui Salvaterra <rsalvaterra@gmail.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: 6.2+ <stable@kernel.org> # 6.2+
[ rjw: Renamed 2 funtions and 2 static variables, edited subject and
  changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/thermal/intel/therm_throt.c