]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.9/arm-8680-1-boot-compressed-fix-inappropriate-thumb2-.patch
c9891da0d382db5d360eeed4b6a3728056bb5cdd
[thirdparty/kernel/stable-queue.git] / queue-4.9 / arm-8680-1-boot-compressed-fix-inappropriate-thumb2-.patch
1 From 34aa363dca56091295bff10bfa7b96b6a869c3b5 Mon Sep 17 00:00:00 2001
2 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3 Date: Fri, 9 Jun 2017 10:14:53 +0100
4 Subject: ARM: 8680/1: boot/compressed: fix inappropriate Thumb2 mnemonic for
5 __nop
6
7 [ Upstream commit 60ce2858514ed9ccaf00dc7e9f4dc219537e9855 ]
8
9 Commit 06a4b6d009a1 ("ARM: 8677/1: boot/compressed: fix decompressor
10 header layout for v7-M") fixed an issue in the layout of the header
11 of the compressed kernel image that was caused by the assembler
12 emitting narrow opcodes for 'mov r0, r0', and for this reason, the
13 mnemonic was updated to use the W() macro, which will append the .w
14 suffix (which forces a wide encoding) if required, i.e., when building
15 the kernel in Thumb2 mode.
16
17 However, this failed to take into account that on Thumb2 kernels built
18 for CPUs that are also ARM capable, the entry point is entered in ARM
19 mode, and so the instructions emitted here will be ARM instructions
20 that only exist in a wide encoding to begin with, which is why the
21 assembler rejects the .w suffix here and aborts the build with the
22 following message:
23
24 head.S: Assembler messages:
25 head.S:132: Error: width suffixes are invalid in ARM mode -- `mov.w r0,r0'
26
27 So replace the W(mov) with separate ARM and Thumb2 instructions, where
28 the latter will only be used for THUMB2_ONLY builds.
29
30 Fixes: 06a4b6d009a1 ("ARM: 8677/1: boot/compressed: fix decompressor ...")
31 Reported-by: Arnd Bergmann <arnd@arndb.de>
32 Acked-by: Arnd Bergmann <arnd@arndb.de>
33 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
34 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
35 Signed-off-by: Sasha Levin <sashal@kernel.org>
36 ---
37 arch/arm/boot/compressed/efi-header.S | 3 ++-
38 1 file changed, 2 insertions(+), 1 deletion(-)
39
40 diff --git a/arch/arm/boot/compressed/efi-header.S b/arch/arm/boot/compressed/efi-header.S
41 index 3f7d1b74c5e02..a17ca8d78656d 100644
42 --- a/arch/arm/boot/compressed/efi-header.S
43 +++ b/arch/arm/boot/compressed/efi-header.S
44 @@ -17,7 +17,8 @@
45 @ there.
46 .inst 'M' | ('Z' << 8) | (0x1310 << 16) @ tstne r0, #0x4d000
47 #else
48 - W(mov) r0, r0
49 + AR_CLASS( mov r0, r0 )
50 + M_CLASS( nop.w )
51 #endif
52 .endm
53
54 --
55 2.20.1
56