]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cpufreq/amd-pstate: Prevent the driver from loading on unsupported hardware
authorRong Zhang <i@rong.moe>
Tue, 21 Jul 2026 18:13:43 +0000 (02:13 +0800)
committerMario Limonciello <superm1@kernel.org>
Wed, 22 Jul 2026 18:45:32 +0000 (13:45 -0500)
X86_FEATURE_HW_PSTATE indicates if the processor supports frequency
scaling or not. Without it, the driver is unusable and thus will not
load. This check also prevents the driver from loading in guests and
thus not confuse users with misleading prints.

Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Tested-by: Michael Kelley <mhklinux@outlook.com>
Acked-by: Mario Limonciello (AMD) <superm1@kernel.org>
Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Rong Zhang <i@rong.moe>
Link: https://lore.kernel.org/r/20260722-amd-pstate-vm-v4-1-d6607d9e9d9a@rong.moe
Signed-off-by: Mario Limonciello <superm1@kernel.org>
drivers/cpufreq/amd-pstate.c

index 3d72337a3336914d922d8e908d5e2ac0d34d4b7b..3a6b4b224a66d6bb1af3a3ea3cdca9cfd6b82690 100644 (file)
@@ -2167,6 +2167,7 @@ static struct cpufreq_driver amd_pstate_epp_driver = {
 };
 
 /*
+ * Processors without frequency scaling support can't do CPPC.
  * CPPC function is not supported for family ID 17H with model_ID ranging from 0x10 to 0x2F.
  * show the debug message that helps to check if the CPU has CPPC support for loading issue.
  */
@@ -2175,6 +2176,11 @@ static bool amd_cppc_supported(void)
        struct cpuinfo_x86 *c = &cpu_data(0);
        bool warn = false;
 
+       if (!cpu_feature_enabled(X86_FEATURE_HW_PSTATE)) {
+               pr_debug_once("frequency scaling is not supported by the processor\n");
+               return false;
+       }
+
        if ((boot_cpu_data.x86 == 0x17) && (boot_cpu_data.x86_model < 0x30)) {
                pr_debug_once("CPPC feature is not supported by the processor\n");
                return false;