mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 23:59:33 -04:00
cpufreq/amd-pstate: Prevent the driver from loading on unsupported hardware
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>
This commit is contained in:
committed by
Mario Limonciello
parent
6842427bf2
commit
08fc1e7b31
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user