Add idle power save for ppc 4xx
PATCH 1/1 Add idle power save for ppc 4xx
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1206933796 18000
# Node ID 15675e59e019c4800a834ae79090d92b07f1d0ce # Parent 1506aa38ddabb0bf73fff3ac3f3db5f9ef6458cc Add idle power save for ppc 4xx
This patch sets the wait state MSR when power_save is called in cpu_idle loop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.
arch/powerpc/kernel/Makefile +1 -0
@@ -39,6 +39,7 @@ obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsy obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_6xx) += idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o +obj-$(CONFIG_4xx) += idle_4xx.o obj-$(CONFIG_TAU) += tau_6xx.o obj-$(CONFIG_HIBERNATION) += swsusp.o suspend.o \ swsusp_$(CONFIG_WORD_SIZE).o
arch/powerpc/kernel/idle_4xx.c new file +24 -0
@@ -0,0 +1,24 @@ +/* +* This file contains the power_save function for 4xx CPUs +* +* added by Jerone Young <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#include <asm/processor.h> +#include <asm/machdep.h> + +void ppc4xx_idle () +{ +unsigned long msr_save; + +/* set wait state MSR */ +local_irq_enable (); + msr_save =mfmsr (); +mtmsr (msr_save|MSR_WE ); +local_irq_disable (); +}
arch/powerpc/kernel/setup_32.c +4 -0
@@ -132,6 +132,10 @@ void __init machine_init(unsigned long dif (cpu_has_feature (CPU_FTR_CAN_DOZE ) ||cpu_has_feature (CPU_FTR_CAN_NAP )) ppc_md.power_save = ppc6xx_idle; +#endif + +#ifdef CONFIG_4xx + ppc_md.power_save = ppc4xx_idle;#endif if (ppc_md.progress)
include/asm-powerpc/machdep.h +1 -0
@@ -266,6 +266,7 @@ extern void power4_idle(void);extern void power4_idle (void );extern void power4_cpu_offline_powersave (void );extern void ppc6xx_idle (void ); +extern void ppc4xx_idle (void );/* * ppc_md contains a copy of the machine description structure for the
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
PATCH 1/1 Add idle power save for ppc 4xx for
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1207122427 18000
# Node ID 6e9ae9e1e5992339ca1f3efa93f8200cf24cbee5 # Parent 1506aa38ddabb0bf73fff3ac3f3db5f9ef6458cc Add idle power save for ppc 4xx for 2.6.25
This patch sets the wait state MSR when power_save is called in cpu_idle loop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.
I have tested this on hardware & KVM virtual guest.
The issue though is this is a temporary patch. As the one that will be sent upstream is based on linux-next (2.6.26) and is not the same as the 2.6.25 patch.
arch/powerpc/kernel/Makefile +1 -0
@@ -39,6 +39,7 @@ obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsy obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_6xx) += idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o +obj-$(CONFIG_4xx) += idle_4xx.o obj-$(CONFIG_TAU) += tau_6xx.o obj-$(CONFIG_HIBERNATION) += swsusp.o suspend.o \ swsusp_$(CONFIG_WORD_SIZE).o
arch/powerpc/kernel/idle_4xx.c new file +22 -0
@@ -0,0 +1,22 @@ +/* +* This file contains the power_save function for 4xx CPUs +* +* added by Jerone Young <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#include <asm/processor.h> +#include <asm/machdep.h> + +void ppc4xx_idle (void ) +{ +unsigned long msr_save; + +/* set wait state MSR */ + msr_save =mfmsr (); +mtmsr (msr_save|MSR_WE |MSR_EE |MSR_CE ); +}
arch/powerpc/kernel/setup_32.c +4 -0
@@ -132,6 +132,10 @@ void __init machine_init(unsigned long dif (cpu_has_feature (CPU_FTR_CAN_DOZE ) ||cpu_has_feature (CPU_FTR_CAN_NAP )) ppc_md.power_save = ppc6xx_idle; +#endif + +#ifdef CONFIG_4xx + ppc_md.power_save = ppc4xx_idle;#endif if (ppc_md.progress)
include/asm-powerpc/machdep.h +1 -0
@@ -266,6 +266,7 @@ extern void power4_idle(void);extern void power4_idle (void );extern void power4_cpu_offline_powersave (void );extern void ppc6xx_idle (void ); +extern void ppc4xx_idle (void );/* * ppc_md contains a copy of the machine description structure for the
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 49 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1207122427 18000
# Node ID6e9ae9e1e5992339ca1f3efa93f8200cf24cbee5# Parent1506aa38ddabb0bf73fff3ac3f3db5f9ef6458ccAdd idle power save for ppc 4xx for 2.6.25This patch sets the wait state MSR when
power_saveis called incpu_idleloop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.I have tested this on hardware & KVM virtual guest.
The issue though is this is a temporary patch. As the one that will be sent upstream is based on linux-next (2.6.26) and is not the same as the 2.6.25 patch.
Signed-off-by Jerone Young <[email protected]>arch/powerpc/kernel/ renamed from arch/powerpc/kernel/Makefile +0
-0
Makefilearch/powerpc/kernel/Makefile +1
-0@@ -39,6 +39,7 @@ obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsy obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_6xx) += idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o +obj-$(CONFIG_4xx) += idle_4xx.o obj-$(CONFIG_TAU) += tau_6xx.o obj-$(CONFIG_HIBERNATION) += swsusp.o suspend.o \ swsusp_$(CONFIG_WORD_SIZE).oarch/powerpc/kernel/ renamed from arch/powerpc/kernel/idle_4xx.c +0
-0
idle_4xx.c
new file mode 100644arch/powerpc/kernel/idle_4xx.c new file +11
-0@@ -0,0 +1,22 @@ +/* +* This file contains the power_save function for 4xx CPUs +* +* added by Jerone Young <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ +
arch/powerpc/kernel/idle_4xx.c line 21
Quoted 10 lines
arch/powerpc/kernel/idle_4xx.c new file +10
-0+#include <asm/processor.h> +#include <asm/machdep.h> + +void ppc4xx_idle (void ) +{ +unsigned long msr_save; + +/* set wait state MSR */ + msr_save =mfmsr (); +mtmsr (msr_save|MSR_WE |MSR_EE |MSR_CE );
1) I think you also want MSR_DE here, no?
2) Just to be safe, I'd also append an isync();
3) In case MSR_WE does nothing, or continues from here I'd append "mstmsr(msr_save); isync();" as well
-JX
Quoted 30 lines
arch/powerpc/kernel/idle_4xx.c new file +1
-0+}arch/powerpc/kernel/ renamed from arch/powerpc/kernel/setup_32.c +0
-0
setup_32.carch/powerpc/kernel/setup_32.c +4
-0@@ -132,6 +132,10 @@ void __init machine_init(unsigned long dif (cpu_has_feature (CPU_FTR_CAN_DOZE ) ||cpu_has_feature (CPU_FTR_CAN_NAP )) ppc_md.power_save = ppc6xx_idle; +#endif + +#ifdef CONFIG_4xx + ppc_md.power_save = ppc4xx_idle;#endif if (ppc_md.progress)include/asm-powerpc/ renamed from include/asm-powerpc/machdep.h +0
-0
machdep.hinclude/asm-powerpc/machdep.h +1
-0@@ -266,6 +266,7 @@ extern void power4_idle(void);extern void power4_idle (void );extern void power4_cpu_offline_powersave (void );extern void ppc6xx_idle (void ); +extern void ppc4xx_idle (void );/* * ppc_md contains a copy of the machine description structure for the
Quoted 11 lines
----------------------------------------------------------------------
---
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/
marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Re: [kvm-ppc-devel] [PATCH 1 of 2] Add idle power save for ppc
In reply to Jerone YoungQuoted 58 lines · Jimi Xenidis
Quoted 56 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1207122427 18000
# Node ID6e9ae9e1e5992339ca1f3efa93f8200cf24cbee5# Parent1506aa38ddabb0bf73fff3ac3f3db5f9ef6458ccAdd idle power save for ppc 4xx for 2.6.25This patch sets the wait state MSR when
power_saveis called incpu_idleloop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.I have tested this on hardware & KVM virtual guest.
The issue though is this is a temporary patch. As the one that will be sent upstream is based on linux-next (2.6.26) and is not the same as the 2.6.25 patch.
Signed-off-by Jerone Young <[email protected]>arch/powerpc/kernel/ renamed from arch/powerpc/kernel/Makefile +0
-0
Makefilearch/powerpc/kernel/Makefile +1
-0@@ -39,6 +39,7 @@ obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsy obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_6xx) += idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o +obj-$(CONFIG_4xx) += idle_4xx.o obj-$(CONFIG_TAU) += tau_6xx.o obj-$(CONFIG_HIBERNATION) += swsusp.o suspend.o \ swsusp_$(CONFIG_WORD_SIZE).oarch/powerpc/kernel/ renamed from arch/powerpc/kernel/idle_4xx.c +0
-0
idle_4xx.c
new file mode 100644arch/powerpc/kernel/idle_4xx.c new file +18
-0@@ -0,0 +1,22 @@ +/* +* This file contains the power_save function for 4xx CPUs +* +* added by Jerone Young <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#include <asm/processor.h> +#include <asm/machdep.h> + +void ppc4xx_idle (void ) +{ +unsigned long msr_save; +
Quoted 8 lines
arch/powerpc/kernel/idle_4xx.c
Quoted 3 lines
arch/powerpc/kernel/idle_4xx.c new file +3
-0+/* set wait state MSR */ + msr_save =mfmsr (); +mtmsr (msr_save|MSR_WE |MSR_EE |MSR_CE );1) I think you also want
MSR_DEhere, no?
2) Just to be safe, I'd also append anisync();
3) In caseMSR_WEdoes nothing, or continues from here I'd append "mstmsr(msr_save);isync();" as well
Looks like using local_irq_enable() just might have been a better idea after all.
So the MSR_DE is yet another case that could go here. If it was on coming into power_save...I'm assuming it would get disabled by local_irq_disable().
Looks like using isync after the mtmsr looks to be a good safety net.
Quoted 35 lines
-JX
Quoted 30 lines
arch/powerpc/kernel/idle_4xx.c new file +1
-0+}arch/powerpc/kernel/ renamed from arch/powerpc/kernel/setup_32.c +0
-0
setup_32.carch/powerpc/kernel/setup_32.c +4
-0@@ -132,6 +132,10 @@ void __init machine_init(unsigned long dif (cpu_has_feature (CPU_FTR_CAN_DOZE ) ||cpu_has_feature (CPU_FTR_CAN_NAP )) ppc_md.power_save = ppc6xx_idle; +#endif + +#ifdef CONFIG_4xx + ppc_md.power_save = ppc4xx_idle;#endif if (ppc_md.progress)include/asm-powerpc/ renamed from include/asm-powerpc/machdep.h +0
-0
machdep.hinclude/asm-powerpc/machdep.h +1
-0@@ -266,6 +266,7 @@ extern void power4_idle(void);extern void power4_idle (void );extern void power4_cpu_offline_powersave (void );extern void ppc6xx_idle (void ); +extern void ppc4xx_idle (void );/* * ppc_md contains a copy of the machine description structure for the
Quoted 12 lines
Quoted 11 lines
----------------------------------------------------------------------
---
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/
marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
PATCH 1/1 Add idle power save for ppc 4xx for
In reply to Jerone Young# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1207159627 18000
# Node ID 007c135cb5f14f5eb025c103623c2ebfcc76ab11 # Parent 1506aa38ddabb0bf73fff3ac3f3db5f9ef6458cc Add idle power save for ppc 4xx for 2.6.25
This patch sets the wait state MSR when power_save is called in cpu_idle loop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.
I have tested this on hardware & KVM virtual guest.
The issue though is this is a temporary patch. As the one that will be sent upstream is based on linux-next (2.6.26) and is not the same as the 2.6.25 patch.
arch/powerpc/kernel/Makefile +1 -0
@@ -39,6 +39,7 @@ obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsy obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_6xx) += idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o +obj-$(CONFIG_4xx) += idle_4xx.o obj-$(CONFIG_TAU) += tau_6xx.o obj-$(CONFIG_HIBERNATION) += swsusp.o suspend.o \ swsusp_$(CONFIG_WORD_SIZE).o
arch/powerpc/kernel/idle_4xx.c new file +24 -0
@@ -0,0 +1,24 @@ +/* +* This file contains the power_save function for 4xx CPUs +* +* Copyright 2008 IBM Corporation. +* added by Jerone Young <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#include <asm/processor.h> +#include <asm/machdep.h> + +void ppc4xx_idle (void ) +{ +unsigned long msr_save; + +/* set wait state MSR */ + msr_save =mfmsr (); +mtmsr (msr_save|MSR_WE |MSR_EE |MSR_CE |MSR_DE ); +isync (); +}
arch/powerpc/kernel/setup_32.c +4 -0
@@ -132,6 +132,10 @@ void __init machine_init(unsigned long dif (cpu_has_feature (CPU_FTR_CAN_DOZE ) ||cpu_has_feature (CPU_FTR_CAN_NAP )) ppc_md.power_save = ppc6xx_idle; +#endif + +#ifdef CONFIG_4xx + ppc_md.power_save = ppc4xx_idle;#endif if (ppc_md.progress)
include/asm-powerpc/machdep.h +1 -0
@@ -266,6 +266,7 @@ extern void power4_idle(void);extern void power4_idle (void );extern void power4_cpu_offline_powersave (void );extern void ppc6xx_idle (void ); +extern void ppc4xx_idle (void );/* * ppc_md contains a copy of the machine description structure for the
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 45 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1207159627 18000
# Node ID007c135cb5f14f5eb025c103623c2ebfcc76ab11# Parent1506aa38ddabb0bf73fff3ac3f3db5f9ef6458ccAdd idle power save for ppc 4xx for 2.6.25This patch sets the wait state MSR when
power_saveis called incpu_idleloop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.I have tested this on hardware & KVM virtual guest.
The issue though is this is a temporary patch. As the one that will be sent upstream is based on linux-next (2.6.26) and is not the same as the 2.6.25 patch.
Signed-off-by Jerone Young <[email protected]>arch/powerpc/kernel/Makefile +1
-0@@ -39,6 +39,7 @@ obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsy obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_6xx) += idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o +obj-$(CONFIG_4xx) += idle_4xx.o obj-$(CONFIG_TAU) += tau_6xx.o obj-$(CONFIG_HIBERNATION) += swsusp.o suspend.o \ swsusp_$(CONFIG_WORD_SIZE).oarch/powerpc/kernel/idle_4xx.c new file +14
-0@@ -0,0 +1,24 @@ +/* +* This file contains the power_save function for 4xx CPUs +* +* Copyright 2008 IBM Corporation. +* added by Jerone Young <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#include <asm/processor.h> +#include <asm/machdep.h>
arch/powerpc/kernel/idle_4xx.c line 24
Quoted 10 lines
arch/powerpc/kernel/idle_4xx.c new file +10
-0+ +void ppc4xx_idle (void ) +{ +unsigned long msr_save; + +/* set wait state MSR */ + msr_save =mfmsr (); +mtmsr (msr_save|MSR_WE |MSR_EE |MSR_CE |MSR_DE ); +isync (); +}
I think Jimi's comment #3 is still worth to be considered:
3) In case MSR_WE does nothing, or continues from here I'd append "mstmsr(msr_save); isync();" as well
And another comment that was from Arnd Bergmann into the same direction:
[...] if only to make the function return with the same state that it was entered.
wich would then be something like
arch/powerpc/kernel/idle_4xx.c
Quoted 8 lines
arch/powerpc/kernel/idle_4xx.c new file +8
-0+void ppc4xx_idle (void ) +{ +unsigned long msr_save; + +/* set wait state MSR */ + msr_save =mfmsr (); +mtmsr (msr_save|MSR_WE |MSR_EE |MSR_CE |MSR_DE ); +isync ();
-> mtspr(msr_save);
-> isync();
Quoted 1 line
+}
I think it's more correct to leave as we enter.
btw - Hollis was faster, but I wanted to add for the kvm kernel part I also think placing it in emulate_instruction would save checks on every exit.
Quoted 35 lines
arch/powerpc/kernel/setup_32.c +4
-0@@ -132,6 +132,10 @@ void __init machine_init(unsigned long dif (cpu_has_feature (CPU_FTR_CAN_DOZE ) ||cpu_has_feature (CPU_FTR_CAN_NAP )) ppc_md.power_save = ppc6xx_idle; +#endif + +#ifdef CONFIG_4xx + ppc_md.power_save = ppc4xx_idle;#endif if (ppc_md.progress)include/asm-powerpc/machdep.h +1
-1@@ -266,6 +266,7 @@ extern void power4_idle(void);extern void power4_idle (void );extern void power4_cpu_offline_powersave (void );extern void ppc6xx_idle (void ); +extern void ppc4xx_idle (void );/* * ppc_md contains a copy of the machine description structure for the ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Signature · 13 lines
Grüsse / regards, Christian Ehrhardt IBM Linux Technology Center, Open Virtualization ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ kvm-ppc-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
PATCH 1/1 Add idle power save for ppc 4xx for
In reply to Jerone Young# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1207250239 18000
# Node ID b7794c1fa50b531c9b84382c3f3d9a5466d86c0d # Parent 1506aa38ddabb0bf73fff3ac3f3db5f9ef6458cc Add idle power save for ppc 4xx for 2.6.25
This patch sets the wait state MSR when power_save is called in cpu_idle loop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.
I have tested this on hardware & KVM virtual guest.
The issue though is this is a temporary patch. As the one that will be sent upstream is based on linux-next (2.6.26) and is not the same as the 2.6.25 patch.
arch/powerpc/kernel/Makefile +1 -0
@@ -39,6 +39,7 @@ obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsy obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_6xx) += idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o +obj-$(CONFIG_4xx) += idle_4xx.o obj-$(CONFIG_TAU) += tau_6xx.o obj-$(CONFIG_HIBERNATION) += swsusp.o suspend.o \ swsusp_$(CONFIG_WORD_SIZE).o
arch/powerpc/kernel/idle_4xx.c new file +23 -0
@@ -0,0 +1,23 @@ +/* +* This file contains the power_save function for 4xx CPUs +* +* Copyright 2008 IBM Corporation. +* added by Jerone Young <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#include <asm/processor.h> +#include <asm/machdep.h> + +void ppc4xx_idle (void ) +{ +unsigned long msr_save; + +/* set wait state MSR */ + msr_save =mfmsr (); +mtmsr (msr_save|MSR_WE |MSR_EE |MSR_CE ); +}
arch/powerpc/kernel/setup_32.c +4 -0
@@ -132,6 +132,10 @@ void __init machine_init(unsigned long dif (cpu_has_feature (CPU_FTR_CAN_DOZE ) ||cpu_has_feature (CPU_FTR_CAN_NAP )) ppc_md.power_save = ppc6xx_idle; +#endif + +#ifdef CONFIG_4xx + ppc_md.power_save = ppc4xx_idle;#endif if (ppc_md.progress)
include/asm-powerpc/machdep.h +1 -0
@@ -266,6 +266,7 @@ extern void power4_idle(void);extern void power4_idle (void );extern void power4_cpu_offline_powersave (void );extern void ppc6xx_idle (void ); +extern void ppc4xx_idle (void );/* * ppc_md contains a copy of the machine description structure for the
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel