linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yao Zi <ziyao@disroot.org>
To: Huacai Chen <chenhuacai@kernel.org>,
	WANG Xuerui <kernel@xen0n.name>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Mingcong Bai <jeffbai@aosc.io>,
	Kexy Biscuit <kexybiscuit@aosc.io>,
	loongarch@lists.linux.dev, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cpufreq: loongson3: Support older SMC firmware
Date: Wed, 25 Jun 2025 03:47:47 +0000	[thread overview]
Message-ID: <aFtxYwgZDbYy_EMb@pie> (raw)
In-Reply-To: <20250623123321.5622-1-ziyao@disroot.org>

On Mon, Jun 23, 2025 at 12:33:21PM +0000, Yao Zi wrote:
> SMC firmware found on many on-market LoongArch devices implement a
> different ABI than what has been implemented in the current upstream
> driver. They significantly differ in the following ways:
> 
> - CMD_GET_VERSION returns 0.
> - There is no known SMC call to obtain corresponding frequencies for
>   each frequency level. The frequency table must therefore be calculated
>   with CPU clock frequency from scratch.
> - There is no known SMC call to obtain the current frequency level.
> - The main processor must determine the set of cores able to run at
>   boost frequency and enable boosting manually.
> - SMC call response format may vary between commands.
> 
> This patch adds support for the SMC firmware found on these devices,
> which I denoted as "SMC-0" in the driver. Boost support is omitted,
> since determination of cores able to boost requires the driver to couple
> tightly with micro-architecture details.
> 
> For coexistence, I prefixed all SMC-call constants with their SMC
> versions, and introduced "SMC-0"-specific initialization and
> frequency-level-setup rountines.
> 
> Signed-off-by: Yao Zi <ziyao@disroot.org>

While self-testing the patch on a 3A5000 workstation, I observed the
processor cannot run stably at the low frequency levels, it's required
to keep it above half of the maximum frequency for stability.

This type of instability seems to depend on the silicon or firmware
revision, my 3A5000 laptop, Tongfang L860-T2, could run stably at any
frequency level allowed by the SMC firmware. And with the driver it
gains extra 30 minutes of battery life when idle, which looks valuable
to me.

To avoid breaking existing users, I'll disable SMCv0 frequency scaling
by default and add a module parameter to enable it in v2.

Regards,
Yao Zi

      parent reply	other threads:[~2025-06-25  3:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-23 12:33 [PATCH] cpufreq: loongson3: Support older SMC firmware Yao Zi
2025-06-23 14:59 ` Xi Ruoyao
2025-06-24  1:42   ` Yao Zi
2025-06-24  2:43 ` Mingcong Bai
2025-06-25  3:47 ` Yao Zi [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=aFtxYwgZDbYy_EMb@pie \
    --to=ziyao@disroot.org \
    --cc=chenhuacai@kernel.org \
    --cc=jeffbai@aosc.io \
    --cc=jiaxun.yang@flygoat.com \
    --cc=kernel@xen0n.name \
    --cc=kexybiscuit@aosc.io \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=rafael@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).