Joel Stanley | 3e323ab | 2015-09-11 14:48:21 +1000 | [diff] [blame] | 1 | From 301de197bdeefada57511b991f67a584e3ab2c43 Mon Sep 17 00:00:00 2001 |
| 2 | From: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> |
| 3 | Date: Mon, 29 Jun 2015 13:43:51 +1000 |
| 4 | Subject: [PATCH 6/9] powerpc/kexec: Reset secondary cpu endianess before kexec |
| 5 | |
| 6 | If the target kernel does not inlcude the FIXUP_ENDIAN check, coming |
| 7 | from a different-endian kernel will cause the target kernel to panic. |
| 8 | All ppc64 kernels can handle starting in big-endian mode, so return to |
| 9 | big-endian before branching into the target kernel. |
| 10 | |
| 11 | This mainly affects pseries as secondaries on powernv are returned to |
| 12 | OPAL. |
| 13 | |
| 14 | Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> |
| 15 | Signed-off-by: Joel Stanley <joel@jms.id.au> |
| 16 | --- |
| 17 | arch/powerpc/kernel/misc_64.S | 13 +++++++++++-- |
| 18 | 1 file changed, 11 insertions(+), 2 deletions(-) |
| 19 | |
| 20 | diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S |
| 21 | index 4e314b9..6e4168c 100644 |
| 22 | --- a/arch/powerpc/kernel/misc_64.S |
| 23 | +++ b/arch/powerpc/kernel/misc_64.S |
| 24 | @@ -475,9 +475,18 @@ _GLOBAL(kexec_wait) |
| 25 | #ifdef CONFIG_KEXEC /* use no memory without kexec */ |
| 26 | lwz r4,0(r5) |
| 27 | cmpwi 0,r4,0 |
| 28 | - bnea 0x60 |
| 29 | + beq 99b |
| 30 | +#ifdef CONFIG_PPC_BOOK3S_64 |
| 31 | + li r10,0x60 |
| 32 | + mfmsr r11 |
| 33 | + clrrdi r11,r11,1 /* Clear MSR_LE */ |
| 34 | + mtsrr0 r10 |
| 35 | + mtsrr1 r11 |
| 36 | + rfid |
| 37 | +#else |
| 38 | + ba 0x60 |
| 39 | +#endif |
| 40 | #endif |
| 41 | - b 99b |
| 42 | |
| 43 | /* this can be in text because we won't change it until we are |
| 44 | * running in real anyways |
| 45 | -- |
| 46 | 2.5.0 |
| 47 | |