Re: [PATCH 2/5] cpufreq: loongson3: Adjust the width of id and val in smc_message
Huacai Chen <[email protected]>
| Newsgroups | dev.linux.lists.loongarch,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pm,org.kernel.vger.stable |
|---|---|
| Message-ID | <CAAhV-H62o3v+Bk=0AO7+C2VWb=AGPMZfv1L6XbZ0uUNq0Pc3bg@mail.gmail.com> |
Hi, Zhongqiu, On Thu, Aug 20, 2026 at 6:03 PM Zhongqiu Han <[email protected]> wrote: > > Hi Huacai, > > Please feel free to comment on the question below, or simply ignore it > if you do not think it is worth addressing from an architectural > perspective. > > On 8/18/2026 8:39 PM, Huacai Chen wrote: > > The id field of smc_message is usually stand for the CPU ID. In the past > > this driver was only tested for desktop and laptop productions so 4-bits > > are enough. But now we have servers that can have as many as 256 cores, > > so we need 8-bits CPU ID. > > > > On the other hand, the val field is usually stand for CPU frequency so > > 12-bits are enough to represent 4GHz, and for higher frequencies there > > is an extra bit to extend (enough for 8GHz). > > The extra bit appears to be unused in the current implementation. > Perhaps it would be better to enforce the limit explicitly for id and > val bits, for example by using FIELD_MAX(). OK, we can do it in the future. > > > > > In theory, this is a incompatible change, but fortunately the old SMC > > firmwares are not widely shipped and can be updated on the air, thus we > > can safely adjust the widths. > > Not sure if using CMD_GET_VERSION check can avoid such incompatible > issue? Since the original SMC firmware and the current one has the same version number and the current one was shipped widely, we can no longer use CMD_GET_VERSION here. Huacai > > > > > Cc: [email protected] > > Signed-off-by: Hongliang Wang <[email protected]> > > Signed-off-by: Huacai Chen <[email protected]> > > --- > > drivers/cpufreq/loongson3_cpufreq.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/cpufreq/loongson3_cpufreq.c b/drivers/cpufreq/loongson3_cpufreq.c > > index 1e8715ea1b77..630f679aa739 100644 > > --- a/drivers/cpufreq/loongson3_cpufreq.c > > +++ b/drivers/cpufreq/loongson3_cpufreq.c > > @@ -21,9 +21,9 @@ > > union smc_message { > > u32 value; > > struct { > > - u32 id : 4; > > + u32 id : 8; > > u32 info : 4; > > - u32 val : 16; > > + u32 val : 12; > > u32 cmd : 6; > > u32 extra : 1; > > u32 complete : 1; > > > -- > Thx and BRs, > Zhongqiu Han