]> git.hungrycats.org Git - linux/commitdiff
ARM: 8452/3: PJ4: make coprocessor access sequences buildable in Thumb2 mode
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 22 Dec 2015 07:24:59 +0000 (08:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 May 2017 07:19:09 +0000 (09:19 +0200)
commit 5008efc83bf85b647aa1cbc44718b1675bbb7444 upstream.

The PJ4 inline asm sequence to write to cp15 cannot be built in Thumb-2
mode, due to the way it performs arithmetic on the program counter, so it
is built in ARM mode instead. However, building C files in ARM mode under
CONFIG_THUMB2_KERNEL is problematic, since the instrumentation performed
by subsystems like ftrace does not expect having to deal with interworking
branches.

Since the sequence in question is simply a poor man's ISB instruction,
let's use a straight 'isb' instead when building in Thumb2 mode. Thumb2
implies V7, so 'isb' should always be supported in that case.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/kernel/Makefile
arch/arm/kernel/pj4-cp0.c

index 2ecc7d15bc09b7663428a7090d8f8723952b3837..03120e656aea79382f91c8210a2ac06d0a97e342 100644 (file)
@@ -84,7 +84,6 @@ obj-$(CONFIG_CPU_PJ4B)                += pj4-cp0.o
 obj-$(CONFIG_IWMMXT)           += iwmmxt.o
 obj-$(CONFIG_PERF_EVENTS)      += perf_regs.o
 obj-$(CONFIG_HW_PERF_EVENTS)   += perf_event.o perf_event_cpu.o
-CFLAGS_pj4-cp0.o               := -marm
 AFLAGS_iwmmxt.o                        := -Wa,-mcpu=iwmmxt
 obj-$(CONFIG_ARM_CPU_TOPOLOGY)  += topology.o
 
index 8153e36b24917e96c8fa69d18bd78e8b0c130c1a..7c9248b74d3f41548e5ce41d614dc8850d08aa94 100644 (file)
@@ -66,9 +66,13 @@ static void __init pj4_cp_access_write(u32 value)
 
        __asm__ __volatile__ (
                "mcr    p15, 0, %1, c1, c0, 2\n\t"
+#ifdef CONFIG_THUMB2_KERNEL
+               "isb\n\t"
+#else
                "mrc    p15, 0, %0, c1, c0, 2\n\t"
                "mov    %0, %0\n\t"
                "sub    pc, pc, #4\n\t"
+#endif
                : "=r" (temp) : "r" (value));
 }