From 36d5a8fd23e3bf96a745f3e7ff7f1a71771d458c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 20 Mar 2023 13:04:27 +0100 Subject: [PATCH] 6.1-stable patches added patches: powerpc-pass-correct-cpu-reference-to-assembler.patch --- ...s-correct-cpu-reference-to-assembler.patch | 77 +++++++++++++++++++ queue-6.1/series | 1 + 2 files changed, 78 insertions(+) create mode 100644 queue-6.1/powerpc-pass-correct-cpu-reference-to-assembler.patch diff --git a/queue-6.1/powerpc-pass-correct-cpu-reference-to-assembler.patch b/queue-6.1/powerpc-pass-correct-cpu-reference-to-assembler.patch new file mode 100644 index 00000000000..ef22fba4e3f --- /dev/null +++ b/queue-6.1/powerpc-pass-correct-cpu-reference-to-assembler.patch @@ -0,0 +1,77 @@ +From bfb03af71a3798b5a88a945a9c19ad67e1c4986d Mon Sep 17 00:00:00 2001 +From: Christophe Leroy +Date: Mon, 19 Dec 2022 19:45:57 +0100 +Subject: powerpc: Pass correct CPU reference to assembler +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Christophe Leroy + +commit bfb03af71a3798b5a88a945a9c19ad67e1c4986d upstream. + +Jan-Benedict reported issue with building ppc64e_defconfig +with mainline GCC work: + + powerpc64-linux-gcc -Wp,-MMD,arch/powerpc/kernel/vdso/.gettimeofday-64.o.d -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated -I./include -I./arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -D__KERNEL__ -I ./arch/powerpc -DHAVE_AS_ATHIGH=1 -fmacro-prefix-map=./= -D__ASSEMBLY__ -fno-PIE -m64 -Wl,-a64 -mabi=elfv1 -Wa,-me500 -Wa,-me500mc -mabi=elfv1 -mbig-endian -Wl,-soname=linux-vdso64.so.1 -D__VDSO64__ -s -c -o arch/powerpc/kernel/vdso/gettimeofday-64.o arch/powerpc/kernel/vdso/gettimeofday.S + arch/powerpc/kernel/vdso/gettimeofday.S: Assembler messages: + arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `stdu' + arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `stdu' + arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `std' + arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `std' + arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `ld' + arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `ld' + ... + make[1]: *** [arch/powerpc/kernel/vdso/Makefile:76: arch/powerpc/kernel/vdso/gettimeofday-64.o] Error 1 + make: *** [arch/powerpc/Makefile:387: vdso_prepare] Error 2 + +This is due to assembler being called with -me500mc which is +a 32 bits target. + +The problem comes from the fact that CONFIG_PPC_E500MC is selected for +both the e500mc (32 bits) and the e5500 (64 bits), and therefore the +following makefile rule is wrong: + + cpu-as-$(CONFIG_PPC_E500MC) += $(call as-option,-Wa$(comma)-me500mc) + +Today we have CONFIG_TARGET_CPU which provides the identification of the +expected CPU, it is used for GCC. Once GCC knows the target CPU, it adds +the correct CPU option to assembler, no need to add it explicitly. + +With that change (And also commit 45f7091aac35 ("powerpc/64: Set default +CPU in Kconfig")), it now is: + + powerpc64-linux-gcc -Wp,-MMD,arch/powerpc/kernel/vdso/.gettimeofday-64.o.d -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated -I./include -I./arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -D__KERNEL__ -I ./arch/powerpc -DHAVE_AS_ATHIGH=1 -fmacro-prefix-map=./= -D__ASSEMBLY__ -fno-PIE -m64 -Wl,-a64 -mabi=elfv1 -mcpu=e500mc64 -mabi=elfv1 -mbig-endian -Wl,-soname=linux-vdso64.so.1 -D__VDSO64__ -s -c -o arch/powerpc/kernel/vdso/gettimeofday-64.o arch/powerpc/kernel/vdso/gettimeofday.S + +Reported-by: Jan-Benedict Glaw +Signed-off-by: Christophe Leroy +Acked-by: Pali Rohár +[mpe: Retain -Wa,-mpower4 -Wa,-many for Book3S 64 builds for now] +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/758ad54128fa9dd2fdedc4c511592111cbded900.1671475543.git.christophe.leroy@csgroup.eu +Signed-off-by: Greg Kroah-Hartman +--- + arch/powerpc/Makefile | 4 ---- + 1 file changed, 4 deletions(-) + +--- a/arch/powerpc/Makefile ++++ b/arch/powerpc/Makefile +@@ -201,10 +201,7 @@ KBUILD_CFLAGS += -fno-asynchronous-unwin + # often slow when they are implemented at all + KBUILD_CFLAGS += $(call cc-option,-mno-string) + +-cpu-as-$(CONFIG_40x) += -Wa,-m405 +-cpu-as-$(CONFIG_44x) += -Wa,-m440 + cpu-as-$(CONFIG_ALTIVEC) += $(call as-option,-Wa$(comma)-maltivec) +-cpu-as-$(CONFIG_PPC_E500) += -Wa,-me500 + + # When using '-many -mpower4' gas will first try and find a matching power4 + # mnemonic and failing that it will allow any valid mnemonic that GAS knows +@@ -212,7 +209,6 @@ cpu-as-$(CONFIG_PPC_E500) += -Wa,-me500 + # LLVM IAS doesn't understand either flag: https://github.com/ClangBuiltLinux/linux/issues/675 + # but LLVM IAS only supports ISA >= 2.06 for Book3S 64 anyway... + cpu-as-$(CONFIG_PPC_BOOK3S_64) += $(call as-option,-Wa$(comma)-mpower4) $(call as-option,-Wa$(comma)-many) +-cpu-as-$(CONFIG_PPC_E500MC) += $(call as-option,-Wa$(comma)-me500mc) + + KBUILD_AFLAGS += $(cpu-as-y) + KBUILD_CFLAGS += $(cpu-as-y) diff --git a/queue-6.1/series b/queue-6.1/series index 4a6d6d265bc..c8224780330 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -187,3 +187,4 @@ asoc-qcom-q6prm-fix-incorrect-clk_root-passed-to-adsp.patch x86-mce-make-sure-logged-mces-are-processed-after-sysfs-update.patch x86-mm-fix-use-of-uninitialized-buffer-in-sme_enable.patch x86-resctrl-clear-staged_config-before-and-after-it-is-used.patch +powerpc-pass-correct-cpu-reference-to-assembler.patch -- 2.47.3