[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAhV-H6W7PdxsnPzgd=C3=RVRr-4RefZXiXDNt4TJLsd7Ktf0Q@mail.gmail.com>
Date: Mon, 26 Aug 2024 22:39:50 +0800
From: Huacai Chen <chenhuacai@...nel.org>
To: Xi Ruoyao <xry111@...111.site>
Cc: Huacai Chen <chenhuacai@...ngson.cn>, "Rafael J . Wysocki" <rafael@...nel.org>,
Viresh Kumar <viresh.kumar@...aro.org>, loongarch@...ts.linux.dev,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
Xuerui Wang <kernel@...0n.name>, Jiaxun Yang <jiaxun.yang@...goat.com>,
Binbin Zhou <zhoubinbin@...ngson.cn>
Subject: Re: [PATCH V3 2/2] cpufreq: Add Loongson-3 CPUFreq driver support
Hi, Ruoyao,
On Fri, Aug 23, 2024 at 2:34 PM Xi Ruoyao <xry111@...111.site> wrote:
>
> On Fri, 2024-07-05 at 14:06 +0800, Huacai Chen wrote:
> > Some of LoongArch processors (Loongson-3 series) support DVFS, their
> > IOCSR.FEATURES has IOCSRF_FREQSCALE set. And they has a micro-core in
> > the package called SMC (System Management Controller), which can be
> > used to detect temperature, control fans, scale frequency and voltage,
> > etc.
> >
> > The Loongson-3 CPUFreq driver is very simple now, it communicate with
> > SMC, get DVFS info, set target frequency from CPUFreq core, and so on.
> >
> > There is a command list to interact with SMC, widely-used commands in
> > the CPUFreq driver include:
> >
> > CMD_GET_VERSION: Get SMC firmware version.
> >
> > CMD_GET_FEATURE: Get enabled SMC features.
> >
> > CMD_SET_FEATURE: Enable SMC features, such as basic DVFS, BOOST.
> >
> > CMD_GET_FREQ_LEVEL_NUM: Get the number of all frequency levels.
> >
> > CMD_GET_FREQ_BOOST_LEVEL: Get the first boost frequency level.
> >
> > CMD_GET_FREQ_LEVEL_INFO: Get the detail info of a frequency level.
> >
> > CMD_GET_FREQ_INFO: Get the current frequency.
> >
> > CMD_SET_FREQ_INFO: Set the target frequency.
> >
> > In future we will add automatic frequency scaling, which is similar to
> > Intel's HWP (HardWare P-State).
> >
> > Signed-off-by: Binbin Zhou <zhoubinbin@...ngson.cn>
> > Signed-off-by: Huacai Chen <chenhuacai@...ngson.cn
>
> Hi Huacai,
>
> I got some error with the driver enabled:
>
> [ 6.650403] BUG: using smp_processor_id() in preemptible [00000000] code: (udev-worker)/208
> [ 6.658719] caller is loongson3_cpufreq_probe+0x5c/0x250 [loongson3_cpufreq]
>
> and the driver failed to probe.
>
> It seems the caller of smp_processor_id is actually do_service_request,
> which is inlined into loongson3_cpufreq_probe.
Emm, it seems we should use raw_smp_processor_id() instead of
smp_processor_id(), but I don't know why we haven't met this problem.
Huacai
>
> The .config file is attached.
>
> --
> Xi Ruoyao <xry111@...111.site>
> School of Aerospace Science and Technology, Xidian University
Powered by blists - more mailing lists