Skip to content

Commit 9c68a3b

Browse files
gautshensuperm1
authored andcommitted
cpufreq/amd-pstate: Remove warning for X86_FEATURE_CPPC on certain Zen models
commit bff7d13 ("cpufreq: amd-pstate: add debug message while CPPC is supported and disabled by SBIOS") issues a warning on plaforms where the X86_FEATURE_CPPC is expected to be enabled, but is not due to it being disabled in the BIOS. This feature bit corresponds to CPUID 0x80000008.ebx[27] which is a reserved bit on the Zen1 processors and a reserved bit on Zen2 based models 0x70-0x7F, and is expected to be cleared on these platforms. Thus printing the warning message for these models when X86_FEATURE_CPPC is unavailable is incorrect. Fix this. Modify some of the comments, and use switch-case for model range checking for improved readability while at it. Fixes: bff7d13 ("cpufreq: amd-pstate: add debug message while CPPC is supported and disabled by SBIOS") Cc: Xiaojian Du <[email protected]> Reported-by: David Wang <[email protected]> Closes: https://lore.kernel.org/lkml/[email protected]/ Signed-off-by: Gautham R. Shenoy <[email protected]> Acked-by: Mario Limonciello <[email protected]> Signed-off-by: Mario Limonciello <[email protected]>
1 parent 9983a9c commit 9c68a3b

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,20 +1834,34 @@ static bool amd_cppc_supported(void)
18341834
}
18351835

18361836
/*
1837-
* If the CPPC feature is disabled in the BIOS for processors that support MSR-based CPPC,
1838-
* the AMD Pstate driver may not function correctly.
1839-
* Check the CPPC flag and display a warning message if the platform supports CPPC.
1840-
* Note: below checking code will not abort the driver registeration process because of
1841-
* the code is added for debugging purposes.
1837+
* If the CPPC feature is disabled in the BIOS for processors
1838+
* that support MSR-based CPPC, the AMD Pstate driver may not
1839+
* function correctly.
1840+
*
1841+
* For such processors, check the CPPC flag and display a
1842+
* warning message if the platform supports CPPC.
1843+
*
1844+
* Note: The code check below will not abort the driver
1845+
* registration process because of the code is added for
1846+
* debugging purposes. Besides, it may still be possible for
1847+
* the driver to work using the shared-memory mechanism.
18421848
*/
18431849
if (!cpu_feature_enabled(X86_FEATURE_CPPC)) {
1844-
if (cpu_feature_enabled(X86_FEATURE_ZEN1) || cpu_feature_enabled(X86_FEATURE_ZEN2)) {
1845-
if (c->x86_model > 0x60 && c->x86_model < 0xaf)
1850+
if (cpu_feature_enabled(X86_FEATURE_ZEN2)) {
1851+
switch (c->x86_model) {
1852+
case 0x60 ... 0x6F:
1853+
case 0x80 ... 0xAF:
18461854
warn = true;
1847-
} else if (cpu_feature_enabled(X86_FEATURE_ZEN3) || cpu_feature_enabled(X86_FEATURE_ZEN4)) {
1848-
if ((c->x86_model > 0x10 && c->x86_model < 0x1F) ||
1849-
(c->x86_model > 0x40 && c->x86_model < 0xaf))
1855+
break;
1856+
}
1857+
} else if (cpu_feature_enabled(X86_FEATURE_ZEN3) ||
1858+
cpu_feature_enabled(X86_FEATURE_ZEN4)) {
1859+
switch (c->x86_model) {
1860+
case 0x10 ... 0x1F:
1861+
case 0x40 ... 0xAF:
18501862
warn = true;
1863+
break;
1864+
}
18511865
} else if (cpu_feature_enabled(X86_FEATURE_ZEN5)) {
18521866
warn = true;
18531867
}

0 commit comments

Comments
 (0)