Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit bff7d13

Browse files
Perry Yuansuperm1
authored andcommitted
cpufreq: amd-pstate: add debug message while CPPC is supported and disabled by SBIOS
If CPPC feature is supported by the CPU however the CPUID flag bit is not set by SBIOS, the `amd_pstate` will be failed to load while system booting. So adding one more debug message to inform user to check the SBIOS setting, The change also can help maintainers to debug why amd_pstate driver failed to be loaded at system booting if the processor support CPPC. Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218686 Signed-off-by: Perry Yuan <perry.yuan@amd.com> Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com> Acked-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://lore.kernel.org/r/42c953616ac121bd1e5c329e83d015a02e6b32c7.1718811234.git.perry.yuan@amd.com Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
1 parent cb817ec commit bff7d13

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,11 +1749,37 @@ static int __init amd_pstate_set_driver(int mode_idx)
17491749
*/
17501750
static bool amd_cppc_supported(void)
17511751
{
1752+
struct cpuinfo_x86 *c = &cpu_data(0);
1753+
bool warn = false;
1754+
17521755
if ((boot_cpu_data.x86 == 0x17) && (boot_cpu_data.x86_model < 0x30)) {
17531756
pr_debug_once("CPPC feature is not supported by the processor\n");
17541757
return false;
17551758
}
17561759

1760+
/*
1761+
* If the CPPC feature is disabled in the BIOS for processors that support MSR-based CPPC,
1762+
* the AMD Pstate driver may not function correctly.
1763+
* Check the CPPC flag and display a warning message if the platform supports CPPC.
1764+
* Note: below checking code will not abort the driver registeration process because of
1765+
* the code is added for debugging purposes.
1766+
*/
1767+
if (!cpu_feature_enabled(X86_FEATURE_CPPC)) {
1768+
if (cpu_feature_enabled(X86_FEATURE_ZEN1) || cpu_feature_enabled(X86_FEATURE_ZEN2)) {
1769+
if (c->x86_model > 0x60 && c->x86_model < 0xaf)
1770+
warn = true;
1771+
} else if (cpu_feature_enabled(X86_FEATURE_ZEN3) || cpu_feature_enabled(X86_FEATURE_ZEN4)) {
1772+
if ((c->x86_model > 0x10 && c->x86_model < 0x1F) ||
1773+
(c->x86_model > 0x40 && c->x86_model < 0xaf))
1774+
warn = true;
1775+
} else if (cpu_feature_enabled(X86_FEATURE_ZEN5)) {
1776+
warn = true;
1777+
}
1778+
}
1779+
1780+
if (warn)
1781+
pr_warn_once("The CPPC feature is supported but currently disabled by the BIOS.\n"
1782+
"Please enable it if your BIOS has the CPPC option.\n");
17571783
return true;
17581784
}
17591785

0 commit comments

Comments
 (0)