Re: [PATCH 5/5] cpufreq: loongson3: Replace IOCSR read/write with MMIO ones
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-H7yNSBzGhZDSUadi--NK=0g-eL87Fxp-Roxw0wR6qVOmQ@mail.gmail.com> |
Hi, Ruoyao, On Fri, Aug 21, 2026 at 1:01 PM Xi Ruoyao <[email protected]> wrote: > > > > 在 2026/8/18 20:39, Huacai Chen 写道: > > Our server productions (e.g. Loongson-3D6000/3E6000) can have multiple > > nodes in one package and SMC mailboxes are also per-node. However, IOCSR > > read/write can only perform on the current node, while sometimes we want > > to perform on other nodes (e.g. when switch governor, the get and target > > callbacks are not run on target core). So replace IOCSR read/write with > > MMIO ones. > > > > Cc: [email protected] > > Signed-off-by: Huacai Chen <[email protected]> > > --- > > drivers/cpufreq/loongson3_cpufreq.c | 31 ++++++++++++++++++++++------- > > 1 file changed, 24 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/cpufreq/loongson3_cpufreq.c b/drivers/cpufreq/loongson3_cpufreq.c > > index c75c0e30e881..e5062cd62390 100644 > > --- a/drivers/cpufreq/loongson3_cpufreq.c > > +++ b/drivers/cpufreq/loongson3_cpufreq.c > > @@ -164,6 +164,12 @@ union smc_message { > > > > #define FREQ_MAX_LEVEL 16 > > > > +#define MMIO_SMCMBX(node) \ > > + ((void __iomem *)(IO_BASE | (u64)(node) << NODE_ADDRSPACE_SHIFT | LOONGSON_REG_BASE | LOONGARCH_IOCSR_SMCMBX)) > > NODE_ADDRSPACE_SHIFT is defined in numa.h so that file needs to be > included, to avoid a build failure when NUMA is disabled (if NUMA is > enabled, numa.h happens to be pulled in via some other headers). > > Also I'd suggest to use nid_to_addrbase(node) instead of hard coding the > shift for better readability. Yes, that's better, thank you very much. Huacai > > With the changes: > > Tested-by: Xi Ruoyao <[email protected]> # on XA61200