Linux Power Management development
 help / color / mirror / Atom feed
From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Rong Zhang <i@rong.moe>, Huang Rui <ray.huang@amd.com>,
	Mario Limonciello <mario.limonciello@amd.com>,
	Perry Yuan <perry.yuan@amd.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	"Gautham R. Shenoy" <gautham.shenoy@amd.com>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Michael Kelley <mhklinux@outlook.com>
Subject: Re: [PATCH] cpufreq/amd-pstate: Bail out early in virtual machines and don't warn
Date: Thu, 16 Jul 2026 23:30:19 +0530	[thread overview]
Message-ID: <7caa23a0-bcf0-41a5-a600-99b33f418020@amd.com> (raw)
In-Reply-To: <20260716-amd-pstate-vm-v1-1-2ac97d3cf6e7@rong.moe>

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


  parent reply	other threads:[~2026-07-16 18:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-07-16 18:29   ` Rong Zhang
2026-07-16 18:58     ` Michael Kelley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7caa23a0-bcf0-41a5-a600-99b33f418020@amd.com \
    --to=kprateek.nayak@amd.com \
    --cc=gautham.shenoy@amd.com \
    --cc=i@rong.moe \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=mhklinux@outlook.com \
    --cc=perry.yuan@amd.com \
    --cc=rafael@kernel.org \
    --cc=ray.huang@amd.com \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox