Skip to contentSkip to conversation

KVM: PPC: add paravirt idle loop for 64-bit book E

PATCH Superseded Stuart Yoder 4 participants 4 messages Jan 22, 2013 – Jan 24, 2013

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 KVM: PPC: add paravirt idle loop for 64-bit book E

From: Stuart Yoder <[email protected]>

---

-v2
-macro'ized loop in idle_book3e.S to avoid code
duplication, paravirt loop is now in idle_book3e.S

 arch/powerpc/kernel/epapr_hcalls.S |    2 ++
 arch/powerpc/kernel/idle_book3e.S  |   30 ++++++++++++++++++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)
arch/powerpc/kernel/epapr_hcalls.S +2 -0
index 62c0dc2..9f1ebf7 100644
@@ -17,6 +17,7 @@
 #include <asm/asm-compat.h>
 #include <asm/asm-offsets.h>
 
+#ifndef CONFIG_PPC64
 /* epapr_ev_idle() was derived from e500_idle() */
 _GLOBAL(epapr_ev_idle)
 	CURRENT_THREAD_INFO(r3, r1)
@@ -42,6 +43,7 @@ epapr_ev_idle_start:
 	 * _TLF_NAPPING.
 	 */
 	b	idle_loop
+#endif
 
 /* Hypercall entry point. Will be patched with device tree instructions. */
 .global epapr_hypercall_start
arch/powerpc/kernel/idle_book3e.S +28 -2
index 4c7cb400..e1c9acd 100644
@@ -16,11 +16,13 @@
 #include <asm/ppc-opcode.h>
 #include <asm/processor.h>
 #include <asm/thread_info.h>
+#include <asm/epapr_hcalls.h>
 
 /* 64-bit version only for now */
 #ifdef CONFIG_PPC64
 
-_GLOBAL(book3e_idle)
+.macro BOOK3E_IDLE name loop
+_GLOBAL(\name)
 	/* Save LR for later */
 	mflr	r0
 	std	r0,16(r1)
@@ -67,7 +69,31 @@ _GLOBAL(book3e_idle)
 
 	/* We can now re-enable hard interrupts and go to sleep */
 	wrteei	1
-1:	PPC_WAIT(0)
+	\loop
+
+.endm
+
+.macro BOOK3E_IDLE_LOOP
+1:
+	PPC_WAIT(0)
 	b	1b
+.endm
+
+.macro EPAPR_EV_IDLE_LOOP
+idle_loop:
+       LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
+
+.global epapr_ev_idle_start
+epapr_ev_idle_start:
+       li      r3, -1
+       nop
+       nop
+       nop
+       b       idle_loop
+.endm
+
+BOOK3E_IDLE epapr_ev_idle, EPAPR_EV_IDLE_LOOP
+
+BOOK3E_IDLE book3e_idle BOOK3E_IDLE_LOOP
 
 #endif /* CONFIG_PPC64 */
Signature · 1 line
1.7.9.7
#1 lore raw
Quoted 3 lines · Stuart Yoder

From: Stuart Yoder <[email protected]>

Ben, this one is in generic powerpc code, so I'd say it's for you :).

Alex

Quoted 86 lines

---

-v2
-macro'ized loop in idle_book3e.S to avoid code
duplication, paravirt loop is now in idle_book3e.S

arch/powerpc/kernel/epapr_hcalls.S | 2 ++
arch/powerpc/kernel/idle_book3e.S | 30 ++++++++++++++++++++++++++++--

2 files changed, 30 insertions(+), 2 deletions(-)
arch/powerpc/kernel/epapr_hcalls.S +2 -0
index 62c0dc2..9f1ebf7 100644
@@ -17,6 +17,7 @@
 #include <asm/asm-compat.h>
 #include <asm/asm-offsets.h>
 
+#ifndef CONFIG_PPC64
 /* epapr_ev_idle() was derived from e500_idle() */
 _GLOBAL(epapr_ev_idle)
 	CURRENT_THREAD_INFO(r3, r1)
@@ -42,6 +43,7 @@ epapr_ev_idle_start:
 	 * _TLF_NAPPING.
 	 */
 	b	idle_loop
+#endif
 
 /* Hypercall entry point. Will be patched with device tree instructions. */

.global epapr_hypercall_start

arch/powerpc/kernel/idle_book3e.S +28 -2
index 4c7cb400..e1c9acd 100644
@@ -16,11 +16,13 @@
 #include <asm/ppc-opcode.h>
 #include <asm/processor.h>
 #include <asm/thread_info.h>
+#include <asm/epapr_hcalls.h>
 
 /* 64-bit version only for now */
 #ifdef CONFIG_PPC64
 
-_GLOBAL(book3e_idle)
+.macro BOOK3E_IDLE name loop
+_GLOBAL(\name)
 	/* Save LR for later */
 	mflr	r0
 	std	r0,16(r1)
@@ -67,7 +69,31 @@ _GLOBAL(book3e_idle)
 
 	/* We can now re-enable hard interrupts and go to sleep */
 	wrteei	1
-1:	PPC_WAIT(0)
+	\loop
+
+.endm
+
+.macro BOOK3E_IDLE_LOOP
+1:
+	PPC_WAIT(0)
 	b	1b
+.endm
+
+.macro EPAPR_EV_IDLE_LOOP
+idle_loop:
+       LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
+
+.global epapr_ev_idle_start
+epapr_ev_idle_start:
+       li      r3, -1
+       nop
+       nop
+       nop
+       b       idle_loop
+.endm
+
+BOOK3E_IDLE epapr_ev_idle, EPAPR_EV_IDLE_LOOP
+
+BOOK3E_IDLE book3e_idle BOOK3E_IDLE_LOOP
 
 #endif /* CONFIG_PPC64 */
Signature · 1 line
1.7.9.7
#2 lore raw
In reply to Stuart Yoder
Quoted 12 lines · Stuart Yoder

+.macro BOOK3E_IDLE_LOOP
+1:

arch/powerpc/kernel/idle_book3e.S +9 -0
+	PPC_WAIT(0)
 	b	1b
+.endm
+
+.macro EPAPR_EV_IDLE_LOOP
+idle_loop:
+       LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
+
+.global epapr_ev_idle_start
+epapr_ev_idle_start:

arch/powerpc/kernel/idle_book3e.S _GLOBAL(book3e_idle) · line 97

Quoted 10 lines
arch/powerpc/kernel/idle_book3e.S +10 -0
+       li      r3, -1
+       nop
+       nop
+       nop
+       b       idle_loop
+.endm
+
+BOOK3E_IDLE epapr_ev_idle, EPAPR_EV_IDLE_LOOP
+
+BOOK3E_IDLE book3e_idle BOOK3E_IDLE_LOOP

Why the comma after epapr_ev_idle but not after book3e_idle?

Also you have spaces where there should be tabs.

Otherwise looks good.

-Scott

#3 lore raw
Quoted 36 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Thursday, January 24, 2013 12:22 PM
To: Yoder Stuart-B08248
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Yoder Stuart-B08248
Subject: Re: [PATCH][v2] KVM: PPC: add paravirt idle loop for 64-bit book E

Quoted 12 lines · Stuart Yoder

+.macro BOOK3E_IDLE_LOOP
+1:

arch/powerpc/kernel/idle_book3e.S +9 -0
+	PPC_WAIT(0)
 	b	1b
+.endm
+
+.macro EPAPR_EV_IDLE_LOOP
+idle_loop:
+       LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
+
+.global epapr_ev_idle_start
+epapr_ev_idle_start:

arch/powerpc/kernel/idle_book3e.S _GLOBAL(book3e_idle) · line 97

Quoted 10 lines
arch/powerpc/kernel/idle_book3e.S +10 -0
+       li      r3, -1
+       nop
+       nop
+       nop
+       b       idle_loop
+.endm
+
+BOOK3E_IDLE epapr_ev_idle, EPAPR_EV_IDLE_LOOP
+
+BOOK3E_IDLE book3e_idle BOOK3E_IDLE_LOOP

Why the comma after epapr_ev_idle but not after book3e_idle?

Quoted 3 lines

Also you have spaces where there should be tabs.

Otherwise looks good.

Hmm...there shouldn't be a comma there. I'll respin and fix the whitespace too.

Stuart