diff options
author | Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> | 2014-02-25 19:08:43 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-03-04 23:56:54 -0500 |
commit | 97eb001f03494758a938300908b88929163650ce (patch) | |
tree | a266f44413ae0418c95436e505b7441d041e328e | |
parent | aca79d2b6ec2c0b955b22abb71c6dab90fa1d4d5 (diff) |
powerpc/powernv: Add OPAL call to resync timebase on wakeup
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>
-rw-r--r-- | arch/powerpc/include/asm/opal.h | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/exceptions-64s.S | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/idle_power7.S | 27 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/opal-wrappers.S | 1 |
4 files changed, 31 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index 40157e2ca691..c71c72e47d47 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h | |||
@@ -154,6 +154,7 @@ extern int opal_enter_rtas(struct rtas_args *args, | |||
154 | #define OPAL_FLASH_VALIDATE 76 | 154 | #define OPAL_FLASH_VALIDATE 76 |
155 | #define OPAL_FLASH_MANAGE 77 | 155 | #define OPAL_FLASH_MANAGE 77 |
156 | #define OPAL_FLASH_UPDATE 78 | 156 | #define OPAL_FLASH_UPDATE 78 |
157 | #define OPAL_RESYNC_TIMEBASE 79 | ||
157 | #define OPAL_GET_MSG 85 | 158 | #define OPAL_GET_MSG 85 |
158 | #define OPAL_CHECK_ASYNC_COMPLETION 86 | 159 | #define OPAL_CHECK_ASYNC_COMPLETION 86 |
159 | #define OPAL_SYNC_HOST_REBOOT 87 | 160 | #define OPAL_SYNC_HOST_REBOOT 87 |
@@ -865,6 +866,7 @@ extern void opal_flash_init(void); | |||
865 | extern int opal_machine_check(struct pt_regs *regs); | 866 | extern int opal_machine_check(struct pt_regs *regs); |
866 | 867 | ||
867 | extern void opal_shutdown(void); | 868 | extern void opal_shutdown(void); |
869 | extern int opal_resync_timebase(void); | ||
868 | 870 | ||
869 | extern void opal_lpc_init(void); | 871 | extern void opal_lpc_init(void); |
870 | 872 | ||
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index b01a9cb441e4..9533d7a9223c 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S | |||
@@ -145,7 +145,7 @@ BEGIN_FTR_SECTION | |||
145 | 145 | ||
146 | /* Fast Sleep wakeup on PowerNV */ | 146 | /* Fast Sleep wakeup on PowerNV */ |
147 | 8: GET_PACA(r13) | 147 | 8: GET_PACA(r13) |
148 | b .power7_wakeup_loss | 148 | b .power7_wakeup_tb_loss |
149 | 149 | ||
150 | 9: | 150 | 9: |
151 | END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206) | 151 | END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206) |
diff --git a/arch/powerpc/kernel/idle_power7.S b/arch/powerpc/kernel/idle_power7.S index 14f78bec62c4..c3ab86975614 100644 --- a/arch/powerpc/kernel/idle_power7.S +++ b/arch/powerpc/kernel/idle_power7.S | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <asm/ppc-opcode.h> | 17 | #include <asm/ppc-opcode.h> |
18 | #include <asm/hw_irq.h> | 18 | #include <asm/hw_irq.h> |
19 | #include <asm/kvm_book3s_asm.h> | 19 | #include <asm/kvm_book3s_asm.h> |
20 | #include <asm/opal.h> | ||
20 | 21 | ||
21 | #undef DEBUG | 22 | #undef DEBUG |
22 | 23 | ||
@@ -125,6 +126,32 @@ _GLOBAL(power7_sleep) | |||
125 | b power7_powersave_common | 126 | b power7_powersave_common |
126 | /* No return */ | 127 | /* No return */ |
127 | 128 | ||
129 | _GLOBAL(power7_wakeup_tb_loss) | ||
130 | ld r2,PACATOC(r13); | ||
131 | ld r1,PACAR1(r13) | ||
132 | |||
133 | /* Time base re-sync */ | ||
134 | li r0,OPAL_RESYNC_TIMEBASE | ||
135 | LOAD_REG_ADDR(r11,opal); | ||
136 | ld r12,8(r11); | ||
137 | ld r2,0(r11); | ||
138 | mtctr r12 | ||
139 | bctrl | ||
140 | |||
141 | /* TODO: Check r3 for failure */ | ||
142 | |||
143 | REST_NVGPRS(r1) | ||
144 | REST_GPR(2, r1) | ||
145 | ld r3,_CCR(r1) | ||
146 | ld r4,_MSR(r1) | ||
147 | ld r5,_NIP(r1) | ||
148 | addi r1,r1,INT_FRAME_SIZE | ||
149 | mtcr r3 | ||
150 | mfspr r3,SPRN_SRR1 /* Return SRR1 */ | ||
151 | mtspr SPRN_SRR1,r4 | ||
152 | mtspr SPRN_SRR0,r5 | ||
153 | rfid | ||
154 | |||
128 | _GLOBAL(power7_wakeup_loss) | 155 | _GLOBAL(power7_wakeup_loss) |
129 | ld r1,PACAR1(r13) | 156 | ld r1,PACAR1(r13) |
130 | REST_NVGPRS(r1) | 157 | REST_NVGPRS(r1) |
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S index 3e8829c40fbb..aab54b60334f 100644 --- a/arch/powerpc/platforms/powernv/opal-wrappers.S +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S | |||
@@ -126,6 +126,7 @@ OPAL_CALL(opal_return_cpu, OPAL_RETURN_CPU); | |||
126 | OPAL_CALL(opal_validate_flash, OPAL_FLASH_VALIDATE); | 126 | OPAL_CALL(opal_validate_flash, OPAL_FLASH_VALIDATE); |
127 | OPAL_CALL(opal_manage_flash, OPAL_FLASH_MANAGE); | 127 | OPAL_CALL(opal_manage_flash, OPAL_FLASH_MANAGE); |
128 | OPAL_CALL(opal_update_flash, OPAL_FLASH_UPDATE); | 128 | OPAL_CALL(opal_update_flash, OPAL_FLASH_UPDATE); |
129 | OPAL_CALL(opal_resync_timebase, OPAL_RESYNC_TIMEBASE); | ||
129 | OPAL_CALL(opal_get_msg, OPAL_GET_MSG); | 130 | OPAL_CALL(opal_get_msg, OPAL_GET_MSG); |
130 | OPAL_CALL(opal_check_completion, OPAL_CHECK_ASYNC_COMPLETION); | 131 | OPAL_CALL(opal_check_completion, OPAL_CHECK_ASYNC_COMPLETION); |
131 | OPAL_CALL(opal_sync_host_reboot, OPAL_SYNC_HOST_REBOOT); | 132 | OPAL_CALL(opal_sync_host_reboot, OPAL_SYNC_HOST_REBOOT); |