[kexec-lite PATCH V2] trampoline: Reset primary cpu endian to big-endian

Samuel Mendoza-Jonas sam.mj at au1.ibm.com
Wed Jul 8 13:29:38 AEST 2015

Older big-endian ppc64 kernels don't include the FIXUP_ENDIAN check,
meaning if we kexec from a little-endian kernel the target kernel will
fail to boot.
Returning to big-endian before we enter the target kernel ensures that
the target kernel can boot whether or not it includes FIXUP_ENDIAN.

Signed-off-by: Samuel Mendoza-Jonas <sam.mj at au1.ibm.com>
V2: As suggested by Anton take advantage of the rfid call and switch off
MSR_LE and branch to the target kernel in the same step.

 kexec_trampoline.S | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/kexec_trampoline.S b/kexec_trampoline.S
index a3eb314..3751112 100644
--- a/kexec_trampoline.S
+++ b/kexec_trampoline.S
@@ -88,8 +88,15 @@ start:
 	li	r5,0
-	mtctr	r4
-	bctr
+	mtsrr0	r4
+	mfmsr	r5
+	clrrdi	r5,r5,1 	/* Clear MSR_LE */
+	mtsrr1	r5
+	li	r5,0
+	rfid

More information about the Linuxppc-dev mailing list