[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aFtxYwgZDbYy_EMb@pie>
Date: Wed, 25 Jun 2025 03:47:47 +0000
From: Yao Zi <ziyao@...root.org>
To: Huacai Chen <chenhuacai@...nel.org>, WANG Xuerui <kernel@...0n.name>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Viresh Kumar <viresh.kumar@...aro.org>
Cc: Jiaxun Yang <jiaxun.yang@...goat.com>, Mingcong Bai <jeffbai@...c.io>,
Kexy Biscuit <kexybiscuit@...c.io>, loongarch@...ts.linux.dev,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cpufreq: loongson3: Support older SMC firmware
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@...root.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
Powered by blists - more mailing lists