mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wentao Guan <guanwentao@uniontech.com>
To: kprateek.nayak@amd.com
Cc: guanwentao@uniontech.com, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org, ray.huang@amd.com,
	ronforever@outlook.com, scardracs@disroot.org,
	stable@vger.kernel.org, superm1@kernel.org,
	mario.limonciello@amd.com
Subject: Re: [PATCH v3] cpufreq/amd-pstate: Skip auto_sel write when it already matches the mode
Date: Fri, 16 Oct 2026 15:22:18 +0800	[thread overview]
Message-ID: <20261016072218.303219-1-guanwentao@uniontech.com> (raw)
In-Reply-To: <5469c745-7b9e-4a71-8d04-8716c5af840e@amd.com>

Hi,

>On 10/16/2026 11:21 AM, Wentao Guan wrote:
>> Hi,
>> 
>>> Since commit 9dfd13f80c85 ("cpufreq/amd-pstate: Toggle auto_sel in active
>>> mode on shared memory systems"), shmem_init_perf() programs
>>> AUTONOMOUS_SELECTION_ENABLE unconditionally, including in active mode.
>>>
>>> Platforms that exclusively support autonomous selection report this field
>>> as an Integer of 1, as required by the ACPI specification, instead of as a
>>> register descriptor.  cppc_get_reg_val() reads such a field back
>>> successfully, but cppc_set_reg_val() rejects the write with -EOPNOTSUPP
>>> because the entry is not an ACPI_TYPE_BUFFER.
>>>
>>> shmem_init_perf() propagates that error, so every amd_pstate_epp_cpu_init()
>>> fails, cpufreq_register_driver() ends up with an empty policy list and
>>> returns -ENODEV, and amd-pstate refuses to load at all:
>>>
>>>   amd_pstate: failed to set auto_sel, ret: -95
>>>   amd_pstate: Failed to initialize CPU 0: -95
>>>   ...
>>>   amd_pstate: failed to register with return -19
>>>
>>> Skip the write when the register already holds the value the requested mode
>>> needs.  Active and guided mode are fixed on these platforms, which report
>>> auto_sel as 1, while passive mode still fails to load on a platform that
>>> cannot disable autonomous selection, exactly as it did before the
>>> offending commit.
>>>
>>> Fixes: 9dfd13f80c85 ("cpufreq/amd-pstate: Toggle auto_sel in active mode on shared memory systems")
>>> Cc: stable@vger.kernel.org
>>> Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
>>> Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
>>> Tested-by: LFRon <ronforever@outlook.com>
>>> Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
>>> ---
>>> changelog v3:
>>> Include the K Prateek Nayak reviews to remove that ternary op base on current
>>> condition now have.
>>>
>>> v2 link:
>>> https://lore.kernel.org/stable/c3eb86bd-70a6-4bb2-8eff-b2a3c0817514@amd.com/#R
>>> changelog v2:
>>> Accecpt and tested the K Prateek Nayak reviews.
>>> v1 link:
>>> https://lore.kernel.org/stable/20260918054808.48999-1-guanwentao@uniontech.com/#R
>>> ---
>>> ---
>>> drivers/cpufreq/amd-pstate.c | 6 ++++--
>>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
>>> index 80d99ba1902c9..2d1f5292d1738 100644
>>> --- a/drivers/cpufreq/amd-pstate.c
>>> +++ b/drivers/cpufreq/amd-pstate.c
>>> @@ -532,8 +532,10 @@ static int shmem_init_perf(struct amd_cpudata *cpudata)
>>>  		return 0;
>>>  	}
>>>
>>> -	ret = cppc_set_auto_sel(cpudata->cpu,
>>> -			(cppc_state == AMD_PSTATE_PASSIVE) ? 0 : 1);
>>> +	if ((cppc_state != AMD_PSTATE_PASSIVE) == auto_sel)
>>> +		return 0;
>>> +
>>> +	ret = cppc_set_auto_sel(cpudata->cpu, !auto_sel);
>>>
>>>  	if (ret)
>>>  		pr_warn("failed to set auto_sel, ret: %d\n", ret);
>>> --
>>> 2.30.2
>> 
>> Ping? Nearly a month passed, anything update?
>
>On a similar issue here
>https://lore.kernel.org/all/851316da-2cfa-4a22-947c-1838532d05cf@amd.com/
>Mario had recently pointed out that this might be a BIOS issue on
>systems that may have MSR interface but running an old BIOS that does
>not advertise the CPUID bit.
Seem same issue.

>
>Could you please share your system details here and check if you are
>running the latest BIOS from your vendor?

Emmm, the user report that dmesg showed running on this laptop:
DMI: METAPHYUNI MetamechBook01/MetamechBook01, BIOS AHP958_V00.01_T015A5ME1 02/22/2024
which vendor not ship new BIOS,
but it is verified in AMD Advantage: https://www.amd.com/en/gaming/laptops/advantage-premium.html ...

He also helped me to test the kernel patch.

BRs
Wentao Guan

      reply	other threads:[~2026-10-16  7:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18  4:42 [PATCH] cpufreq/amd-pstate: Do not fail init when auto_sel cannot be written Wentao Guan
2026-09-18  5:33 ` K Prateek Nayak
2026-09-18  5:48   ` Wentao Guan
2026-09-18  7:08   ` [PATCH v2] cpufreq/amd-pstate: Skip auto_sel write when it already matches the mode Wentao Guan
2026-09-18  8:43     ` K Prateek Nayak
2026-09-18  9:09       ` [PATCH v3] " Wentao Guan
2026-10-16  5:51         ` Wentao Guan
2026-10-16  6:44           ` K Prateek Nayak
2026-10-16  7:22             ` Wentao Guan [this message]

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=20261016072218.303219-1-guanwentao@uniontech.com \
    --to=guanwentao@uniontech.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=ray.huang@amd.com \
    --cc=ronforever@outlook.com \
    --cc=scardracs@disroot.org \
    --cc=stable@vger.kernel.org \
    --cc=superm1@kernel.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

all inboxes | Powered by JetHome®