All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 1/2] powerpc/kexec: Reset secondary cpu endianess before kexec
@ 2015-07-08  4:37 Samuel Mendoza-Jonas
  2015-07-08  4:37 ` [PATCH V2 2/2] powerpc/kexec: Reset HILE before kexec_sequence Samuel Mendoza-Jonas
  2015-07-08 22:02 ` [PATCH V2 1/2] powerpc/kexec: Reset secondary cpu endianess before kexec Scott Wood
  0 siblings, 2 replies; 8+ messages in thread
From: Samuel Mendoza-Jonas @ 2015-07-08  4:37 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Samuel Mendoza-Jonas

If the target kernel does not inlcude the FIXUP_ENDIAN check, coming
from a different-endian kernel will cause the target kernel to panic.
All ppc64 kernels can handle starting in big-endian mode, so return to
big-endian before branching into the target kernel.

This mainly affects pseries as secondaries on powernv are returned to
OPAL.

Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
---
v2: Add an #ifdef for subarch-specific code
    Neaten the endian check (and extra call to mfmsr!) by modifying the msr and
    branching to the target kernel in the same call to rfid.
 arch/powerpc/kernel/misc_64.S | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 4e314b9..89f0600 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -475,9 +475,18 @@ _GLOBAL(kexec_wait)
 #ifdef CONFIG_KEXEC		/* use no memory without kexec */
 	lwz	r4,0(r5)
 	cmpwi	0,r4,0
-	bnea	0x60
+	beq	99b
+#ifdef CONFIG_PPC_BOOK3S_64
+	li	r10,0x60
+	mfmsr	r11
+	clrrdi	r11,r11,1	/* Clear MSR_LE */
+	mtsrr0	r10
+	mtsrr1	r11
+	rfid
+#else
+	b	0x60
+#endif
 #endif
-	b	99b
 
 /* this can be in text because we won't change it until we are
  * running in real anyways
-- 
2.4.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-07-09  7:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-08  4:37 [PATCH V2 1/2] powerpc/kexec: Reset secondary cpu endianess before kexec Samuel Mendoza-Jonas
2015-07-08  4:37 ` [PATCH V2 2/2] powerpc/kexec: Reset HILE before kexec_sequence Samuel Mendoza-Jonas
2015-07-08  5:37   ` Michael Ellerman
2015-07-08  6:51     ` Stewart Smith
2015-07-09  1:03       ` Samuel Mendoza-Jonas
2015-07-09  1:40       ` Michael Ellerman
2015-07-09  7:26         ` Stewart Smith
2015-07-08 22:02 ` [PATCH V2 1/2] powerpc/kexec: Reset secondary cpu endianess before kexec Scott Wood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.