From: Greg Kroah-Hartman Date: Wed, 28 Nov 2018 08:45:34 +0000 (+0100) Subject: 4.14-stable patches X-Git-Tag: v4.19.6~64 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a9ed6271cee2944ae6181cdea01b3f4fda887426;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: arm-8766-1-drop-no-thumb-interwork-in-eabi-mode.patch arm-8767-1-add-support-for-building-arm-kernel-with-clang.patch arm-trusted_foundations-do-not-use-naked-function.patch bus-arm-cci-remove-unnecessary-unreachable.patch efi-libstub-arm-support-building-with-clang.patch --- diff --git a/queue-4.14/arm-8766-1-drop-no-thumb-interwork-in-eabi-mode.patch b/queue-4.14/arm-8766-1-drop-no-thumb-interwork-in-eabi-mode.patch new file mode 100644 index 00000000000..48759a6fa93 --- /dev/null +++ b/queue-4.14/arm-8766-1-drop-no-thumb-interwork-in-eabi-mode.patch @@ -0,0 +1,35 @@ +From foo@baz Wed Nov 28 09:43:07 CET 2018 +From: Stefan Agner +Date: Tue, 8 May 2018 22:49:49 +0100 +Subject: ARM: 8766/1: drop no-thumb-interwork in EABI mode + +From: Stefan Agner + +(commit 22905a24306c8c312c2d66da9f90d09af0414f81 upstream) + +According to GCC documentation -m(no-)thumb-interwork is +meaningless in AAPCS configurations. Also clang does not +support the flag: + clang-5.0: error: unknown argument: '-mno-thumb-interwork' + +Just drop -mno-thumb-interwork in AEABI configuration. + +Signed-off-by: Stefan Agner +Signed-off-by: Russell King +Signed-off-by: Nick Desaulniers +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm/Makefile ++++ b/arch/arm/Makefile +@@ -106,7 +106,7 @@ tune-$(CONFIG_CPU_V6K) =$(call cc-optio + tune-y := $(tune-y) + + ifeq ($(CONFIG_AEABI),y) +-CFLAGS_ABI :=-mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp ++CFLAGS_ABI :=-mabi=aapcs-linux -mfpu=vfp + else + CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,) + endif diff --git a/queue-4.14/arm-8767-1-add-support-for-building-arm-kernel-with-clang.patch b/queue-4.14/arm-8767-1-add-support-for-building-arm-kernel-with-clang.patch new file mode 100644 index 00000000000..45f0b0df01d --- /dev/null +++ b/queue-4.14/arm-8767-1-add-support-for-building-arm-kernel-with-clang.patch @@ -0,0 +1,34 @@ +From foo@baz Wed Nov 28 09:43:07 CET 2018 +From: Stefan Agner +Date: Tue, 8 May 2018 22:50:38 +0100 +Subject: ARM: 8767/1: add support for building ARM kernel with clang + +From: Stefan Agner + +(commit c1c386681bd73c4fc28eb5cc91cf8b7be9b409ba upstream) + +Use cc-options call for compiler options which are not available +in clang. With this patch an ARMv7 multi platform kernel can be +successfully build using clang (tested with version 5.0.1). + +Based-on-patches-by: Behan Webster + +Signed-off-by: Stefan Agner +Signed-off-by: Russell King +Signed-off-by: Nick Desaulniers +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/boot/compressed/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm/boot/compressed/Makefile ++++ b/arch/arm/boot/compressed/Makefile +@@ -113,7 +113,7 @@ CFLAGS_fdt_ro.o := $(nossp_flags) + CFLAGS_fdt_rw.o := $(nossp_flags) + CFLAGS_fdt_wip.o := $(nossp_flags) + +-ccflags-y := -fpic -mno-single-pic-base -fno-builtin -I$(obj) ++ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin -I$(obj) + asflags-y := -DZIMAGE + + # Supply kernel BSS size to the decompressor via a linker symbol. diff --git a/queue-4.14/arm-trusted_foundations-do-not-use-naked-function.patch b/queue-4.14/arm-trusted_foundations-do-not-use-naked-function.patch new file mode 100644 index 00000000000..2e7ecd9c756 --- /dev/null +++ b/queue-4.14/arm-trusted_foundations-do-not-use-naked-function.patch @@ -0,0 +1,70 @@ +From foo@baz Wed Nov 28 09:43:07 CET 2018 +From: Stefan Agner +Date: Sun, 25 Mar 2018 20:09:56 +0200 +Subject: ARM: trusted_foundations: do not use naked function + +From: Stefan Agner + +(commit 4ea7bdc6b5b33427bbd3f41c333e21c1825462a3 upstream) + +As documented in GCC naked functions should only use basic ASM +syntax. The extended ASM or mixture of basic ASM and "C" code is +not guaranteed. Currently this works because it was hard coded +to follow and check GCC behavior for arguments and register +placement. + +Furthermore with clang using parameters in Extended asm in a +naked function is not supported: + arch/arm/firmware/trusted_foundations.c:47:10: error: parameter + references not allowed in naked functions + : "r" (type), "r" (arg1), "r" (arg2) + ^ + +Use a regular function to be more portable. This aligns also with +the other SMC call implementations e.g. in qcom_scm-32.c and +bcm_kona_smc.c. + +Cc: Dmitry Osipenko +Cc: Stephen Warren +Cc: Thierry Reding +Signed-off-by: Stefan Agner +Signed-off-by: Thierry Reding +Signed-off-by: Nick Desaulniers +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/firmware/trusted_foundations.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +--- a/arch/arm/firmware/trusted_foundations.c ++++ b/arch/arm/firmware/trusted_foundations.c +@@ -31,21 +31,25 @@ + + static unsigned long cpu_boot_addr; + +-static void __naked tf_generic_smc(u32 type, u32 arg1, u32 arg2) ++static void tf_generic_smc(u32 type, u32 arg1, u32 arg2) + { ++ register u32 r0 asm("r0") = type; ++ register u32 r1 asm("r1") = arg1; ++ register u32 r2 asm("r2") = arg2; ++ + asm volatile( + ".arch_extension sec\n\t" +- "stmfd sp!, {r4 - r11, lr}\n\t" ++ "stmfd sp!, {r4 - r11}\n\t" + __asmeq("%0", "r0") + __asmeq("%1", "r1") + __asmeq("%2", "r2") + "mov r3, #0\n\t" + "mov r4, #0\n\t" + "smc #0\n\t" +- "ldmfd sp!, {r4 - r11, pc}" ++ "ldmfd sp!, {r4 - r11}\n\t" + : +- : "r" (type), "r" (arg1), "r" (arg2) +- : "memory"); ++ : "r" (r0), "r" (r1), "r" (r2) ++ : "memory", "r3", "r12", "lr"); + } + + static int tf_set_cpu_boot_addr(int cpu, unsigned long boot_addr) diff --git a/queue-4.14/bus-arm-cci-remove-unnecessary-unreachable.patch b/queue-4.14/bus-arm-cci-remove-unnecessary-unreachable.patch new file mode 100644 index 00000000000..fbc3d51129f --- /dev/null +++ b/queue-4.14/bus-arm-cci-remove-unnecessary-unreachable.patch @@ -0,0 +1,46 @@ +From foo@baz Wed Nov 28 09:43:07 CET 2018 +From: Stefan Agner +Date: Tue, 8 May 2018 16:27:26 +0200 +Subject: bus: arm-cci: remove unnecessary unreachable() + +From: Stefan Agner + +(commit 10d8713429d345867fc8998d6193b233c0cab28c upstream) + +Mixing asm and C code is not recommended in a naked function by +gcc and leads to an error when using clang: + drivers/bus/arm-cci.c:2107:2: error: non-ASM statement in naked + function is not supported + unreachable(); + ^ + +While the function is marked __naked it actually properly return +in asm. There is no need for the unreachable() call. + +GCC 7.2 generates identical object files before and after, other +than (for obvious reasons) the line numbers generated by +WANT_WARN_ON_SLOWPATH for all the WARN()s appearing later in the +file. + +Suggested-by: Russell King +Signed-off-by: Stefan Agner +Acked-by: Nicolas Pitre +Reviewed-by: Robin Murphy +Signed-off-by: Olof Johansson +Signed-off-by: Nick Desaulniers +Signed-off-by: Greg Kroah-Hartman +--- + drivers/bus/arm-cci.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/bus/arm-cci.c ++++ b/drivers/bus/arm-cci.c +@@ -2103,8 +2103,6 @@ asmlinkage void __naked cci_enable_port_ + [sizeof_struct_cpu_port] "i" (sizeof(struct cpu_port)), + [sizeof_struct_ace_port] "i" (sizeof(struct cci_ace_port)), + [offsetof_port_phys] "i" (offsetof(struct cci_ace_port, phys)) ); +- +- unreachable(); + } + + /** diff --git a/queue-4.14/efi-libstub-arm-support-building-with-clang.patch b/queue-4.14/efi-libstub-arm-support-building-with-clang.patch new file mode 100644 index 00000000000..6f368c33b43 --- /dev/null +++ b/queue-4.14/efi-libstub-arm-support-building-with-clang.patch @@ -0,0 +1,41 @@ +From foo@baz Wed Nov 28 09:43:07 CET 2018 +From: Alistair Strachan +Date: Tue, 27 Nov 2018 15:33:17 -0800 +Subject: efi/libstub: arm: support building with clang + +From: Alistair Strachan + +(commit 41f1c48420709470c51ee0e54b6fb28b956bb4e0 upstream) + +When building with CONFIG_EFI and CONFIG_EFI_STUB on ARM, the libstub +Makefile would use -mno-single-pic-base without checking it was +supported by the compiler. As the ARM (32-bit) clang backend does not +support this flag, the build would fail. + +This changes the Makefile to check the compiler's support for +-mno-single-pic-base before using it, similar to c1c386681bd7 ("ARM: +8767/1: add support for building ARM kernel with clang"). + +Signed-off-by: Alistair Strachan +Reviewed-by: Stefan Agner +Signed-off-by: Ard Biesheuvel +[ND: adjusted due to missing commit ce279d374ff3 ("efi/libstub: + Only disable stackleak plugin for arm64")] +Signed-off-by: Nick Desaulniers +Signed-off-by: Greg Kroah-Hartman +--- + drivers/firmware/efi/libstub/Makefile | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/firmware/efi/libstub/Makefile ++++ b/drivers/firmware/efi/libstub/Makefile +@@ -13,7 +13,8 @@ cflags-$(CONFIG_X86) += -m$(BITS) -D__K + + cflags-$(CONFIG_ARM64) := $(subst -pg,,$(KBUILD_CFLAGS)) -fpie + cflags-$(CONFIG_ARM) := $(subst -pg,,$(KBUILD_CFLAGS)) \ +- -fno-builtin -fpic -mno-single-pic-base ++ -fno-builtin -fpic \ ++ $(call cc-option,-mno-single-pic-base) + + cflags-$(CONFIG_EFI_ARMSTUB) += -I$(srctree)/scripts/dtc/libfdt + diff --git a/queue-4.14/series b/queue-4.14/series index e69de29bb2d..5622298f401 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -0,0 +1,5 @@ +efi-libstub-arm-support-building-with-clang.patch +arm-8766-1-drop-no-thumb-interwork-in-eabi-mode.patch +arm-8767-1-add-support-for-building-arm-kernel-with-clang.patch +bus-arm-cci-remove-unnecessary-unreachable.patch +arm-trusted_foundations-do-not-use-naked-function.patch