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

ARM: set BE8 if LE in head code

If we are booting in LE and compiled for BE8, then add code to
set the state to bE8. Since the instruction stream is always LE,
we do not need to do anything special to the instruction.

Also ensure that the secondary processors are started in the same mode.

Note, we do add about 20 bytes to the kernel image, but it seems easier
to do this than adding another configuration to change.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Ben Dooks 97bcb0fe 2f9bf9be

+6
+1
arch/arm/boot/compressed/head.S
··· 135 135 .word _edata @ zImage end address 136 136 THUMB( .thumb ) 137 137 1: 138 + ARM_BE8( setend be ) @ go BE8 if compiled for BE8 138 139 mrs r9, cpsr 139 140 #ifdef CONFIG_ARM_VIRT_EXT 140 141 bl __hyp_stub_install @ get into SVC mode, reversibly
+4
arch/arm/kernel/head.S
··· 77 77 78 78 __HEAD 79 79 ENTRY(stext) 80 + ARM_BE8(setend be ) @ ensure we are in BE8 mode 80 81 81 82 THUMB( adr r9, BSYM(1f) ) @ Kernel is always entered in ARM. 82 83 THUMB( bx r9 ) @ If this is a Thumb-2 kernel, ··· 353 352 * the processor type - there is no need to check the machine type 354 353 * as it has already been validated by the primary processor. 355 354 */ 355 + 356 + ARM_BE8(setend be) @ ensure we are in BE8 mode 357 + 356 358 #ifdef CONFIG_ARM_VIRT_EXT 357 359 bl __hyp_stub_install_secondary 358 360 #endif
+1
arch/arm/kernel/sleep.S
··· 130 130 .data 131 131 .align 132 132 ENTRY(cpu_resume) 133 + ARM_BE8(setend be) @ ensure we are in BE mode 133 134 mov r1, #0 134 135 ALT_SMP(mrc p15, 0, r0, c0, c0, 5) 135 136 ALT_UP_B(1f)