powerpc/powernv: Add OPAL call to resync timebase on wakeup
authorVaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
Wed, 26 Feb 2014 00:08:43 +0000 (05:38 +0530)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 5 Mar 2014 04:56:54 +0000 (15:56 +1100)
During "Fast-sleep" and deeper power savings state, decrementer and
timebase could be stopped making it out of sync with rest
of the cores in the system.

Add a firmware call to request platform to resync timebase
using low level platform methods.

Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
Signed-off-by: Preeti U. Murthy <preeti@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/include/asm/opal.h
arch/powerpc/kernel/exceptions-64s.S
arch/powerpc/kernel/idle_power7.S
arch/powerpc/platforms/powernv/opal-wrappers.S

index 40157e2ca6914467cddae0225070d8582ad0861c..c71c72e47d475875ccef284f31a388eb42f41240 100644 (file)
@@ -154,6 +154,7 @@ extern int opal_enter_rtas(struct rtas_args *args,
 #define OPAL_FLASH_VALIDATE                    76
 #define OPAL_FLASH_MANAGE                      77
 #define OPAL_FLASH_UPDATE                      78
+#define OPAL_RESYNC_TIMEBASE                   79
 #define OPAL_GET_MSG                           85
 #define OPAL_CHECK_ASYNC_COMPLETION            86
 #define OPAL_SYNC_HOST_REBOOT                  87
@@ -865,6 +866,7 @@ extern void opal_flash_init(void);
 extern int opal_machine_check(struct pt_regs *regs);
 
 extern void opal_shutdown(void);
+extern int opal_resync_timebase(void);
 
 extern void opal_lpc_init(void);
 
index b01a9cb441e453ca72ef4fe856c954193521bdaa..9533d7a9223c3fe2945e8d52783534fd28e7b7bb 100644 (file)
@@ -145,7 +145,7 @@ BEGIN_FTR_SECTION
 
        /* Fast Sleep wakeup on PowerNV */
 8:     GET_PACA(r13)
-       b       .power7_wakeup_loss
+       b       .power7_wakeup_tb_loss
 
 9:
 END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)
index 14f78bec62c49e712f02e0836a40fb30cfd41c26..c3ab86975614a4a9d4af842962fa66f32c5c8e47 100644 (file)
@@ -17,6 +17,7 @@
 #include <asm/ppc-opcode.h>
 #include <asm/hw_irq.h>
 #include <asm/kvm_book3s_asm.h>
+#include <asm/opal.h>
 
 #undef DEBUG
 
@@ -125,6 +126,32 @@ _GLOBAL(power7_sleep)
        b       power7_powersave_common
        /* No return */
 
+_GLOBAL(power7_wakeup_tb_loss)
+       ld      r2,PACATOC(r13);
+       ld      r1,PACAR1(r13)
+
+       /* Time base re-sync */
+       li      r0,OPAL_RESYNC_TIMEBASE
+       LOAD_REG_ADDR(r11,opal);
+       ld      r12,8(r11);
+       ld      r2,0(r11);
+       mtctr   r12
+       bctrl
+
+       /* TODO: Check r3 for failure */
+
+       REST_NVGPRS(r1)
+       REST_GPR(2, r1)
+       ld      r3,_CCR(r1)
+       ld      r4,_MSR(r1)
+       ld      r5,_NIP(r1)
+       addi    r1,r1,INT_FRAME_SIZE
+       mtcr    r3
+       mfspr   r3,SPRN_SRR1            /* Return SRR1 */
+       mtspr   SPRN_SRR1,r4
+       mtspr   SPRN_SRR0,r5
+       rfid
+
 _GLOBAL(power7_wakeup_loss)
        ld      r1,PACAR1(r13)
        REST_NVGPRS(r1)
index 3e8829c40fbbfc436adb206fb297b82ea7385e89..aab54b60334fc1cfb29216a2f06bf8ef78f5aee6 100644 (file)
@@ -126,6 +126,7 @@ OPAL_CALL(opal_return_cpu,                  OPAL_RETURN_CPU);
 OPAL_CALL(opal_validate_flash,                 OPAL_FLASH_VALIDATE);
 OPAL_CALL(opal_manage_flash,                   OPAL_FLASH_MANAGE);
 OPAL_CALL(opal_update_flash,                   OPAL_FLASH_UPDATE);
+OPAL_CALL(opal_resync_timebase,                        OPAL_RESYNC_TIMEBASE);
 OPAL_CALL(opal_get_msg,                                OPAL_GET_MSG);
 OPAL_CALL(opal_check_completion,               OPAL_CHECK_ASYNC_COMPLETION);
 OPAL_CALL(opal_sync_host_reboot,               OPAL_SYNC_HOST_REBOOT);
This page took 0.028512 seconds and 5 git commands to generate.