]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
platform/x86: ISST: Check HWP support before MSR access
authorLi RongQing <lirongqing@baidu.com>
Tue, 3 Mar 2026 07:46:35 +0000 (02:46 -0500)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 23 Mar 2026 12:48:57 +0000 (14:48 +0200)
On some systems, HWP can be explicitly disabled in the BIOS settings
When HWP is disabled by firmware, the HWP CPUID bit is not set, and
attempting to read MSR_PM_ENABLE will result in a General Protection
(GP) fault.

  unchecked MSR access error: RDMSR from 0x770 at rIP: 0xffffffffc33db92e (disable_dynamic_sst_features+0xe/0x50 [isst_tpmi_core])
  Call Trace:
   <TASK>
   ? ex_handler_msr+0xf6/0x150
   ? fixup_exception+0x1ad/0x340
   ? gp_try_fixup_and_notify+0x1e/0xb0
   ? exc_general_protection+0xc9/0x390
   ? terminate_walk+0x64/0x100
   ? asm_exc_general_protection+0x22/0x30
   ? disable_dynamic_sst_features+0xe/0x50 [isst_tpmi_core]
   isst_if_def_ioctl+0xece/0x1050 [isst_tpmi_core]
   ? ioctl_has_perm.constprop.42+0xe0/0x130
   isst_if_def_ioctl+0x10d/0x1a0 [isst_if_common]
   __se_sys_ioctl+0x86/0xc0
   do_syscall_64+0x8a/0x100
   entry_SYSCALL_64_after_hwframe+0x78/0xe2
  RIP: 0033:0x7f36eaef54a7

Add a check for X86_FEATURE_HWP before accessing the MSR. If HWP is
not available, return true safely.

Fixes: 12a7d2cb811d ("platform/x86: ISST: Add SST-CP support via TPMI")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://patch.msgid.link/20260303074635.2218-1-lirongqing@baidu.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c

index b8cdaa233ea9ceec1101603b34ada9bc7a67fece..6f46cbb2898fdfaf0bbdc635530113c1f0a823af 100644 (file)
@@ -558,6 +558,9 @@ static bool disable_dynamic_sst_features(void)
 {
        u64 value;
 
+       if (!static_cpu_has(X86_FEATURE_HWP))
+               return true;
+
        rdmsrq(MSR_PM_ENABLE, value);
        return !(value & 0x1);
 }