powerpc: Add paravirt idle loop for 64-bit Book-E
authorStuart Yoder <stuart.yoder@freescale.com>
Fri, 8 Feb 2013 19:22:56 +0000 (13:22 -0600)
committerKumar Gala <galak@kernel.crashing.org>
Wed, 13 Mar 2013 19:19:36 +0000 (14:19 -0500)
Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/kernel/epapr_hcalls.S
arch/powerpc/kernel/idle_book3e.S

index 62c0dc2378266653cd97591f095261d2ed5c901a..9f1ebf7338f1084499fcc03e50efa71b66a73b76 100644 (file)
@@ -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
index 4c7cb40085851fa2b21cc4ceebd6cc302485f36b..bfb73cc209ceb3885f60a2ba873fb271940f414d 100644 (file)
 #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,33 @@ _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
+
+/* epapr_ev_idle_start below is patched with the proper hcall
+   opcodes during kernel initialization */
+.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 */