From: Wu Zhangjin <wuzhangjin@gmail.com>
To: Arnaud Patard <apatard@mandriva.com>, Yan Hua <yanh@lemote.com>
Cc: linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>,
Yan Hua <yanh@lemote.com>, Philippe Vachon <philippe@cowpig.ca>,
Zhang Le <r0bertz@gentoo.org>, Zhang Fuxin <zhangfx@lemote.com>,
loongson-dev <loongson-dev@googlegroups.com>,
Nicholas Mc Guire <der.herr@hofr.at>,
Liu Junliang <liujl@lemote.com>, Erwan Lerale <erwan@thiscow.com>
Subject: Re: [loongson-PATCH-v2 19/23] Loongson2F cpufreq support
Date: Thu, 28 May 2009 01:37:59 +0800 [thread overview]
Message-ID: <1243445879.11263.116.camel@falcon> (raw)
In-Reply-To: <m3skiqop3b.fsf@anduin.mandriva.com>
Hi,
On Wed, 2009-05-27 at 11:46 +0200, Arnaud Patard wrote:
> > Loongson2F add a new capability to dynamic scaling cpu frequency. However the
> > cpu count timer depends on cpu frequency. So an alternative clock must be used
> > if this driver is enabled. Besides, the CPU enter wait state when the frequency
> > is setting zero. All these features help power save.
> >
> > In fuloong(2f) and yeeloong(2f), if you want to use this feature, you
> > should enable the cs5536 mfgpt timer.
[...]
> > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> > index 74efb43..aa8cd64 100644
> > --- a/arch/mips/Kconfig
> > +++ b/arch/mips/Kconfig
> > @@ -2136,6 +2136,23 @@ source "kernel/power/Kconfig"
> >
> > endmenu
> >
> > +menu "CPU Frequency scaling"
> > +
> > +source "drivers/cpufreq/Kconfig"
> > +
> > +config LOONGSON2F_CPU_FREQ
> > + bool "Loongson-2F CPU Frequency driver"
> > + depends on CPU_LOONGSON2F && CPU_FREQ && CS5536_MFGPT
>
> If I have a clock from (for instance) a i8253 compatible source, one will
> have to add something here. I'm not sure it's a good idea. Did you try
> with something like "select LOONGSON2F_CPU_FREQ" in the machine Kconfig
> entry ?
>
something like "select LOONGSON2F_CPU_FREQ" not work, because users may
do not need LOONGSON2F_CPU_FREQ.
what about this solution?
+config LOONGSON2F_CPU_FREQ + bool "Loongson-2F CPU Frequency driver"
+ depends on CPU_LOONGSON2F && CPU_FREQ && (CS5536_MFGPT || I8253)
> > diff --git a/arch/mips/kernel/loongson2f_freq.c b/arch/mips/kernel/loongson2f_freq.c
> > new file mode 100644
> > index 0000000..183f36b
[...]
> > +static int __init loongson2f_cpufreq_module_init(void)
> > +{
> > + struct cpuinfo_mips *c = &cpu_data[0];
> > + int result;
> > +
> > + if (c->processor_id != PRID_IMP_LOONGSON2F)
> > + return -ENODEV;
>
> How can this happen ? the Kconfig entry depends on CPU_LOONGSON2F so I
> would expect this is useless.
>
i just removed it, thanks!
> > diff --git a/arch/mips/loongson/common/clock.c b/arch/mips/loongson/common/clock.c
> > new file mode 100644
> > index 0000000..a8c648d
> > --- /dev/null
> > +++ b/arch/mips/loongson/common/clock.c
[...]
> > +/*
> > + * This is the simple version of Loongson-2F wait
> > + * Maybe we need do this in interrupt disabled content
> > + */
> > +DEFINE_SPINLOCK(loongson2f_wait_lock);
> > +void loongson2f_cpu_wait(void)
> > +{
> > + u32 cpu_freq;
> > + unsigned long flags;
> > +
> > + spin_lock_irqsave(&loongson2f_wait_lock, flags);
> > + cpu_freq = LOONGSON_CHIPCFG0;
> > + LOONGSON_CHIPCFG0 &= ~0x7; /* Put CPU into wait mode */
>
> by doing this, if you want to "wake up" the 2f, you need an external
> interrupt source otherwise your only solution is to power down your
> machine. Are you sure that it's really safe to enable it by default ?
>
sorry, I am not clear why Yanhua use a loongson-specific cpu_wait
here(seems used in loongson2f_freq.c)? perhaps he can explain it. and I
also have a question about it: why not use the "wait" instruction
directly here like r4k_wait() does? or just use the r4k_wait() function
via adding some code in arch/mips/kernel/cpu-probe.c:
void __init check_wait(void)
{
...
switch (c->cputype) {
...
case CPU_PR4450:
case CPU_BCM3302:
case CPU_CAVIUM_OCTEON:
+ case CPU_LOONGSON2:
cpu_wait = r4k_wait;
break;
...
}
and even if we not use cpufreq, is better to enable a loongson-specific
cpu_wait()? cpu_wait() is called in cpu_idle() (defined in
arch/mips/kernel/process.c), does we need cpu_wait() to save power when
cpu is idle?
WARNING: multiple messages have this Message-ID (diff)
From: Wu Zhangjin <wuzhangjin@gmail.com>
To: Arnaud Patard <apatard@mandriva.com>, Yan Hua <yanh@lemote.com>
Cc: linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>,
Philippe Vachon <philippe@cowpig.ca>,
Zhang Le <r0bertz@gentoo.org>, Zhang Fuxin <zhangfx@lemote.com>,
loongson-dev <loongson-dev@googlegroups.com>,
Nicholas Mc Guire <der.herr@hofr.at>,
Liu Junliang <liujl@lemote.com>, Erwan Lerale <erwan@thiscow.com>
Subject: Re: [loongson-PATCH-v2 19/23] Loongson2F cpufreq support
Date: Thu, 28 May 2009 01:37:59 +0800 [thread overview]
Message-ID: <1243445879.11263.116.camel@falcon> (raw)
Message-ID: <20090527173759.L4gaG-B3y0G0fRm4CoPXoswUToBxPqE1AhBCX4pHkDc@z> (raw)
In-Reply-To: <m3skiqop3b.fsf@anduin.mandriva.com>
Hi,
On Wed, 2009-05-27 at 11:46 +0200, Arnaud Patard wrote:
> > Loongson2F add a new capability to dynamic scaling cpu frequency. However the
> > cpu count timer depends on cpu frequency. So an alternative clock must be used
> > if this driver is enabled. Besides, the CPU enter wait state when the frequency
> > is setting zero. All these features help power save.
> >
> > In fuloong(2f) and yeeloong(2f), if you want to use this feature, you
> > should enable the cs5536 mfgpt timer.
[...]
> > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> > index 74efb43..aa8cd64 100644
> > --- a/arch/mips/Kconfig
> > +++ b/arch/mips/Kconfig
> > @@ -2136,6 +2136,23 @@ source "kernel/power/Kconfig"
> >
> > endmenu
> >
> > +menu "CPU Frequency scaling"
> > +
> > +source "drivers/cpufreq/Kconfig"
> > +
> > +config LOONGSON2F_CPU_FREQ
> > + bool "Loongson-2F CPU Frequency driver"
> > + depends on CPU_LOONGSON2F && CPU_FREQ && CS5536_MFGPT
>
> If I have a clock from (for instance) a i8253 compatible source, one will
> have to add something here. I'm not sure it's a good idea. Did you try
> with something like "select LOONGSON2F_CPU_FREQ" in the machine Kconfig
> entry ?
>
something like "select LOONGSON2F_CPU_FREQ" not work, because users may
do not need LOONGSON2F_CPU_FREQ.
what about this solution?
+config LOONGSON2F_CPU_FREQ + bool "Loongson-2F CPU Frequency driver"
+ depends on CPU_LOONGSON2F && CPU_FREQ && (CS5536_MFGPT || I8253)
> > diff --git a/arch/mips/kernel/loongson2f_freq.c b/arch/mips/kernel/loongson2f_freq.c
> > new file mode 100644
> > index 0000000..183f36b
[...]
> > +static int __init loongson2f_cpufreq_module_init(void)
> > +{
> > + struct cpuinfo_mips *c = &cpu_data[0];
> > + int result;
> > +
> > + if (c->processor_id != PRID_IMP_LOONGSON2F)
> > + return -ENODEV;
>
> How can this happen ? the Kconfig entry depends on CPU_LOONGSON2F so I
> would expect this is useless.
>
i just removed it, thanks!
> > diff --git a/arch/mips/loongson/common/clock.c b/arch/mips/loongson/common/clock.c
> > new file mode 100644
> > index 0000000..a8c648d
> > --- /dev/null
> > +++ b/arch/mips/loongson/common/clock.c
[...]
> > +/*
> > + * This is the simple version of Loongson-2F wait
> > + * Maybe we need do this in interrupt disabled content
> > + */
> > +DEFINE_SPINLOCK(loongson2f_wait_lock);
> > +void loongson2f_cpu_wait(void)
> > +{
> > + u32 cpu_freq;
> > + unsigned long flags;
> > +
> > + spin_lock_irqsave(&loongson2f_wait_lock, flags);
> > + cpu_freq = LOONGSON_CHIPCFG0;
> > + LOONGSON_CHIPCFG0 &= ~0x7; /* Put CPU into wait mode */
>
> by doing this, if you want to "wake up" the 2f, you need an external
> interrupt source otherwise your only solution is to power down your
> machine. Are you sure that it's really safe to enable it by default ?
>
sorry, I am not clear why Yanhua use a loongson-specific cpu_wait
here(seems used in loongson2f_freq.c)? perhaps he can explain it. and I
also have a question about it: why not use the "wait" instruction
directly here like r4k_wait() does? or just use the r4k_wait() function
via adding some code in arch/mips/kernel/cpu-probe.c:
void __init check_wait(void)
{
...
switch (c->cputype) {
...
case CPU_PR4450:
case CPU_BCM3302:
case CPU_CAVIUM_OCTEON:
+ case CPU_LOONGSON2:
cpu_wait = r4k_wait;
break;
...
}
and even if we not use cpufreq, is better to enable a loongson-specific
cpu_wait()? cpu_wait() is called in cpu_idle() (defined in
arch/mips/kernel/process.c), does we need cpu_wait() to save power when
cpu is idle?
next prev parent reply other threads:[~2009-05-27 17:38 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-26 18:59 [loongson-PATCH-v2 00/23] loongson-based machines support wuzhangjin
2009-05-26 19:01 ` [loongson-PATCH-v2 01/23] fix-warning: incompatible argument type of pci_fixup_irqs wuzhangjin
2009-05-26 19:02 ` [loongson-PATCH-v2 02/23] fix-warning: incompatible argument type of virt_to_phys wuzhangjin
2009-05-26 19:02 ` [loongson-PATCH-v2 03/23] change the naming methods wuzhangjin
2009-05-26 19:03 ` [loongson-PATCH-v2 04/23] remove reference to bonito64.h wuzhangjin
2009-05-26 19:04 ` [loongson-PATCH-v2 05/23] divide the files to the smallest logic unit wuzhangjin
2009-05-26 19:04 ` [loongson-PATCH-v2 06/23] replace tons of magic numbers by understandable symbols wuzhangjin
2009-05-27 9:27 ` Arnaud Patard
2009-05-27 15:26 ` Wu Zhangjin
2009-05-26 19:05 ` [loongson-PATCH-v2 07/23] clean up the early printk support for fuloong(2e) wuzhangjin
2009-05-26 19:05 ` [loongson-PATCH-v2 08/23] enable Real Time Clock Support " wuzhangjin
2009-05-26 19:05 ` [loongson-PATCH-v2 09/23] split the loongson-specific part out wuzhangjin
2009-05-26 19:06 ` [loongson-PATCH-v2 10/23] add basic loongson-2f support wuzhangjin
2009-05-26 19:06 ` [loongson-PATCH-v2 11/23] add basic fuloong(2f) support wuzhangjin
2009-05-26 19:07 ` [loongson-PATCH-v2 12/23] enable serial port support of loongson-based machines wuzhangjin
2009-05-26 19:07 ` [loongson-PATCH-v2 13/23] add basic yeeloong(2f) laptop support wuzhangjin
2009-05-26 19:07 ` [loongson-PATCH-v2 14/23] Add Siliconmotion 712 framebuffer driver wuzhangjin
2009-05-26 21:10 ` Geert Uytterhoeven
2009-05-26 21:10 ` Geert Uytterhoeven
2009-05-26 19:07 ` [loongson-PATCH-v2 15/23] define Loongson2F arch specific phys prot access wuzhangjin
2009-05-26 19:08 ` [loongson-PATCH-v2 16/23] Loongson2 specific OProfile driver wuzhangjin
2009-05-26 19:08 ` [loongson-PATCH-v2 17/23] flush posted write to irq wuzhangjin
2009-05-26 19:08 ` [loongson-PATCH-v2 18/23] CS5536 MFGPT as system clock source support wuzhangjin
2009-05-26 19:08 ` [loongson-PATCH-v2 19/23] Loongson2F cpufreq support wuzhangjin
2009-05-27 9:46 ` Arnaud Patard
2009-05-27 17:37 ` Wu Zhangjin [this message]
2009-05-27 17:37 ` Wu Zhangjin
2009-05-27 19:18 ` Arnaud Patard
2009-05-27 19:18 ` Arnaud Patard
2009-05-27 10:01 ` Manuel Lauss
2009-05-27 18:28 ` Wu Zhangjin
2009-05-26 19:09 ` [loongson-PATCH-v2 20/23] add gcc 4.4 support for MIPS and loongson wuzhangjin
2009-05-27 9:22 ` Arnaud Patard
2009-05-27 14:23 ` Wu Zhangjin
2009-05-26 19:09 ` [loongson-PATCH-v2 21/23] add default kernel config file for loongson-based machines wuzhangjin
2009-05-26 19:09 ` [loongson-PATCH-v2 22/23] add a default kernel configration for yeeloong-7inch laptop wuzhangjin
2009-05-26 19:10 ` [loongson-PATCH-v2 23/23] Hibernation Support in mips system wuzhangjin
2009-05-27 9:51 ` Arnaud Patard
2009-05-27 18:52 ` Wu Zhangjin
2009-05-28 15:44 ` Atsushi Nemoto
2009-05-28 17:06 ` Wu Zhangjin
2009-05-28 15:32 ` Atsushi Nemoto
2009-05-28 17:10 ` Wu Zhangjin
2009-05-29 16:12 ` Atsushi Nemoto
2009-05-29 19:12 ` Wu Zhangjin
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=1243445879.11263.116.camel@falcon \
--to=wuzhangjin@gmail.com \
--cc=apatard@mandriva.com \
--cc=der.herr@hofr.at \
--cc=erwan@thiscow.com \
--cc=linux-mips@linux-mips.org \
--cc=liujl@lemote.com \
--cc=loongson-dev@googlegroups.com \
--cc=philippe@cowpig.ca \
--cc=r0bertz@gentoo.org \
--cc=ralf@linux-mips.org \
--cc=yanh@lemote.com \
--cc=zhangfx@lemote.com \
/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