* [PATCH v2] cpufreq/amd-pstate: Bail out early if !X86_FEATURE_HW_PSTATE
@ 2026-07-18 15:15 Rong Zhang
2026-07-19 15:03 ` mhklkml
2026-07-20 5:14 ` K Prateek Nayak
0 siblings, 2 replies; 3+ messages in thread
From: Rong Zhang @ 2026-07-18 15:15 UTC (permalink / raw)
To: Huang Rui, Mario Limonciello, Perry Yuan, K Prateek Nayak,
Rafael J. Wysocki, Viresh Kumar, Borislav Petkov, Jason Andryuk
Cc: Michael Kelley, linux-pm, linux-kernel, Rong Zhang
When booting a VM that simulates or passes-through a relatively new CPU
model, these warning messages are printed to kmsg:
amd_pstate: The CPPC feature is supported but currently disabled by the BIOS.
Please enable it if your BIOS has the CPPC option.
amd_pstate: the _CPC object is not present in SBIOS or ACPI disabled
Technically the check is not wrong and acts as a safetynet that prevents
the driver from being registered incorrectly, but the warning messages
are noisy and incorrect, as the CPPC feature is neither supported in a
VM nor disabled by the VM's BIOS.
The CPPC feature is disabled by the hypervisor as it makes no sense to
expose them to guests. It creates a paradox that the same kernel both
disables CPPC as a hypervisor (KVM) and warns about it being disabled
as a guest.
X86_FEATURE_HW_PSTATE indicates if the platform supports frequency
scaling or not. It is disabled on virtualized platforms (namely, KVM and
Hyper-V have been reported to do so) and is always set on physical
platforms that support frequency scaling.
Check for X86_FEATURE_HW_PSTATE as a prerequisite and bail out early if
it's unsupported.
Fixes: cb817ec6673b ("cpufreq: amd-pstate: show CPPC debug message if CPPC is not supported")
Signed-off-by: Rong Zhang <i@rong.moe>
---
Changes in v2:
- Check for X86_FEATURE_HW_PSTATE instead of X86_FEATURE_HYPERVISOR
(thanks K Prateek Nayak)
- Remove the check against Xen dom0, as it doesn't need the amd-pstate
driver (thanks Jason Andryuk)
- Reword comments and the commit message
- Remove Gautham R. Shenoy from the To list due to email bounces
- Link to v1: https://patch.msgid.link/20260716-amd-pstate-vm-v1-1-2ac97d3cf6e7@rong.moe
---
drivers/cpufreq/amd-pstate.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index a74a4cf99d22..877b4b30ecd0 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -2228,6 +2228,13 @@ static int __init amd_pstate_init(void)
if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
return -ENODEV;
+ /*
+ * Do not continue on the following checks and emit bogus warning
+ * messages if the platform doesn't support frequency scaling at all.
+ */
+ if (!cpu_feature_enabled(X86_FEATURE_HW_PSTATE))
+ return -ENODEV;
+
/* show debug message only if CPPC is not supported */
if (!amd_cppc_supported())
return -EOPNOTSUPP;
---
base-commit: 94515f3a7d4256a5062176b7d6ed0471938cd51a
change-id: 1cc24037-amd-pstate-vm-d6ab4c959bd3
Thanks,
Rong
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH v2] cpufreq/amd-pstate: Bail out early if !X86_FEATURE_HW_PSTATE
2026-07-18 15:15 [PATCH v2] cpufreq/amd-pstate: Bail out early if !X86_FEATURE_HW_PSTATE Rong Zhang
@ 2026-07-19 15:03 ` mhklkml
2026-07-20 5:14 ` K Prateek Nayak
1 sibling, 0 replies; 3+ messages in thread
From: mhklkml @ 2026-07-19 15:03 UTC (permalink / raw)
To: 'Rong Zhang', 'Huang Rui',
'Mario Limonciello', 'Perry Yuan',
'K Prateek Nayak', 'Rafael J. Wysocki',
'Viresh Kumar', 'Borislav Petkov',
'Jason Andryuk'
Cc: 'Michael Kelley', linux-pm, linux-kernel
From: Rong Zhang <i@rong.moe> Sent: Saturday, July 18, 2026 8:16 AM
>
> When booting a VM that simulates or passes-through a relatively new CPU
> model, these warning messages are printed to kmsg:
>
> amd_pstate: The CPPC feature is supported but currently disabled by the BIOS.
> Please enable it if your BIOS has the CPPC option.
> amd_pstate: the _CPC object is not present in SBIOS or ACPI disabled
>
> Technically the check is not wrong and acts as a safetynet that prevents
> the driver from being registered incorrectly, but the warning messages
> are noisy and incorrect, as the CPPC feature is neither supported in a
> VM nor disabled by the VM's BIOS.
>
> The CPPC feature is disabled by the hypervisor as it makes no sense to
> expose them to guests. It creates a paradox that the same kernel both
> disables CPPC as a hypervisor (KVM) and warns about it being disabled
> as a guest.
>
> X86_FEATURE_HW_PSTATE indicates if the platform supports frequency
> scaling or not. It is disabled on virtualized platforms (namely, KVM and
> Hyper-V have been reported to do so) and is always set on physical
> platforms that support frequency scaling.
>
> Check for X86_FEATURE_HW_PSTATE as a prerequisite and bail out early if
> it's unsupported.
>
> Fixes: cb817ec6673b ("cpufreq: amd-pstate: show CPPC debug message if CPPC is not supported")
> Signed-off-by: Rong Zhang <i@rong.moe>
Built a kernel with this patch against linux-next20260717. Tested
on guests in the Azure public cloud, which are running on Hyper-V.
Tested where the underlying processor is a Zen2, and also on a
Zen4. The warning messages are gone as expected.
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Tested-by: Michael Kelley <mhklinux@outlook.com>
> ---
> Changes in v2:
> - Check for X86_FEATURE_HW_PSTATE instead of X86_FEATURE_HYPERVISOR
> (thanks K Prateek Nayak)
> - Remove the check against Xen dom0, as it doesn't need the amd-pstate
> driver (thanks Jason Andryuk)
> - Reword comments and the commit message
> - Remove Gautham R. Shenoy from the To list due to email bounces
> - Link to v1: https://patch.msgid.link/20260716-amd-pstate-vm-v1-1-
> 2ac97d3cf6e7@rong.moe
> ---
> drivers/cpufreq/amd-pstate.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index a74a4cf99d22..877b4b30ecd0 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -2228,6 +2228,13 @@ static int __init amd_pstate_init(void)
> if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
> return -ENODEV;
>
> + /*
> + * Do not continue on the following checks and emit bogus warning
> + * messages if the platform doesn't support frequency scaling at all.
> + */
> + if (!cpu_feature_enabled(X86_FEATURE_HW_PSTATE))
> + return -ENODEV;
> +
> /* show debug message only if CPPC is not supported */
> if (!amd_cppc_supported())
> return -EOPNOTSUPP;
>
> ---
> base-commit: 94515f3a7d4256a5062176b7d6ed0471938cd51a
> change-id: 1cc24037-amd-pstate-vm-d6ab4c959bd3
>
> Thanks,
> Rong
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] cpufreq/amd-pstate: Bail out early if !X86_FEATURE_HW_PSTATE
2026-07-18 15:15 [PATCH v2] cpufreq/amd-pstate: Bail out early if !X86_FEATURE_HW_PSTATE Rong Zhang
2026-07-19 15:03 ` mhklkml
@ 2026-07-20 5:14 ` K Prateek Nayak
1 sibling, 0 replies; 3+ messages in thread
From: K Prateek Nayak @ 2026-07-20 5:14 UTC (permalink / raw)
To: Rong Zhang, Huang Rui, Mario Limonciello, Perry Yuan,
Rafael J. Wysocki, Viresh Kumar, Borislav Petkov, Jason Andryuk
Cc: Michael Kelley, linux-pm, linux-kernel
Hello Rong,
On 7/18/2026 8:45 PM, Rong Zhang wrote:
> When booting a VM that simulates or passes-through a relatively new CPU
> model, these warning messages are printed to kmsg:
>
> amd_pstate: The CPPC feature is supported but currently disabled by the BIOS.
> Please enable it if your BIOS has the CPPC option.
This is message is printed from amd_cppc_supported() ...
> amd_pstate: the _CPC object is not present in SBIOS or ACPI disabled
>
[..snip..]
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index a74a4cf99d22..877b4b30ecd0 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -2228,6 +2228,13 @@ static int __init amd_pstate_init(void)
> if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
> return -ENODEV;
>
> + /*
> + * Do not continue on the following checks and emit bogus warning
> + * messages if the platform doesn't support frequency scaling at all.
> + */
> + if (!cpu_feature_enabled(X86_FEATURE_HW_PSTATE))
> + return -ENODEV;
... so why add this check in amd_pstate_init()?
I personally prefer having the check in amd_cppc_supported() and
returning false from there with a pr_debug_once() saying processor does
not support frequency scaling.
> +
> /* show debug message only if CPPC is not supported */
> if (!amd_cppc_supported())
> return -EOPNOTSUPP;
>
> ---
> base-commit: 94515f3a7d4256a5062176b7d6ed0471938cd51a
> change-id: 1cc24037-amd-pstate-vm-d6ab4c959bd3
>
> Thanks,
> Rong
>
--
Thanks and Regards,
Prateek
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-20 5:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-18 15:15 [PATCH v2] cpufreq/amd-pstate: Bail out early if !X86_FEATURE_HW_PSTATE Rong Zhang
2026-07-19 15:03 ` mhklkml
2026-07-20 5:14 ` K Prateek Nayak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox