From: Jerone Young <jyoung5@us.ibm.com>
To: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Cc: kvm-ppc-devel@lists.sourceforge.net, linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] Add idle wait support for 44x platforms
Date: Fri, 04 Apr 2008 00:59:59 -0500 [thread overview]
Message-ID: <1207288799.6971.11.camel@thinkpadL> (raw)
In-Reply-To: <20080403210027.05339204@zod.rchland.ibm.com>
On Thu, 2008-04-03 at 21:00 -0500, Josh Boyer wrote:
> On Thu, 03 Apr 2008 17:43:02 -0500
> Jerone Young <jyoung5@us.ibm.com> wrote:
>
> > # HG changeset patch
> > # User Jerone Young <jyoung5@us.ibm.com>
> > # Date 1207262487 18000
> > # Node ID 7226bef216680748a50327900572c2fbc3e762b0
> > # Parent a5b2aebbc6ebd2439c655f1c047ed7e3c1991ec1
>
> As a complete and unrelated side note to the actual patch, wtf is this
> hg stuff? I can't really tell what tree you're even basing this off of.
hehe...I primary use hg as it's just much easier to deal with. Yes I do
go through the conversion. But it is worth it. The patches I send are in
git format.
>
> > Add idle wait support for 44x platforms
> >
> > This patch adds the ability for the CPU to go into wait state while in cpu_idle loop. This helps virtulization solutions know when the guest Linux kernel is in an idle state. There are two ways to do it.
>
> This huge single line needs fixing in the next version of the patch.
>
> >
> > 1) Command line
> > idle=spin <-- CPU will spin (this is the default)
> > idle=wait <-- set CPU into wait state when idle
> >
> > 2) The device tree will be checked for the "/hypervisor" node
> > If this node is seen it will use "wait" for idle, so that
> > the hypervisor can know when guest Linux kernel it is in
> > an idle state.
> >
> > This patch, unlike the last, isolates the code to 44x platforms.
>
> In addition to the comments Tony and Hollis made, I have a few of my
> own.
>
> > Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
> >
> > diff --git a/arch/powerpc/platforms/44x/44x.h b/arch/powerpc/platforms/44x/44x.h
> > --- a/arch/powerpc/platforms/44x/44x.h
> > +++ b/arch/powerpc/platforms/44x/44x.h
> > @@ -5,4 +5,6 @@ extern void as1_writeb(u8 data, volatile
> > extern void as1_writeb(u8 data, volatile u8 __iomem *addr);
> > extern void ppc44x_reset_system(char *cmd);
> >
> > +extern int ppc44x_idle_init(void);
> > +
> > #endif /* __POWERPC_PLATFORMS_44X_44X_H */
>
> The changes to this file aren't needed. See below.
>
> > diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile
> > --- a/arch/powerpc/platforms/44x/Makefile
> > +++ b/arch/powerpc/platforms/44x/Makefile
> > @@ -1,4 +1,5 @@ obj-$(CONFIG_44x) := misc_44x.o
> > obj-$(CONFIG_44x) := misc_44x.o
> > +obj-$(CONFIG_44x) += idle.o
>
> Just add this target to the already existing obj-(CONFIG_44x)
>
> > obj-$(CONFIG_EBONY) += ebony.o
> > obj-$(CONFIG_TAISHAN) += taishan.o
> > obj-$(CONFIG_BAMBOO) += bamboo.o
> > diff --git a/arch/powerpc/platforms/44x/bamboo.c b/arch/powerpc/platforms/44x/bamboo.c
> > --- a/arch/powerpc/platforms/44x/bamboo.c
> > +++ b/arch/powerpc/platforms/44x/bamboo.c
> > @@ -61,3 +61,5 @@ define_machine(bamboo) {
> > .restart = ppc44x_reset_system,
> > .calibrate_decr = generic_calibrate_decr,
> > };
> > +
> > +machine_late_initcall(bamboo, ppc44x_idle_init);
>
> Ugh. Don't add an init call to every 4xx board like this. It's not
> needed. See below.
>
> > diff --git a/arch/powerpc/platforms/44x/idle.c b/arch/powerpc/platforms/44x/idle.c
> > new file mode 100644
> > --- /dev/null
> > +++ b/arch/powerpc/platforms/44x/idle.c
>
> If you're ever going to extend bare metal support for this to 40x, then
> this is the wrong place for it. It should reside in
> arch/powerpc/sysdev/ppc4xx_soc.c in that case.
So I did this at first after your suggestions but then I changed it
because:
- it depended on CONFIG_4xx_SOC .. which I could not figure out who
actually enabled this
- wanted to make a patch that could also go into earlier kernels
>
> > +
> > +#include <linux/of.h>
> > +#include <asm/machdep.h>
> > +
> > +static void ppc44x_idle(void);
>
> This isn't needed. Move the structures below the function.
This can be done
>
> > +struct sleep_mode {
> > + char *name;
> > + void (*entry)(void);
> > +};
> > +
> > +static struct sleep_mode modes[] = {
> > + { .name = "spin", .entry = NULL },
> > + { .name = "wait", .entry = &ppc44x_idle },
> > +};
>
> <snip>
>
> > +int __init ppc44x_idle_init(void)
> > +{
> > + if(of_find_node_by_path("/hypervisor") != NULL) {
> > + /* if we find /hypervisor node is in device tree,
> > + set idle mode to wait */
> > + current_mode = 1; /* wait mode */
> > + }
> > +
> > + ppc_md.power_save = modes[current_mode].entry;
> > + return 0;
>
> I liked Hollis' method of assignment here.
>
> > +}
>
> Add an arch_initcall(ppc44x_idle_init); here and dispense with
> changing every board .c file in the 44x directory.
ah didn't know about arch_initcall
>
> josh
next prev parent reply other threads:[~2008-04-04 6:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-03 22:43 [PATCH] Add idle wait support for 44x platforms Jerone Young
2008-04-03 23:03 ` Tony Breeds
2008-04-04 1:59 ` Josh Boyer
2008-04-04 6:12 ` Jerone Young
2008-04-04 11:47 ` Josh Boyer
2008-04-08 2:17 ` Arnd Bergmann
2008-04-08 2:31 ` Josh Boyer
2008-04-08 2:41 ` Arnd Bergmann
2008-04-08 2:44 ` Josh Boyer
2008-04-03 23:13 ` [kvm-ppc-devel] " Hollis Blanchard
2008-04-04 0:17 ` Scott Wood
2008-04-04 6:15 ` Jerone Young
2008-04-04 2:00 ` Josh Boyer
2008-04-04 5:59 ` Jerone Young [this message]
2008-04-04 14:33 ` [kvm-ppc-devel] " Hollis Blanchard
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=1207288799.6971.11.camel@thinkpadL \
--to=jyoung5@us.ibm.com \
--cc=jwboyer@linux.vnet.ibm.com \
--cc=kvm-ppc-devel@lists.sourceforge.net \
--cc=linuxppc-dev@ozlabs.org \
/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;
as well as URLs for NNTP newsgroup(s).