linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/e500mc: Add support for the wait instruction in e500_idle
@ 2011-06-22 23:10 Scott Wood
  2011-06-27 13:35 ` Kumar Gala
  0 siblings, 1 reply; 2+ messages in thread
From: Scott Wood @ 2011-06-22 23:10 UTC (permalink / raw)
  To: galak; +Cc: linuxppc-dev

e500mc cannot doze or nap due to an erratum (as well as having a
different mechanism than previous e500), but it has a "wait" instruction
that is similar to doze.

On 64-bit, due to the soft-irq-disable mechanism, the existing
book3e_idle should be used instead.

Signed-off-by: Vakul Garg <vakul@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/kernel/idle_e500.S        |   12 ++++++++++++
 arch/powerpc/platforms/85xx/p3041_ds.c |    1 +
 arch/powerpc/platforms/85xx/p4080_ds.c |    1 +
 arch/powerpc/platforms/85xx/p5020_ds.c |    5 +++++
 4 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/idle_e500.S b/arch/powerpc/kernel/idle_e500.S
index 47a1a98..3e2b95c 100644
--- a/arch/powerpc/kernel/idle_e500.S
+++ b/arch/powerpc/kernel/idle_e500.S
@@ -26,6 +26,17 @@ _GLOBAL(e500_idle)
 	ori	r4,r4,_TLF_NAPPING	/* so when we take an exception */
 	stw	r4,TI_LOCAL_FLAGS(r3)	/* it will return to our caller */
 
+#ifdef CONFIG_E500MC
+	wrteei	1
+1:	wait
+
+	/*
+	 * Guard against spurious wakeups (e.g. from a hypervisor) --
+	 * any real interrupt will cause us to return to LR due to
+	 * _TLF_NAPPING.
+	 */
+	b	1b
+#else
 	/* Check if we can nap or doze, put HID0 mask in r3 */
 	lis	r3,0
 BEGIN_FTR_SECTION
@@ -72,6 +83,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_L2CSR|CPU_FTR_CAN_NAP)
 	mtmsr	r7
 	isync
 2:	b	2b
+#endif /* !E500MC */
 
 /*
  * Return from NAP/DOZE mode, restore some CPU specific registers,
diff --git a/arch/powerpc/platforms/85xx/p3041_ds.c b/arch/powerpc/platforms/85xx/p3041_ds.c
index 0ed52e1..3611330 100644
--- a/arch/powerpc/platforms/85xx/p3041_ds.c
+++ b/arch/powerpc/platforms/85xx/p3041_ds.c
@@ -55,6 +55,7 @@ define_machine(p3041_ds) {
 	.restart		= fsl_rstcr_restart,
 	.calibrate_decr		= generic_calibrate_decr,
 	.progress		= udbg_progress,
+	.power_save		= e500_idle,
 };
 
 machine_device_initcall(p3041_ds, corenet_ds_publish_devices);
diff --git a/arch/powerpc/platforms/85xx/p4080_ds.c b/arch/powerpc/platforms/85xx/p4080_ds.c
index 8417046..98c7e6a 100644
--- a/arch/powerpc/platforms/85xx/p4080_ds.c
+++ b/arch/powerpc/platforms/85xx/p4080_ds.c
@@ -68,6 +68,7 @@ define_machine(p4080_ds) {
 	.restart		= fsl_rstcr_restart,
 	.calibrate_decr		= generic_calibrate_decr,
 	.progress		= udbg_progress,
+	.power_save		= e500_idle,
 };
 
 machine_device_initcall(p4080_ds, corenet_ds_publish_devices);
diff --git a/arch/powerpc/platforms/85xx/p5020_ds.c b/arch/powerpc/platforms/85xx/p5020_ds.c
index 7467b71..aa2e494 100644
--- a/arch/powerpc/platforms/85xx/p5020_ds.c
+++ b/arch/powerpc/platforms/85xx/p5020_ds.c
@@ -60,6 +60,11 @@ define_machine(p5020_ds) {
 	.restart		= fsl_rstcr_restart,
 	.calibrate_decr		= generic_calibrate_decr,
 	.progress		= udbg_progress,
+#ifdef CONFIG_PPC64
+	.power_save		= book3e_idle,
+#else
+	.power_save		= e500_idle,
+#endif
 };
 
 machine_device_initcall(p5020_ds, corenet_ds_publish_devices);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] powerpc/e500mc: Add support for the wait instruction in e500_idle
  2011-06-22 23:10 [PATCH] powerpc/e500mc: Add support for the wait instruction in e500_idle Scott Wood
@ 2011-06-27 13:35 ` Kumar Gala
  0 siblings, 0 replies; 2+ messages in thread
From: Kumar Gala @ 2011-06-27 13:35 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev


On Jun 22, 2011, at 6:10 PM, Scott Wood wrote:

> e500mc cannot doze or nap due to an erratum (as well as having a
> different mechanism than previous e500), but it has a "wait" instruction
> that is similar to doze.
> 
> On 64-bit, due to the soft-irq-disable mechanism, the existing
> book3e_idle should be used instead.
> 
> Signed-off-by: Vakul Garg <vakul@freescale.com>
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> ---
> arch/powerpc/kernel/idle_e500.S        |   12 ++++++++++++
> arch/powerpc/platforms/85xx/p3041_ds.c |    1 +
> arch/powerpc/platforms/85xx/p4080_ds.c |    1 +
> arch/powerpc/platforms/85xx/p5020_ds.c |    5 +++++
> 4 files changed, 19 insertions(+), 0 deletions(-)

applied to next

- K

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-27 13:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-22 23:10 [PATCH] powerpc/e500mc: Add support for the wait instruction in e500_idle Scott Wood
2011-06-27 13:35 ` Kumar Gala

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).