* [PATCH] cpufreq/amd-pstate: Bail out early in virtual machines and don't warn
@ 2026-07-15 17:41 Rong Zhang
2026-07-15 17:46 ` Mario Limonciello
2026-07-16 18:00 ` K Prateek Nayak
0 siblings, 2 replies; 11+ messages in thread
From: Rong Zhang @ 2026-07-15 17:41 UTC (permalink / raw)
To: Huang Rui, Mario Limonciello, Perry Yuan, K Prateek Nayak,
Rafael J. Wysocki, Viresh Kumar, Gautham R. Shenoy
Cc: linux-pm, linux-kernel, Rong Zhang
When booting a virtual machine that simulates or passes-through a
relatively new CPUID, one or two 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 not really helpful, as virtual machines cannot adjust the
CPU frequency from the very beginning. Moreover, mentioning BIOS here
makes the messages even more confusing.
Fix it by bailing out early when running in virtual machines (excluding
Xen Dom0).
Fixes: cb817ec6673b ("cpufreq: amd-pstate: show CPPC debug message if CPPC is not supported")
Signed-off-by: Rong Zhang <i@rong.moe>
---
drivers/cpufreq/amd-pstate.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index a74a4cf99d22..f2115f935318 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -2228,6 +2228,9 @@ static int __init amd_pstate_init(void)
if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
return -ENODEV;
+ if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR) && !xen_initial_domain())
+ return -ENODEV;
+
/* show debug message only if CPPC is not supported */
if (!amd_cppc_supported())
return -EOPNOTSUPP;
---
base-commit: 58717b2a1365d06c8c64b72aa948541b53fe31eb
change-id: 1cc24037-amd-pstate-vm-d6ab4c959bd3
Thanks,
Rong
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] cpufreq/amd-pstate: Bail out early in virtual machines and don't warn
2026-07-15 17:41 [PATCH] cpufreq/amd-pstate: Bail out early in virtual machines and don't warn Rong Zhang
@ 2026-07-15 17:46 ` Mario Limonciello
2026-07-15 18:04 ` Borislav Petkov
2026-07-16 18:00 ` K Prateek Nayak
1 sibling, 1 reply; 11+ messages in thread
From: Mario Limonciello @ 2026-07-15 17:46 UTC (permalink / raw)
To: Rong Zhang, Huang Rui, Perry Yuan, K Prateek Nayak, Andryuk,
Jason, Borislav Petkov
Cc: linux-pm, linux-kernel, Rafael J. Wysocki, Viresh Kumar
+Jason
+Boris
On 7/15/26 12:41, Rong Zhang wrote:
> When booting a virtual machine that simulates or passes-through a
> relatively new CPUID, one or two 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 not really helpful, as virtual machines cannot adjust the
> CPU frequency from the very beginning. Moreover, mentioning BIOS here
> makes the messages even more confusing.
>
> Fix it by bailing out early when running in virtual machines (excluding
> Xen Dom0).
Conceptually this makes sense to me, but I would like some comments from
others if this is the right way forward.
Jason, Boris,
comments please?
>
> Fixes: cb817ec6673b ("cpufreq: amd-pstate: show CPPC debug message if CPPC is not supported")
> Signed-off-by: Rong Zhang <i@rong.moe>
> ---
> drivers/cpufreq/amd-pstate.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index a74a4cf99d22..f2115f935318 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -2228,6 +2228,9 @@ static int __init amd_pstate_init(void)
> if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
> return -ENODEV;
>
> + if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR) && !xen_initial_domain())
> + return -ENODEV;
> +
> /* show debug message only if CPPC is not supported */
> if (!amd_cppc_supported())
> return -EOPNOTSUPP;
>
> ---
> base-commit: 58717b2a1365d06c8c64b72aa948541b53fe31eb
> change-id: 1cc24037-amd-pstate-vm-d6ab4c959bd3
>
> Thanks,
> Rong
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] cpufreq/amd-pstate: Bail out early in virtual machines and don't warn
2026-07-15 17:46 ` Mario Limonciello
@ 2026-07-15 18:04 ` Borislav Petkov
2026-07-15 19:21 ` Rong Zhang
0 siblings, 1 reply; 11+ messages in thread
From: Borislav Petkov @ 2026-07-15 18:04 UTC (permalink / raw)
To: Mario Limonciello
Cc: Rong Zhang, Huang Rui, Perry Yuan, K Prateek Nayak, Andryuk,
Jason, linux-pm, linux-kernel, Rafael J. Wysocki, Viresh Kumar
On Wed, Jul 15, 2026 at 12:46:24PM -0500, Mario Limonciello wrote:
> Conceptually this makes sense to me, but I would like some comments from
> others if this is the right way forward.
>
> Jason, Boris,
>
> comments please?
We don't care if someone "passes-through a relatively new CPUID" - I am not
sure what that means - but we won't patch the upstream kernel just because it
dumped an error message in the guest.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] cpufreq/amd-pstate: Bail out early in virtual machines and don't warn
2026-07-15 18:04 ` Borislav Petkov
@ 2026-07-15 19:21 ` Rong Zhang
2026-07-15 20:32 ` Jason Andryuk
2026-07-16 17:44 ` Michael Kelley
0 siblings, 2 replies; 11+ messages in thread
From: Rong Zhang @ 2026-07-15 19:21 UTC (permalink / raw)
To: Borislav Petkov, Mario Limonciello
Cc: Huang Rui, Perry Yuan, K Prateek Nayak, Andryuk, Jason, linux-pm,
linux-kernel, Rafael J. Wysocki, Viresh Kumar
Hi Borislav,
Thanks for reviewing the patch.
On Wed, 2026-07-15 at 11:04 -0700, Borislav Petkov wrote:
> On Wed, Jul 15, 2026 at 12:46:24PM -0500, Mario Limonciello wrote:
> > Conceptually this makes sense to me, but I would like some comments from
> > others if this is the right way forward.
> >
> > Jason, Boris,
> >
> > comments please?
>
> We don't care if someone "passes-through a relatively new CPUID" - I am not
> sure what that means -
>
Sorry, typo here. I meant CPU model.
I usually boot a KVM with `qemu-system-x86_64 -accel kvm -cpu host
<other_args...>' to test various patches. These messages is a bit
disturbing to me as they are KERN_WARNING messages.
FYI, my device is Zen 5 based and always triggers both messages.
I can also reproduce both messages with `-cpu EPYC-Genoa' and `-cpu
EPYC-Turin'. It's just due to how amd_cppc_supported() is implemented.
> but we won't patch the upstream kernel just because it
> dumped an error message in the guest.
Well, the reason why I decided to send this is not only about how noisy
it is, but also about the correctness.
The first messages says:
The CPPC feature is supported but currently disabled by the BIOS.
Please enable it if your BIOS has the CPPC option.
The CPPC feature is neither supported in a KVM nor disabled by the VM's
BIOS.
IIUC, it's disabled by kvm_cpu_cap_init(CPUID_8000_0008_EBX, ...), so
the upstream kernel both disables it as a hypervisor and warns about it
as a guest. What a paradox!
At least the first message is nonsense in this case and the paradox
should really be fixed. If you prefer preserving the second message
("the _CPC object is not present in SBIOS or ACPI disabled") as an
informative hint anyway, how about moving the virtualization check into
amd_cppc_supported() to only mute the first one? ;-)
Thanks,
Rong
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] cpufreq/amd-pstate: Bail out early in virtual machines and don't warn
2026-07-15 19:21 ` Rong Zhang
@ 2026-07-15 20:32 ` Jason Andryuk
2026-07-15 20:54 ` Mario Limonciello
2026-07-15 22:58 ` Borislav Petkov
2026-07-16 17:44 ` Michael Kelley
1 sibling, 2 replies; 11+ messages in thread
From: Jason Andryuk @ 2026-07-15 20:32 UTC (permalink / raw)
To: Rong Zhang, Borislav Petkov, Mario Limonciello
Cc: Huang Rui, Perry Yuan, K Prateek Nayak, linux-pm, linux-kernel,
Rafael J. Wysocki, Viresh Kumar
On 2026-07-15 15:21, Rong Zhang wrote:
> Hi Borislav,
>
> Thanks for reviewing the patch.
>
> On Wed, 2026-07-15 at 11:04 -0700, Borislav Petkov wrote:
>> On Wed, Jul 15, 2026 at 12:46:24PM -0500, Mario Limonciello wrote:
>>> Conceptually this makes sense to me, but I would like some comments from
>>> others if this is the right way forward.
>>>
>>> Jason, Boris,
>>>
>>> comments please?
>>
>> We don't care if someone "passes-through a relatively new CPUID" - I am not
>> sure what that means -
>>
>
> Sorry, typo here. I meant CPU model.
>
> I usually boot a KVM with `qemu-system-x86_64 -accel kvm -cpu host
> <other_args...>' to test various patches. These messages is a bit
> disturbing to me as they are KERN_WARNING messages.
>
> FYI, my device is Zen 5 based and always triggers both messages.
>
> I can also reproduce both messages with `-cpu EPYC-Genoa' and `-cpu
> EPYC-Turin'. It's just due to how amd_cppc_supported() is implemented.
>
>> but we won't patch the upstream kernel just because it
>> dumped an error message in the guest.
>
> Well, the reason why I decided to send this is not only about how noisy
> it is, but also about the correctness.
>
> The first messages says:
>
> The CPPC feature is supported but currently disabled by the BIOS.
> Please enable it if your BIOS has the CPPC option.
>
> The CPPC feature is neither supported in a KVM nor disabled by the VM's
> BIOS.
>
> IIUC, it's disabled by kvm_cpu_cap_init(CPUID_8000_0008_EBX, ...), so
> the upstream kernel both disables it as a hypervisor and warns about it
> as a guest. What a paradox!
>
> At least the first message is nonsense in this case and the paradox
> should really be fixed. If you prefer preserving the second message
> ("the _CPC object is not present in SBIOS or ACPI disabled") as an
> informative hint anyway, how about moving the virtualization check into
> amd_cppc_supported() to only mute the first one? ;-)
I think changing amd_cppc_supported() to return false for
X86_FEATURE_HYPERVISOR makes sense and can remove the message. The
heuristic there doesn't seem relevant when virtualized.
With Xen, the Xen hypervisor itself controls CPPC. dom0
(xen_initial_domain()) doesn't need the amd-pstate driver.
Regards,
Jason
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] cpufreq/amd-pstate: Bail out early in virtual machines and don't warn
2026-07-15 20:32 ` Jason Andryuk
@ 2026-07-15 20:54 ` Mario Limonciello
2026-07-15 22:58 ` Borislav Petkov
1 sibling, 0 replies; 11+ messages in thread
From: Mario Limonciello @ 2026-07-15 20:54 UTC (permalink / raw)
To: Jason Andryuk, Rong Zhang, Borislav Petkov
Cc: Huang Rui, Perry Yuan, K Prateek Nayak, linux-pm, linux-kernel,
Rafael J. Wysocki, Viresh Kumar
On 7/15/26 15:32, Jason Andryuk wrote:
> On 2026-07-15 15:21, Rong Zhang wrote:
>> Hi Borislav,
>>
>> Thanks for reviewing the patch.
>>
>> On Wed, 2026-07-15 at 11:04 -0700, Borislav Petkov wrote:
>>> On Wed, Jul 15, 2026 at 12:46:24PM -0500, Mario Limonciello wrote:
>>>> Conceptually this makes sense to me, but I would like some comments
>>>> from
>>>> others if this is the right way forward.
>>>>
>>>> Jason, Boris,
>>>>
>>>> comments please?
>>>
>>> We don't care if someone "passes-through a relatively new CPUID" - I
>>> am not
>>> sure what that means -
>>>
>>
>> Sorry, typo here. I meant CPU model.
>>
>> I usually boot a KVM with `qemu-system-x86_64 -accel kvm -cpu host
>> <other_args...>' to test various patches. These messages is a bit
>> disturbing to me as they are KERN_WARNING messages.
>>
>> FYI, my device is Zen 5 based and always triggers both messages.
>>
>> I can also reproduce both messages with `-cpu EPYC-Genoa' and `-cpu
>> EPYC-Turin'. It's just due to how amd_cppc_supported() is implemented.
>>
>>> but we won't patch the upstream kernel just because it
>>> dumped an error message in the guest.
>>
>> Well, the reason why I decided to send this is not only about how noisy
>> it is, but also about the correctness.
>>
>> The first messages says:
>>
>> The CPPC feature is supported but currently disabled by the BIOS.
>> Please enable it if your BIOS has the CPPC option.
>>
>> The CPPC feature is neither supported in a KVM nor disabled by the VM's
>> BIOS.
>>
>> IIUC, it's disabled by kvm_cpu_cap_init(CPUID_8000_0008_EBX, ...), so
>> the upstream kernel both disables it as a hypervisor and warns about it
>> as a guest. What a paradox!
>>
>> At least the first message is nonsense in this case and the paradox
>> should really be fixed. If you prefer preserving the second message
>> ("the _CPC object is not present in SBIOS or ACPI disabled") as an
>> informative hint anyway, how about moving the virtualization check into
>> amd_cppc_supported() to only mute the first one? ;-)
>
> I think changing amd_cppc_supported() to return false for
> X86_FEATURE_HYPERVISOR makes sense and can remove the message. The
> heuristic there doesn't seem relevant when virtualized.
>
> With Xen, the Xen hypervisor itself controls CPPC. dom0
> (xen_initial_domain()) doesn't need the amd-pstate driver.
>
> Regards,
> Jason
OK, Rong - please send an updated patch.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] cpufreq/amd-pstate: Bail out early in virtual machines and don't warn
2026-07-15 20:32 ` Jason Andryuk
2026-07-15 20:54 ` Mario Limonciello
@ 2026-07-15 22:58 ` Borislav Petkov
1 sibling, 0 replies; 11+ messages in thread
From: Borislav Petkov @ 2026-07-15 22:58 UTC (permalink / raw)
To: Jason Andryuk
Cc: Rong Zhang, Mario Limonciello, Huang Rui, Perry Yuan,
K Prateek Nayak, linux-pm, linux-kernel, Rafael J. Wysocki,
Viresh Kumar
On Wed, Jul 15, 2026 at 04:32:53PM -0400, Jason Andryuk wrote:
> I think changing amd_cppc_supported() to return false for
> X86_FEATURE_HYPERVISOR makes sense and can remove the message. The
> heuristic there doesn't seem relevant when virtualized.
I don't maintain that code but if I were, I won't sprinkle if
X86_FEATURE_HYPERVISOR for no good reason. And the guest warning is not good
enough a reason.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH] cpufreq/amd-pstate: Bail out early in virtual machines and don't warn
2026-07-15 19:21 ` Rong Zhang
2026-07-15 20:32 ` Jason Andryuk
@ 2026-07-16 17:44 ` Michael Kelley
1 sibling, 0 replies; 11+ messages in thread
From: Michael Kelley @ 2026-07-16 17:44 UTC (permalink / raw)
To: Rong Zhang, Borislav Petkov, Mario Limonciello
Cc: Huang Rui, Perry Yuan, K Prateek Nayak, Andryuk, Jason, linux-pm,
linux-kernel, Rafael J. Wysocki, Viresh Kumar
From: Rong Zhang <i@rong.moe> Sent: Wednesday, July 15, 2026 12:22 PM
>
> Hi Borislav,
>
> Thanks for reviewing the patch.
>
> On Wed, 2026-07-15 at 11:04 -0700, Borislav Petkov wrote:
> > On Wed, Jul 15, 2026 at 12:46:24PM -0500, Mario Limonciello wrote:
> > > Conceptually this makes sense to me, but I would like some comments from
> > > others if this is the right way forward.
> > >
> > > Jason, Boris,
> > >
> > > comments please?
> >
> > We don't care if someone "passes-through a relatively new CPUID" - I am not
> > sure what that means -
> >
>
> Sorry, typo here. I meant CPU model.
>
> I usually boot a KVM with `qemu-system-x86_64 -accel kvm -cpu host
> <other_args...>' to test various patches. These messages is a bit
> disturbing to me as they are KERN_WARNING messages.
>
> FYI, my device is Zen 5 based and always triggers both messages.
>
> I can also reproduce both messages with `-cpu EPYC-Genoa' and `-cpu
> EPYC-Turin'. It's just due to how amd_cppc_supported() is implemented.
>
> > but we won't patch the upstream kernel just because it
> > dumped an error message in the guest.
>
> Well, the reason why I decided to send this is not only about how noisy
> it is, but also about the correctness.
>
> The first messages says:
>
> The CPPC feature is supported but currently disabled by the BIOS.
> Please enable it if your BIOS has the CPPC option.
>
> The CPPC feature is neither supported in a KVM nor disabled by the VM's
> BIOS.
>
> IIUC, it's disabled by kvm_cpu_cap_init(CPUID_8000_0008_EBX, ...), so
> the upstream kernel both disables it as a hypervisor and warns about it
> as a guest. What a paradox!
>
> At least the first message is nonsense in this case and the paradox
> should really be fixed. If you prefer preserving the second message
> ("the _CPC object is not present in SBIOS or ACPI disabled") as an
> informative hint anyway, how about moving the virtualization check into
> amd_cppc_supported() to only mute the first one? ;-)
>
> Thanks,
> Rong
FWIW, the same warnings are output when running as a guest on Hyper-V
hosts. Over the years, I've cleaned up various bogus warnings and errors in
the boot logs for Hyper-V guests so they looks clean. I'd love to see these
go away as well.
Just my $.02 ...
Michael
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] cpufreq/amd-pstate: Bail out early in virtual machines and don't warn
2026-07-15 17:41 [PATCH] cpufreq/amd-pstate: Bail out early in virtual machines and don't warn Rong Zhang
2026-07-15 17:46 ` Mario Limonciello
@ 2026-07-16 18:00 ` K Prateek Nayak
2026-07-16 18:29 ` Rong Zhang
1 sibling, 1 reply; 11+ messages in thread
From: K Prateek Nayak @ 2026-07-16 18:00 UTC (permalink / raw)
To: Rong Zhang, Huang Rui, Mario Limonciello, Perry Yuan,
Rafael J. Wysocki, Viresh Kumar, Gautham R. Shenoy
Cc: linux-pm, linux-kernel, Michael Kelley
Hello Rong,
On 7/15/2026 11:11 PM, Rong Zhang wrote:
> When booting a virtual machine that simulates or passes-through a
> relatively new CPUID, one or two 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 not really helpful, as virtual machines cannot adjust the
> CPU frequency from the very beginning. Moreover, mentioning BIOS here
> makes the messages even more confusing.
>
> Fix it by bailing out early when running in virtual machines (excluding
> Xen Dom0).
>
> Fixes: cb817ec6673b ("cpufreq: amd-pstate: show CPPC debug message if CPPC is not supported")
> Signed-off-by: Rong Zhang <i@rong.moe>
> ---
> drivers/cpufreq/amd-pstate.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index a74a4cf99d22..f2115f935318 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -2228,6 +2228,9 @@ static int __init amd_pstate_init(void)
> if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
> return -ENODEV;
>
> + if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR) && !xen_initial_domain())
> + return -ENODEV;
> +
I think, instead of this, you can just check for X86_FEATURE_HW_PSTATE.
Using check_amd_hwpstate_cpu() from drivers/cpufreq/acpi-cpufreq.c
here should be sufficient to know if the platform supports frequency
scaling or not.
If it does and _CPC object is missing, there is a good chance CPPC is
disabled in BIOS.
KVM doesn't expose X86_FEATURE_HW_PSTATE to guest. I'm not sure if
Xen does.
> /* show debug message only if CPPC is not supported */
> if (!amd_cppc_supported())
> return -EOPNOTSUPP;
--
Thanks and Regards,
Prateek
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] cpufreq/amd-pstate: Bail out early in virtual machines and don't warn
2026-07-16 18:00 ` K Prateek Nayak
@ 2026-07-16 18:29 ` Rong Zhang
2026-07-16 18:58 ` Michael Kelley
0 siblings, 1 reply; 11+ messages in thread
From: Rong Zhang @ 2026-07-16 18:29 UTC (permalink / raw)
To: K Prateek Nayak, Jason Andryuk, Michael Kelley
Cc: Huang Rui, Mario Limonciello, Perry Yuan, Rafael J. Wysocki,
Viresh Kumar, Gautham R. Shenoy, Borislav Petkov, linux-pm,
linux-kernel, Michael Kelley
Hi K Prateek,
Thanks for reviewing this.
On Thu, 2026-07-16 at 23:30 +0530, K Prateek Nayak wrote:
> Hello Rong,
>
> On 7/15/2026 11:11 PM, Rong Zhang wrote:
> > When booting a virtual machine that simulates or passes-through a
> > relatively new CPUID, one or two 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 not really helpful, as virtual machines cannot adjust the
> > CPU frequency from the very beginning. Moreover, mentioning BIOS here
> > makes the messages even more confusing.
> >
> > Fix it by bailing out early when running in virtual machines (excluding
> > Xen Dom0).
> >
> > Fixes: cb817ec6673b ("cpufreq: amd-pstate: show CPPC debug message if CPPC is not supported")
> > Signed-off-by: Rong Zhang <i@rong.moe>
> > ---
> > drivers/cpufreq/amd-pstate.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> > index a74a4cf99d22..f2115f935318 100644
> > --- a/drivers/cpufreq/amd-pstate.c
> > +++ b/drivers/cpufreq/amd-pstate.c
> > @@ -2228,6 +2228,9 @@ static int __init amd_pstate_init(void)
> > if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
> > return -ENODEV;
> >
> > + if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR) && !xen_initial_domain())
> > + return -ENODEV;
> > +
>
> I think, instead of this, you can just check for X86_FEATURE_HW_PSTATE.
>
> Using check_amd_hwpstate_cpu() from drivers/cpufreq/acpi-cpufreq.c
> here should be sufficient to know if the platform supports frequency
> scaling or not.
>
> If it does and _CPC object is missing, there is a good chance CPPC is
> disabled in BIOS.
Thanks a lot for your suggestion! It makes a lot of sense to me and
sounds promising. I will try the approach in v2.
>
> KVM doesn't expose X86_FEATURE_HW_PSTATE to guest. I'm not sure if
> Xen does.
As Jason said:
With Xen, the Xen hypervisor itself controls CPPC. dom0
(xen_initial_domain()) doesn't need the amd-pstate driver.
I think we don't need to worry about Xen.
@Michael, if you have the time, could you test if Hyper-V exposes
X86_FEATURE_HW_PSTATE (i.e., 0x80000007/edx bit 7)?
Thanks,
Rong
>
> > /* show debug message only if CPPC is not supported */
> > if (!amd_cppc_supported())
> > return -EOPNOTSUPP;
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH] cpufreq/amd-pstate: Bail out early in virtual machines and don't warn
2026-07-16 18:29 ` Rong Zhang
@ 2026-07-16 18:58 ` Michael Kelley
0 siblings, 0 replies; 11+ messages in thread
From: Michael Kelley @ 2026-07-16 18:58 UTC (permalink / raw)
To: Rong Zhang, K Prateek Nayak, Jason Andryuk
Cc: Huang Rui, Mario Limonciello, Perry Yuan, Rafael J. Wysocki,
Viresh Kumar, Gautham R. Shenoy, Borislav Petkov, linux-pm,
linux-kernel
From: Rong Zhang <i@rong.moe> Sent: Thursday, July 16, 2026 11:29 AM
>
> Hi K Prateek,
>
> Thanks for reviewing this.
>
[snip]
>
> As Jason said:
>
> With Xen, the Xen hypervisor itself controls CPPC. dom0
> (xen_initial_domain()) doesn't need the amd-pstate driver.
>
> I think we don't need to worry about Xen.
>
> @Michael, if you have the time, could you test if Hyper-V exposes
> X86_FEATURE_HW_PSTATE (i.e., 0x80000007/edx bit 7)?
I checked a VM running on Hyper-V on an AMD Zen 2 (EPYC 7452),
and another on a Zen 4 (EPYC 9V74) processor. Neither has
X86_FEATURE_HW_PSTATE set. There are other variations that
could affect what a guest on Hyper-V sees, but these spot tests
are sufficient evidence that this flag does what we want for
Hyper-V guests.
Michael
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-07-16 18:58 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-15 17:41 [PATCH] cpufreq/amd-pstate: Bail out early in virtual machines and don't warn Rong Zhang
2026-07-15 17:46 ` Mario Limonciello
2026-07-15 18:04 ` Borislav Petkov
2026-07-15 19:21 ` Rong Zhang
2026-07-15 20:32 ` Jason Andryuk
2026-07-15 20:54 ` Mario Limonciello
2026-07-15 22:58 ` Borislav Petkov
2026-07-16 17:44 ` Michael Kelley
2026-07-16 18:00 ` K Prateek Nayak
2026-07-16 18:29 ` Rong Zhang
2026-07-16 18:58 ` Michael Kelley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome