Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc: add Book E support to 64-bit hibernation

Update the 64-bit hibernation code to support Book E CPUs.
Some registers and instructions are not defined for Book3e
(SDR reg, tlbia instruction).

SDR: Storage Description Register. Book3S and Book3E have different
address translation mode, we do not need HTABORG & HTABSIZE to
translate virtual address to real address.

More registers are saved in BookE-64bit.(TCR, SPRG1)

Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>

authored by

Wang Dongsheng and committed by
Scott Wood
5a31057f 75898156

+43 -2
+43 -2
arch/powerpc/kernel/swsusp_asm64.S
··· 46 46 #define SL_r29 0xe8 47 47 #define SL_r30 0xf0 48 48 #define SL_r31 0xf8 49 - #define SL_SIZE SL_r31+8 49 + #define SL_SPRG1 0x100 50 + #define SL_TCR 0x108 51 + #define SL_SIZE SL_TCR+8 50 52 51 53 /* these macros rely on the save area being 52 54 * pointed to by r11 */ 55 + 56 + #define SAVE_SPR(register) \ 57 + mfspr r0, SPRN_##register ;\ 58 + std r0, SL_##register(r11) 59 + #define RESTORE_SPR(register) \ 60 + ld r0, SL_##register(r11) ;\ 61 + mtspr SPRN_##register, r0 53 62 #define SAVE_SPECIAL(special) \ 54 63 mf##special r0 ;\ 55 64 std r0, SL_##special(r11) ··· 112 103 SAVE_REGISTER(r30) 113 104 SAVE_REGISTER(r31) 114 105 SAVE_SPECIAL(MSR) 115 - SAVE_SPECIAL(SDR1) 116 106 SAVE_SPECIAL(XER) 107 + #ifdef CONFIG_PPC_BOOK3S_64 108 + SAVE_SPECIAL(SDR1) 109 + #else 110 + SAVE_SPR(TCR) 111 + 112 + /* Save SPRG1, SPRG1 be used save paca */ 113 + SAVE_SPR(SPRG1) 114 + #endif 117 115 118 116 /* we push the stack up 128 bytes but don't store the 119 117 * stack pointer on the stack like a real stackframe */ ··· 167 151 bne+ copyloop 168 152 nothing_to_copy: 169 153 154 + #ifdef CONFIG_PPC_BOOK3S_64 170 155 /* flush caches */ 171 156 lis r3, 0x10 172 157 mtctr r3 ··· 184 167 sync 185 168 186 169 tlbia 170 + #endif 187 171 188 172 ld r11,swsusp_save_area_ptr@toc(r2) 189 173 ··· 226 208 RESTORE_REGISTER(r29) 227 209 RESTORE_REGISTER(r30) 228 210 RESTORE_REGISTER(r31) 211 + 212 + #ifdef CONFIG_PPC_BOOK3S_64 229 213 /* can't use RESTORE_SPECIAL(MSR) */ 230 214 ld r0, SL_MSR(r11) 231 215 mtmsrd r0, 0 232 216 RESTORE_SPECIAL(SDR1) 217 + #else 218 + /* Restore SPRG1, be used to save paca */ 219 + ld r0, SL_SPRG1(r11) 220 + mtsprg 1, r0 221 + 222 + RESTORE_SPECIAL(MSR) 223 + 224 + /* Restore TCR and clear any pending bits in TSR. */ 225 + RESTORE_SPR(TCR) 226 + lis r0, (TSR_ENW | TSR_WIS | TSR_DIS | TSR_FIS)@h 227 + mtspr SPRN_TSR, r0 228 + 229 + /* Kick decrementer */ 230 + li r0, 1 231 + mtdec r0 232 + 233 + /* Invalidate all tlbs */ 234 + bl _tlbil_all 235 + #endif 233 236 RESTORE_SPECIAL(XER) 234 237 235 238 sync 236 239 237 240 addi r1,r1,-128 241 + #ifdef CONFIG_PPC_BOOK3S_64 238 242 bl slb_flush_and_rebolt 243 + #endif 239 244 bl do_after_copyback 240 245 addi r1,r1,128 241 246