* [PATCH v1 1/5] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32
@ 2022-07-11 14:19 ` Christophe Leroy
0 siblings, 0 replies; 33+ messages in thread
From: Christophe Leroy @ 2022-07-11 14:19 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin
Cc: Christophe Leroy, linux-kernel, linuxppc-dev
Commit 0e00a8c9fd92 ("powerpc: Allow CPU selection also on PPC32")
enlarged the CPU selection logic to PPC32 by removing depend to
PPC64, and failed to restrict that depend to E5500_CPU and E6500_CPU.
Fortunately that got unnoticed because -mcpu=8540 will override the
-mcpu=e500mc64 or -mpcu=e6500 as they are ealier, but that's
fragile and may no be right in the future.
Add back the depend PPC64 on E5500_CPU and E6500_CPU.
Fixes: 0e00a8c9fd92 ("powerpc: Allow CPU selection also on PPC32")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/platforms/Kconfig.cputype | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 383ed4fe6013..9805a2c717b9 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -173,11 +173,11 @@ config POWER9_CPU
config E5500_CPU
bool "Freescale e5500"
- depends on E500
+ depends on PPC64 && E500
config E6500_CPU
bool "Freescale e6500"
- depends on E500
+ depends on PPC64 && E500
config 860_CPU
bool "8xx family"
--
2.36.1
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH v1 1/5] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32
@ 2022-07-11 14:19 ` Christophe Leroy
0 siblings, 0 replies; 33+ messages in thread
From: Christophe Leroy @ 2022-07-11 14:19 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin; +Cc: linuxppc-dev, linux-kernel
Commit 0e00a8c9fd92 ("powerpc: Allow CPU selection also on PPC32")
enlarged the CPU selection logic to PPC32 by removing depend to
PPC64, and failed to restrict that depend to E5500_CPU and E6500_CPU.
Fortunately that got unnoticed because -mcpu=8540 will override the
-mcpu=e500mc64 or -mpcu=e6500 as they are ealier, but that's
fragile and may no be right in the future.
Add back the depend PPC64 on E5500_CPU and E6500_CPU.
Fixes: 0e00a8c9fd92 ("powerpc: Allow CPU selection also on PPC32")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/platforms/Kconfig.cputype | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 383ed4fe6013..9805a2c717b9 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -173,11 +173,11 @@ config POWER9_CPU
config E5500_CPU
bool "Freescale e5500"
- depends on E500
+ depends on PPC64 && E500
config E6500_CPU
bool "Freescale e6500"
- depends on E500
+ depends on PPC64 && E500
config 860_CPU
bool "8xx family"
--
2.36.1
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH v1 2/5] powerpc/32: Don't always pass -mcpu=powerpc to the compiler
2022-07-11 14:19 ` Christophe Leroy
@ 2022-07-11 14:19 ` Christophe Leroy
-1 siblings, 0 replies; 33+ messages in thread
From: Christophe Leroy @ 2022-07-11 14:19 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin
Cc: Christophe Leroy, linux-kernel, linuxppc-dev, Pali Rohár,
Arnd Bergmann, Segher Boessenkool
Since commit 4bf4f42a2feb ("powerpc/kbuild: Set default generic
machine type for 32-bit compile"), when building a 32 bits kernel
with a bi-arch version of GCC, or when building a book3s/32 kernel,
the option -mcpu=powerpc is passed to GCC at all time, relying on it
being eventually overriden by a subsequent -mcpu=xxxx.
But when building the same kernel with a 32 bits only version of GCC,
that is not done, relying on gcc being built with the expected default
CPU.
This logic has two problems. First, it is a bit fragile to rely on
whether the GCC version is bi-arch or not, because today we can have
bi-arch versions of GCC configured with a 32 bits default. Second,
there are some versions of GCC which don't support -mcpu=powerpc,
for instance for e500 SPE-only versions.
So, stop relying on this approximative logic and allow the user to
decide whether he/she wants to use the toolchain's default CPU or if
he/she wants to set one, and allow only possible CPUs based on the
selected target.
Reported-by: Pali Rohár <pali@kernel.org>
Tested-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/Makefile | 26 +-------------------------
arch/powerpc/platforms/Kconfig.cputype | 21 ++++++++++++++++++---
2 files changed, 19 insertions(+), 28 deletions(-)
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index a0cd70712061..d54e1fe03551 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -15,23 +15,6 @@ HAS_BIARCH := $(call cc-option-yn, -m32)
# Set default 32 bits cross compilers for vdso and boot wrapper
CROSS32_COMPILE ?=
-ifeq ($(HAS_BIARCH),y)
-ifeq ($(CROSS32_COMPILE),)
-ifdef CONFIG_PPC32
-# These options will be overridden by any -mcpu option that the CPU
-# or platform code sets later on the command line, but they are needed
-# to set a sane 32-bit cpu target for the 64-bit cross compiler which
-# may default to the wrong ISA.
-KBUILD_CFLAGS += -mcpu=powerpc
-KBUILD_AFLAGS += -mcpu=powerpc
-endif
-endif
-endif
-
-ifdef CONFIG_PPC_BOOK3S_32
-KBUILD_CFLAGS += -mcpu=powerpc
-endif
-
# If we're on a ppc/ppc64/ppc64le machine use that defconfig, otherwise just use
# ppc64_defconfig because we have nothing better to go on.
uname := $(shell uname -m)
@@ -183,6 +166,7 @@ endif
endif
CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
+AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
# Altivec option not allowed with e500mc64 in GCC.
ifdef CONFIG_ALTIVEC
@@ -193,14 +177,6 @@ endif
CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
-ifdef CONFIG_PPC32
-ifdef CONFIG_PPC_E500MC
-CFLAGS-y += $(call cc-option,-mcpu=e500mc,-mcpu=powerpc)
-else
-CFLAGS-$(CONFIG_E500) += $(call cc-option,-mcpu=8540 -msoft-float,-mcpu=powerpc)
-endif
-endif
-
asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
KBUILD_CPPFLAGS += -I $(srctree)/arch/$(ARCH) $(asinstr)
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 9805a2c717b9..bfea5d8452f8 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -135,9 +135,9 @@ config GENERIC_CPU
select ARCH_HAS_FAST_MULTIPLIER
select PPC_64S_HASH_MMU
-config GENERIC_CPU
+config POWERPC_CPU
bool "Generic 32 bits powerpc"
- depends on PPC32 && !PPC_8xx
+ depends on PPC32 && !PPC_8xx && !PPC_85xx
config CELL_CPU
bool "Cell Broadband Engine"
@@ -196,11 +196,23 @@ config G4_CPU
depends on PPC_BOOK3S_32
select ALTIVEC
+config E500_CPU
+ bool "e500 (8540)"
+ depends on PPC_85xx && !PPC_E500MC
+
+config E500MC_CPU
+ bool "e500mc"
+ depends on PPC_85xx && PPC_E500MC
+
+config TOOLCHAIN_DEFAULT_CPU
+ bool "Rely on the toolchain's implicit default CPU"
+ depends on PPC32
+
endchoice
config TARGET_CPU_BOOL
bool
- default !GENERIC_CPU
+ default !GENERIC_CPU && !TOOLCHAIN_DEFAULT_CPU
config TARGET_CPU
string
@@ -215,6 +227,9 @@ config TARGET_CPU
default "e300c2" if E300C2_CPU
default "e300c3" if E300C3_CPU
default "G4" if G4_CPU
+ default "8540" if E500_CPU
+ default "e500mc" if E500MC_CPU
+ default "powerpc" if POWERPC_CPU
config PPC_BOOK3S
def_bool y
--
2.36.1
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH v1 2/5] powerpc/32: Don't always pass -mcpu=powerpc to the compiler
@ 2022-07-11 14:19 ` Christophe Leroy
0 siblings, 0 replies; 33+ messages in thread
From: Christophe Leroy @ 2022-07-11 14:19 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin
Cc: Arnd Bergmann, linuxppc-dev, linux-kernel, Pali Rohár
Since commit 4bf4f42a2feb ("powerpc/kbuild: Set default generic
machine type for 32-bit compile"), when building a 32 bits kernel
with a bi-arch version of GCC, or when building a book3s/32 kernel,
the option -mcpu=powerpc is passed to GCC at all time, relying on it
being eventually overriden by a subsequent -mcpu=xxxx.
But when building the same kernel with a 32 bits only version of GCC,
that is not done, relying on gcc being built with the expected default
CPU.
This logic has two problems. First, it is a bit fragile to rely on
whether the GCC version is bi-arch or not, because today we can have
bi-arch versions of GCC configured with a 32 bits default. Second,
there are some versions of GCC which don't support -mcpu=powerpc,
for instance for e500 SPE-only versions.
So, stop relying on this approximative logic and allow the user to
decide whether he/she wants to use the toolchain's default CPU or if
he/she wants to set one, and allow only possible CPUs based on the
selected target.
Reported-by: Pali Rohár <pali@kernel.org>
Tested-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/Makefile | 26 +-------------------------
arch/powerpc/platforms/Kconfig.cputype | 21 ++++++++++++++++++---
2 files changed, 19 insertions(+), 28 deletions(-)
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index a0cd70712061..d54e1fe03551 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -15,23 +15,6 @@ HAS_BIARCH := $(call cc-option-yn, -m32)
# Set default 32 bits cross compilers for vdso and boot wrapper
CROSS32_COMPILE ?=
-ifeq ($(HAS_BIARCH),y)
-ifeq ($(CROSS32_COMPILE),)
-ifdef CONFIG_PPC32
-# These options will be overridden by any -mcpu option that the CPU
-# or platform code sets later on the command line, but they are needed
-# to set a sane 32-bit cpu target for the 64-bit cross compiler which
-# may default to the wrong ISA.
-KBUILD_CFLAGS += -mcpu=powerpc
-KBUILD_AFLAGS += -mcpu=powerpc
-endif
-endif
-endif
-
-ifdef CONFIG_PPC_BOOK3S_32
-KBUILD_CFLAGS += -mcpu=powerpc
-endif
-
# If we're on a ppc/ppc64/ppc64le machine use that defconfig, otherwise just use
# ppc64_defconfig because we have nothing better to go on.
uname := $(shell uname -m)
@@ -183,6 +166,7 @@ endif
endif
CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
+AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
# Altivec option not allowed with e500mc64 in GCC.
ifdef CONFIG_ALTIVEC
@@ -193,14 +177,6 @@ endif
CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
-ifdef CONFIG_PPC32
-ifdef CONFIG_PPC_E500MC
-CFLAGS-y += $(call cc-option,-mcpu=e500mc,-mcpu=powerpc)
-else
-CFLAGS-$(CONFIG_E500) += $(call cc-option,-mcpu=8540 -msoft-float,-mcpu=powerpc)
-endif
-endif
-
asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
KBUILD_CPPFLAGS += -I $(srctree)/arch/$(ARCH) $(asinstr)
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 9805a2c717b9..bfea5d8452f8 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -135,9 +135,9 @@ config GENERIC_CPU
select ARCH_HAS_FAST_MULTIPLIER
select PPC_64S_HASH_MMU
-config GENERIC_CPU
+config POWERPC_CPU
bool "Generic 32 bits powerpc"
- depends on PPC32 && !PPC_8xx
+ depends on PPC32 && !PPC_8xx && !PPC_85xx
config CELL_CPU
bool "Cell Broadband Engine"
@@ -196,11 +196,23 @@ config G4_CPU
depends on PPC_BOOK3S_32
select ALTIVEC
+config E500_CPU
+ bool "e500 (8540)"
+ depends on PPC_85xx && !PPC_E500MC
+
+config E500MC_CPU
+ bool "e500mc"
+ depends on PPC_85xx && PPC_E500MC
+
+config TOOLCHAIN_DEFAULT_CPU
+ bool "Rely on the toolchain's implicit default CPU"
+ depends on PPC32
+
endchoice
config TARGET_CPU_BOOL
bool
- default !GENERIC_CPU
+ default !GENERIC_CPU && !TOOLCHAIN_DEFAULT_CPU
config TARGET_CPU
string
@@ -215,6 +227,9 @@ config TARGET_CPU
default "e300c2" if E300C2_CPU
default "e300c3" if E300C3_CPU
default "G4" if G4_CPU
+ default "8540" if E500_CPU
+ default "e500mc" if E500MC_CPU
+ default "powerpc" if POWERPC_CPU
config PPC_BOOK3S
def_bool y
--
2.36.1
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH v1 3/5] powerpc/405: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
2022-07-11 14:19 ` Christophe Leroy
@ 2022-07-11 14:19 ` Christophe Leroy
-1 siblings, 0 replies; 33+ messages in thread
From: Christophe Leroy @ 2022-07-11 14:19 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin
Cc: Christophe Leroy, linux-kernel, linuxppc-dev
Building ppc40x_defconfig leads to following error
CC arch/powerpc/kernel/process.o
{standard input}: Assembler messages:
{standard input}:626: Error: unrecognized opcode: `wrteei'
Add -mcpu=405 by default.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/platforms/Kconfig.cputype | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index bfea5d8452f8..e14000557ebd 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -137,7 +137,7 @@ config GENERIC_CPU
config POWERPC_CPU
bool "Generic 32 bits powerpc"
- depends on PPC32 && !PPC_8xx && !PPC_85xx
+ depends on PPC32 && !PPC_8xx && !PPC_85xx && !40x
config CELL_CPU
bool "Cell Broadband Engine"
@@ -179,6 +179,10 @@ config E6500_CPU
bool "Freescale e6500"
depends on PPC64 && E500
+config 405_CPU
+ bool "40x family"
+ depends on 40x
+
config 860_CPU
bool "8xx family"
depends on PPC_8xx
@@ -223,6 +227,7 @@ config TARGET_CPU
default "power7" if POWER7_CPU
default "power8" if POWER8_CPU
default "power9" if POWER9_CPU
+ default "405" if 405_CPU
default "860" if 860_CPU
default "e300c2" if E300C2_CPU
default "e300c3" if E300C3_CPU
--
2.36.1
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH v1 3/5] powerpc/405: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
@ 2022-07-11 14:19 ` Christophe Leroy
0 siblings, 0 replies; 33+ messages in thread
From: Christophe Leroy @ 2022-07-11 14:19 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin; +Cc: linuxppc-dev, linux-kernel
Building ppc40x_defconfig leads to following error
CC arch/powerpc/kernel/process.o
{standard input}: Assembler messages:
{standard input}:626: Error: unrecognized opcode: `wrteei'
Add -mcpu=405 by default.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/platforms/Kconfig.cputype | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index bfea5d8452f8..e14000557ebd 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -137,7 +137,7 @@ config GENERIC_CPU
config POWERPC_CPU
bool "Generic 32 bits powerpc"
- depends on PPC32 && !PPC_8xx && !PPC_85xx
+ depends on PPC32 && !PPC_8xx && !PPC_85xx && !40x
config CELL_CPU
bool "Cell Broadband Engine"
@@ -179,6 +179,10 @@ config E6500_CPU
bool "Freescale e6500"
depends on PPC64 && E500
+config 405_CPU
+ bool "40x family"
+ depends on 40x
+
config 860_CPU
bool "8xx family"
depends on PPC_8xx
@@ -223,6 +227,7 @@ config TARGET_CPU
default "power7" if POWER7_CPU
default "power8" if POWER8_CPU
default "power9" if POWER9_CPU
+ default "405" if 405_CPU
default "860" if 860_CPU
default "e300c2" if E300C2_CPU
default "e300c3" if E300C3_CPU
--
2.36.1
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH v1 4/5] powerpc/44x: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
2022-07-11 14:19 ` Christophe Leroy
@ 2022-07-11 14:19 ` Christophe Leroy
-1 siblings, 0 replies; 33+ messages in thread
From: Christophe Leroy @ 2022-07-11 14:19 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin
Cc: Christophe Leroy, linux-kernel, linuxppc-dev
Building ppc40x_defconfig leads to following error
CC arch/powerpc/kernel/idle.o
{standard input}: Assembler messages:
{standard input}:67: Error: unrecognized opcode: `wrteei'
{standard input}:78: Error: unrecognized opcode: `wrteei'
Add -mcpu=440 by default and alternatively 464 and 476.
Once that's done, -mcpu=powerpc is only for book3s/32 now.
But then comes
CC arch/powerpc/kernel/io.o
{standard input}: Assembler messages:
{standard input}:198: Error: unrecognized opcode: `eieio'
{standard input}:230: Error: unrecognized opcode: `eieio'
{standard input}:245: Error: unrecognized opcode: `eieio'
{standard input}:254: Error: unrecognized opcode: `eieio'
{standard input}:273: Error: unrecognized opcode: `eieio'
{standard input}:396: Error: unrecognized opcode: `eieio'
{standard input}:404: Error: unrecognized opcode: `eieio'
{standard input}:423: Error: unrecognized opcode: `eieio'
{standard input}:512: Error: unrecognized opcode: `eieio'
{standard input}:520: Error: unrecognized opcode: `eieio'
{standard input}:539: Error: unrecognized opcode: `eieio'
{standard input}:628: Error: unrecognized opcode: `eieio'
{standard input}:636: Error: unrecognized opcode: `eieio'
{standard input}:655: Error: unrecognized opcode: `eieio'
Fix it by replacing eieio by mbar on booke.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/include/asm/barrier.h | 2 ++
arch/powerpc/include/asm/nohash/pgtable.h | 2 +-
arch/powerpc/include/asm/synch.h | 5 ++++-
arch/powerpc/mm/nohash/tlb_low.S | 4 ++--
arch/powerpc/platforms/Kconfig.cputype | 17 ++++++++++++++++-
arch/powerpc/sysdev/fsl_rio.c | 12 ++++++++++--
6 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/include/asm/barrier.h b/arch/powerpc/include/asm/barrier.h
index f0e687236484..ef2d8b15eaab 100644
--- a/arch/powerpc/include/asm/barrier.h
+++ b/arch/powerpc/include/asm/barrier.h
@@ -42,6 +42,8 @@
/* The sub-arch has lwsync */
#if defined(CONFIG_PPC64) || defined(CONFIG_PPC_E500MC)
# define SMPWMB LWSYNC
+#elif defined(CONFIG_BOOKE)
+# define SMPWMB mbar
#else
# define SMPWMB eieio
#endif
diff --git a/arch/powerpc/include/asm/nohash/pgtable.h b/arch/powerpc/include/asm/nohash/pgtable.h
index ac75f4ab0dba..b499da6c1a99 100644
--- a/arch/powerpc/include/asm/nohash/pgtable.h
+++ b/arch/powerpc/include/asm/nohash/pgtable.h
@@ -193,7 +193,7 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr,
if (IS_ENABLED(CONFIG_PPC32) && IS_ENABLED(CONFIG_PTE_64BIT) && !percpu) {
__asm__ __volatile__("\
stw%X0 %2,%0\n\
- eieio\n\
+ mbar\n\
stw%X1 %L2,%1"
: "=m" (*ptep), "=m" (*((unsigned char *)ptep+4))
: "r" (pte) : "memory");
diff --git a/arch/powerpc/include/asm/synch.h b/arch/powerpc/include/asm/synch.h
index 1d67bc8d7bc6..7130176d8cb8 100644
--- a/arch/powerpc/include/asm/synch.h
+++ b/arch/powerpc/include/asm/synch.h
@@ -14,7 +14,10 @@ extern void do_lwsync_fixups(unsigned long value, void *fixup_start,
static inline void eieio(void)
{
- __asm__ __volatile__ ("eieio" : : : "memory");
+ if (IS_ENABLED(CONFIG_BOOKE))
+ __asm__ __volatile__ ("mbar" : : : "memory");
+ else
+ __asm__ __volatile__ ("eieio" : : : "memory");
}
static inline void isync(void)
diff --git a/arch/powerpc/mm/nohash/tlb_low.S b/arch/powerpc/mm/nohash/tlb_low.S
index dd39074de9af..d62b613a0d5d 100644
--- a/arch/powerpc/mm/nohash/tlb_low.S
+++ b/arch/powerpc/mm/nohash/tlb_low.S
@@ -186,7 +186,7 @@ _GLOBAL(_tlbivax_bcast)
isync
PPC_TLBIVAX(0, R3)
isync
- eieio
+ mbar
tlbsync
BEGIN_FTR_SECTION
b 1f
@@ -355,7 +355,7 @@ _GLOBAL(_tlbivax_bcast)
rlwimi r4,r6,MAS6_SIND_SHIFT,MAS6_SIND
1: mtspr SPRN_MAS6,r4 /* assume AS=0 for now */
PPC_TLBIVAX(0,R3)
- eieio
+ mbar
tlbsync
sync
wrtee r10
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index e14000557ebd..3cc8452b8660 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -137,7 +137,7 @@ config GENERIC_CPU
config POWERPC_CPU
bool "Generic 32 bits powerpc"
- depends on PPC32 && !PPC_8xx && !PPC_85xx && !40x
+ depends on PPC_BOOK3S_32
config CELL_CPU
bool "Cell Broadband Engine"
@@ -183,6 +183,18 @@ config 405_CPU
bool "40x family"
depends on 40x
+config 440_CPU
+ bool "440 (44x family)"
+ depends on 44x
+
+config 464_CPU
+ bool "464 (44x family)"
+ depends on 44x
+
+config 476_CPU
+ bool "476 (47x family)"
+ depends on PPC_47x
+
config 860_CPU
bool "8xx family"
depends on PPC_8xx
@@ -228,6 +240,9 @@ config TARGET_CPU
default "power8" if POWER8_CPU
default "power9" if POWER9_CPU
default "405" if 405_CPU
+ default "440" if 440_CPU
+ default "464" if 464_CPU
+ default "476" if 476_CPU
default "860" if 860_CPU
default "e300c2" if E300C2_CPU
default "e300c3" if E300C3_CPU
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 1bfc9afa8a1a..4647c6074f3b 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -69,10 +69,10 @@
static DEFINE_SPINLOCK(fsl_rio_config_lock);
-#define __fsl_read_rio_config(x, addr, err, op) \
+#define ___fsl_read_rio_config(x, addr, err, op, barrier) \
__asm__ __volatile__( \
"1: "op" %1,0(%2)\n" \
- " eieio\n" \
+ " "barrier"\n" \
"2:\n" \
".section .fixup,\"ax\"\n" \
"3: li %1,-1\n" \
@@ -83,6 +83,14 @@ static DEFINE_SPINLOCK(fsl_rio_config_lock);
: "=r" (err), "=r" (x) \
: "b" (addr), "i" (-EFAULT), "0" (err))
+#ifdef CONFIG_BOOKE
+#define __fsl_read_rio_config(x, addr, err, op) \
+ ___fsl_read_rio_config(x, addr, err, op, "mbar")
+#else
+#define __fsl_read_rio_config(x, addr, err, op) \
+ ___fsl_read_rio_config(x, addr, err, op, "eieio")
+#endif
+
void __iomem *rio_regs_win;
void __iomem *rmu_regs_win;
resource_size_t rio_law_start;
--
2.36.1
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH v1 4/5] powerpc/44x: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
@ 2022-07-11 14:19 ` Christophe Leroy
0 siblings, 0 replies; 33+ messages in thread
From: Christophe Leroy @ 2022-07-11 14:19 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin; +Cc: linuxppc-dev, linux-kernel
Building ppc40x_defconfig leads to following error
CC arch/powerpc/kernel/idle.o
{standard input}: Assembler messages:
{standard input}:67: Error: unrecognized opcode: `wrteei'
{standard input}:78: Error: unrecognized opcode: `wrteei'
Add -mcpu=440 by default and alternatively 464 and 476.
Once that's done, -mcpu=powerpc is only for book3s/32 now.
But then comes
CC arch/powerpc/kernel/io.o
{standard input}: Assembler messages:
{standard input}:198: Error: unrecognized opcode: `eieio'
{standard input}:230: Error: unrecognized opcode: `eieio'
{standard input}:245: Error: unrecognized opcode: `eieio'
{standard input}:254: Error: unrecognized opcode: `eieio'
{standard input}:273: Error: unrecognized opcode: `eieio'
{standard input}:396: Error: unrecognized opcode: `eieio'
{standard input}:404: Error: unrecognized opcode: `eieio'
{standard input}:423: Error: unrecognized opcode: `eieio'
{standard input}:512: Error: unrecognized opcode: `eieio'
{standard input}:520: Error: unrecognized opcode: `eieio'
{standard input}:539: Error: unrecognized opcode: `eieio'
{standard input}:628: Error: unrecognized opcode: `eieio'
{standard input}:636: Error: unrecognized opcode: `eieio'
{standard input}:655: Error: unrecognized opcode: `eieio'
Fix it by replacing eieio by mbar on booke.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/include/asm/barrier.h | 2 ++
arch/powerpc/include/asm/nohash/pgtable.h | 2 +-
arch/powerpc/include/asm/synch.h | 5 ++++-
arch/powerpc/mm/nohash/tlb_low.S | 4 ++--
arch/powerpc/platforms/Kconfig.cputype | 17 ++++++++++++++++-
arch/powerpc/sysdev/fsl_rio.c | 12 ++++++++++--
6 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/include/asm/barrier.h b/arch/powerpc/include/asm/barrier.h
index f0e687236484..ef2d8b15eaab 100644
--- a/arch/powerpc/include/asm/barrier.h
+++ b/arch/powerpc/include/asm/barrier.h
@@ -42,6 +42,8 @@
/* The sub-arch has lwsync */
#if defined(CONFIG_PPC64) || defined(CONFIG_PPC_E500MC)
# define SMPWMB LWSYNC
+#elif defined(CONFIG_BOOKE)
+# define SMPWMB mbar
#else
# define SMPWMB eieio
#endif
diff --git a/arch/powerpc/include/asm/nohash/pgtable.h b/arch/powerpc/include/asm/nohash/pgtable.h
index ac75f4ab0dba..b499da6c1a99 100644
--- a/arch/powerpc/include/asm/nohash/pgtable.h
+++ b/arch/powerpc/include/asm/nohash/pgtable.h
@@ -193,7 +193,7 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr,
if (IS_ENABLED(CONFIG_PPC32) && IS_ENABLED(CONFIG_PTE_64BIT) && !percpu) {
__asm__ __volatile__("\
stw%X0 %2,%0\n\
- eieio\n\
+ mbar\n\
stw%X1 %L2,%1"
: "=m" (*ptep), "=m" (*((unsigned char *)ptep+4))
: "r" (pte) : "memory");
diff --git a/arch/powerpc/include/asm/synch.h b/arch/powerpc/include/asm/synch.h
index 1d67bc8d7bc6..7130176d8cb8 100644
--- a/arch/powerpc/include/asm/synch.h
+++ b/arch/powerpc/include/asm/synch.h
@@ -14,7 +14,10 @@ extern void do_lwsync_fixups(unsigned long value, void *fixup_start,
static inline void eieio(void)
{
- __asm__ __volatile__ ("eieio" : : : "memory");
+ if (IS_ENABLED(CONFIG_BOOKE))
+ __asm__ __volatile__ ("mbar" : : : "memory");
+ else
+ __asm__ __volatile__ ("eieio" : : : "memory");
}
static inline void isync(void)
diff --git a/arch/powerpc/mm/nohash/tlb_low.S b/arch/powerpc/mm/nohash/tlb_low.S
index dd39074de9af..d62b613a0d5d 100644
--- a/arch/powerpc/mm/nohash/tlb_low.S
+++ b/arch/powerpc/mm/nohash/tlb_low.S
@@ -186,7 +186,7 @@ _GLOBAL(_tlbivax_bcast)
isync
PPC_TLBIVAX(0, R3)
isync
- eieio
+ mbar
tlbsync
BEGIN_FTR_SECTION
b 1f
@@ -355,7 +355,7 @@ _GLOBAL(_tlbivax_bcast)
rlwimi r4,r6,MAS6_SIND_SHIFT,MAS6_SIND
1: mtspr SPRN_MAS6,r4 /* assume AS=0 for now */
PPC_TLBIVAX(0,R3)
- eieio
+ mbar
tlbsync
sync
wrtee r10
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index e14000557ebd..3cc8452b8660 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -137,7 +137,7 @@ config GENERIC_CPU
config POWERPC_CPU
bool "Generic 32 bits powerpc"
- depends on PPC32 && !PPC_8xx && !PPC_85xx && !40x
+ depends on PPC_BOOK3S_32
config CELL_CPU
bool "Cell Broadband Engine"
@@ -183,6 +183,18 @@ config 405_CPU
bool "40x family"
depends on 40x
+config 440_CPU
+ bool "440 (44x family)"
+ depends on 44x
+
+config 464_CPU
+ bool "464 (44x family)"
+ depends on 44x
+
+config 476_CPU
+ bool "476 (47x family)"
+ depends on PPC_47x
+
config 860_CPU
bool "8xx family"
depends on PPC_8xx
@@ -228,6 +240,9 @@ config TARGET_CPU
default "power8" if POWER8_CPU
default "power9" if POWER9_CPU
default "405" if 405_CPU
+ default "440" if 440_CPU
+ default "464" if 464_CPU
+ default "476" if 476_CPU
default "860" if 860_CPU
default "e300c2" if E300C2_CPU
default "e300c3" if E300C3_CPU
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 1bfc9afa8a1a..4647c6074f3b 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -69,10 +69,10 @@
static DEFINE_SPINLOCK(fsl_rio_config_lock);
-#define __fsl_read_rio_config(x, addr, err, op) \
+#define ___fsl_read_rio_config(x, addr, err, op, barrier) \
__asm__ __volatile__( \
"1: "op" %1,0(%2)\n" \
- " eieio\n" \
+ " "barrier"\n" \
"2:\n" \
".section .fixup,\"ax\"\n" \
"3: li %1,-1\n" \
@@ -83,6 +83,14 @@ static DEFINE_SPINLOCK(fsl_rio_config_lock);
: "=r" (err), "=r" (x) \
: "b" (addr), "i" (-EFAULT), "0" (err))
+#ifdef CONFIG_BOOKE
+#define __fsl_read_rio_config(x, addr, err, op) \
+ ___fsl_read_rio_config(x, addr, err, op, "mbar")
+#else
+#define __fsl_read_rio_config(x, addr, err, op) \
+ ___fsl_read_rio_config(x, addr, err, op, "eieio")
+#endif
+
void __iomem *rio_regs_win;
void __iomem *rmu_regs_win;
resource_size_t rio_law_start;
--
2.36.1
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH v1 5/5] powerpc/64e: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
2022-07-11 14:19 ` Christophe Leroy
@ 2022-07-11 14:19 ` Christophe Leroy
-1 siblings, 0 replies; 33+ messages in thread
From: Christophe Leroy @ 2022-07-11 14:19 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin
Cc: Christophe Leroy, linux-kernel, linuxppc-dev
With GCC 12, corenet64_smp_defconfig leads to the following build errors:
CC arch/powerpc/kernel/irq.o
{standard input}: Assembler messages:
{standard input}:3616: Error: unrecognized opcode: `wrteei'
{standard input}:5689: Error: unrecognized opcode: `wrteei'
CC arch/powerpc/kernel/pmc.o
{standard input}: Assembler messages:
{standard input}:42: Error: unrecognized opcode: `mfpmr'
{standard input}:53: Error: unrecognized opcode: `mtpmr'
CC arch/powerpc/kernel/io.o
{standard input}: Assembler messages:
{standard input}:376: Error: unrecognized opcode: `mbar'
...
CC arch/powerpc/mm/nohash/book3e_hugetlbpage.o
{standard input}: Assembler messages:
{standard input}:291: Error: unrecognized opcode: `tlbsx'
{standard input}:482: Error: unrecognized opcode: `tlbwe'
{standard input}:608: Error: unrecognized opcode: `lbarx'
{standard input}:608: Error: unrecognized opcode: `stbcx.'
-mpcu=powerpc64 cannot be used anymore for book3e, it must be a booke CPU.
But then we get:
CC arch/powerpc/lib/xor_vmx.o
cc1: error: AltiVec not supported in this target
Altivec is not supported with -mcpu=e5500 so don't allow selection
of altivec when e5500 is selected.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/Makefile | 8 +-------
arch/powerpc/platforms/Kconfig.cputype | 8 ++++----
2 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index d54e1fe03551..02742facf895 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -168,13 +168,7 @@ endif
CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
-# Altivec option not allowed with e500mc64 in GCC.
-ifdef CONFIG_ALTIVEC
-E5500_CPU := -mcpu=powerpc64
-else
-E5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
-endif
-CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
+CFLAGS-$(CONFIG_E5500_CPU) += $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 3cc8452b8660..5185d942b455 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -126,12 +126,12 @@ choice
config GENERIC_CPU
bool "Generic (POWER4 and above)"
- depends on PPC64 && !CPU_LITTLE_ENDIAN
- select PPC_64S_HASH_MMU if PPC_BOOK3S_64
+ depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
+ select PPC_64S_HASH_MMU
config GENERIC_CPU
bool "Generic (POWER8 and above)"
- depends on PPC64 && CPU_LITTLE_ENDIAN
+ depends on PPC_BOOK3S_64 && CPU_LITTLE_ENDIAN
select ARCH_HAS_FAST_MULTIPLIER
select PPC_64S_HASH_MMU
@@ -358,7 +358,7 @@ config PHYS_64BIT
config ALTIVEC
bool "AltiVec Support"
- depends on PPC_BOOK3S_32 || PPC_BOOK3S_64 || (PPC_E500MC && PPC64)
+ depends on PPC_BOOK3S || (PPC_E500MC && PPC64 && !E5500_CPU)
select PPC_FPU
help
This option enables kernel support for the Altivec extensions to the
--
2.36.1
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH v1 5/5] powerpc/64e: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
@ 2022-07-11 14:19 ` Christophe Leroy
0 siblings, 0 replies; 33+ messages in thread
From: Christophe Leroy @ 2022-07-11 14:19 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin; +Cc: linuxppc-dev, linux-kernel
With GCC 12, corenet64_smp_defconfig leads to the following build errors:
CC arch/powerpc/kernel/irq.o
{standard input}: Assembler messages:
{standard input}:3616: Error: unrecognized opcode: `wrteei'
{standard input}:5689: Error: unrecognized opcode: `wrteei'
CC arch/powerpc/kernel/pmc.o
{standard input}: Assembler messages:
{standard input}:42: Error: unrecognized opcode: `mfpmr'
{standard input}:53: Error: unrecognized opcode: `mtpmr'
CC arch/powerpc/kernel/io.o
{standard input}: Assembler messages:
{standard input}:376: Error: unrecognized opcode: `mbar'
...
CC arch/powerpc/mm/nohash/book3e_hugetlbpage.o
{standard input}: Assembler messages:
{standard input}:291: Error: unrecognized opcode: `tlbsx'
{standard input}:482: Error: unrecognized opcode: `tlbwe'
{standard input}:608: Error: unrecognized opcode: `lbarx'
{standard input}:608: Error: unrecognized opcode: `stbcx.'
-mpcu=powerpc64 cannot be used anymore for book3e, it must be a booke CPU.
But then we get:
CC arch/powerpc/lib/xor_vmx.o
cc1: error: AltiVec not supported in this target
Altivec is not supported with -mcpu=e5500 so don't allow selection
of altivec when e5500 is selected.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/Makefile | 8 +-------
arch/powerpc/platforms/Kconfig.cputype | 8 ++++----
2 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index d54e1fe03551..02742facf895 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -168,13 +168,7 @@ endif
CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
-# Altivec option not allowed with e500mc64 in GCC.
-ifdef CONFIG_ALTIVEC
-E5500_CPU := -mcpu=powerpc64
-else
-E5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
-endif
-CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
+CFLAGS-$(CONFIG_E5500_CPU) += $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 3cc8452b8660..5185d942b455 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -126,12 +126,12 @@ choice
config GENERIC_CPU
bool "Generic (POWER4 and above)"
- depends on PPC64 && !CPU_LITTLE_ENDIAN
- select PPC_64S_HASH_MMU if PPC_BOOK3S_64
+ depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
+ select PPC_64S_HASH_MMU
config GENERIC_CPU
bool "Generic (POWER8 and above)"
- depends on PPC64 && CPU_LITTLE_ENDIAN
+ depends on PPC_BOOK3S_64 && CPU_LITTLE_ENDIAN
select ARCH_HAS_FAST_MULTIPLIER
select PPC_64S_HASH_MMU
@@ -358,7 +358,7 @@ config PHYS_64BIT
config ALTIVEC
bool "AltiVec Support"
- depends on PPC_BOOK3S_32 || PPC_BOOK3S_64 || (PPC_E500MC && PPC64)
+ depends on PPC_BOOK3S || (PPC_E500MC && PPC64 && !E5500_CPU)
select PPC_FPU
help
This option enables kernel support for the Altivec extensions to the
--
2.36.1
^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: [PATCH v1 4/5] powerpc/44x: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
2022-07-11 14:19 ` Christophe Leroy
@ 2022-07-11 15:05 ` Arnd Bergmann
-1 siblings, 0 replies; 33+ messages in thread
From: Arnd Bergmann @ 2022-07-11 15:05 UTC (permalink / raw)
To: Christophe Leroy
Cc: Michael Ellerman, Nicholas Piggin, linuxppc-dev,
Linux Kernel Mailing List
On Mon, Jul 11, 2022 at 4:19 PM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
> @@ -183,6 +183,18 @@ config 405_CPU
> bool "40x family"
> depends on 40x
>
> +config 440_CPU
> + bool "440 (44x family)"
> + depends on 44x
> +
> +config 464_CPU
> + bool "464 (44x family)"
> + depends on 44x
> +
> +config 476_CPU
> + bool "476 (47x family)"
> + depends on PPC_47x
Is there any value in building for -mcpu=440 or -mcpu=464 when targeting a 476?
Maybe add another !PPC_47x dependency for the first two. Ideally we would also
enforce that 440/464 based boards cannot be selected together with 476, though
I guess that is a separate issue.
Is there a practical difference between 440 and 464 when building kernels?
gcc seems to treat them the same way, so maybe one option for both is enough
here.
Arnd
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 4/5] powerpc/44x: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
@ 2022-07-11 15:05 ` Arnd Bergmann
0 siblings, 0 replies; 33+ messages in thread
From: Arnd Bergmann @ 2022-07-11 15:05 UTC (permalink / raw)
To: Christophe Leroy; +Cc: linuxppc-dev, Linux Kernel Mailing List, Nicholas Piggin
On Mon, Jul 11, 2022 at 4:19 PM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
> @@ -183,6 +183,18 @@ config 405_CPU
> bool "40x family"
> depends on 40x
>
> +config 440_CPU
> + bool "440 (44x family)"
> + depends on 44x
> +
> +config 464_CPU
> + bool "464 (44x family)"
> + depends on 44x
> +
> +config 476_CPU
> + bool "476 (47x family)"
> + depends on PPC_47x
Is there any value in building for -mcpu=440 or -mcpu=464 when targeting a 476?
Maybe add another !PPC_47x dependency for the first two. Ideally we would also
enforce that 440/464 based boards cannot be selected together with 476, though
I guess that is a separate issue.
Is there a practical difference between 440 and 464 when building kernels?
gcc seems to treat them the same way, so maybe one option for both is enough
here.
Arnd
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 4/5] powerpc/44x: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
2022-07-11 15:05 ` Arnd Bergmann
@ 2022-07-11 15:49 ` Christophe Leroy
-1 siblings, 0 replies; 33+ messages in thread
From: Christophe Leroy @ 2022-07-11 15:49 UTC (permalink / raw)
To: Arnd Bergmann, Pali Rohár, Segher Boessenkool
Cc: Michael Ellerman, Nicholas Piggin, linuxppc-dev,
Linux Kernel Mailing List
Oops, I wanted to include Pali and Segher when I sent the series, I
prepared a script including them but used the wrong script at the end.
Le 11/07/2022 à 17:05, Arnd Bergmann a écrit :
> On Mon, Jul 11, 2022 at 4:19 PM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
>> @@ -183,6 +183,18 @@ config 405_CPU
>> bool "40x family"
>> depends on 40x
>>
>> +config 440_CPU
>> + bool "440 (44x family)"
>> + depends on 44x
>> +
>> +config 464_CPU
>> + bool "464 (44x family)"
>> + depends on 44x
>> +
>> +config 476_CPU
>> + bool "476 (47x family)"
>> + depends on PPC_47x
>
> Is there any value in building for -mcpu=440 or -mcpu=464 when targeting a 476?
No idea, maybe not.
> Maybe add another !PPC_47x dependency for the first two. Ideally we would also
> enforce that 440/464 based boards cannot be selected together with 476, though
> I guess that is a separate issue.
Yes can do that.
By the way, 440/464 boards get excluded from kernel/cputable.c when 47x
is selected
>
> Is there a practical difference between 440 and 464 when building kernels?
> gcc seems to treat them the same way, so maybe one option for both is enough
> here.
>
I don't know.
Christophe
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 4/5] powerpc/44x: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
@ 2022-07-11 15:49 ` Christophe Leroy
0 siblings, 0 replies; 33+ messages in thread
From: Christophe Leroy @ 2022-07-11 15:49 UTC (permalink / raw)
To: Arnd Bergmann, Pali Rohár, Segher Boessenkool
Cc: linuxppc-dev, Linux Kernel Mailing List, Nicholas Piggin
Oops, I wanted to include Pali and Segher when I sent the series, I
prepared a script including them but used the wrong script at the end.
Le 11/07/2022 à 17:05, Arnd Bergmann a écrit :
> On Mon, Jul 11, 2022 at 4:19 PM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
>> @@ -183,6 +183,18 @@ config 405_CPU
>> bool "40x family"
>> depends on 40x
>>
>> +config 440_CPU
>> + bool "440 (44x family)"
>> + depends on 44x
>> +
>> +config 464_CPU
>> + bool "464 (44x family)"
>> + depends on 44x
>> +
>> +config 476_CPU
>> + bool "476 (47x family)"
>> + depends on PPC_47x
>
> Is there any value in building for -mcpu=440 or -mcpu=464 when targeting a 476?
No idea, maybe not.
> Maybe add another !PPC_47x dependency for the first two. Ideally we would also
> enforce that 440/464 based boards cannot be selected together with 476, though
> I guess that is a separate issue.
Yes can do that.
By the way, 440/464 boards get excluded from kernel/cputable.c when 47x
is selected
>
> Is there a practical difference between 440 and 464 when building kernels?
> gcc seems to treat them the same way, so maybe one option for both is enough
> here.
>
I don't know.
Christophe
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 1/5] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32
2022-07-11 14:19 ` Christophe Leroy
@ 2022-07-11 16:39 ` Segher Boessenkool
-1 siblings, 0 replies; 33+ messages in thread
From: Segher Boessenkool @ 2022-07-11 16:39 UTC (permalink / raw)
To: Christophe Leroy; +Cc: linuxppc-dev, linux-kernel, Nicholas Piggin
Hi!
On Mon, Jul 11, 2022 at 04:19:29PM +0200, Christophe Leroy wrote:
> Commit 0e00a8c9fd92 ("powerpc: Allow CPU selection also on PPC32")
> enlarged the CPU selection logic to PPC32 by removing depend to
> PPC64, and failed to restrict that depend to E5500_CPU and E6500_CPU.
> Fortunately that got unnoticed because -mcpu=8540 will override the
> -mcpu=e500mc64 or -mpcu=e6500 as they are ealier, but that's
> fragile and may no be right in the future.
A later -mcpu= always overrides an earlier one. This is the same as
with all other GCC option flags, and will not change in the future.
Segher
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 1/5] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32
@ 2022-07-11 16:39 ` Segher Boessenkool
0 siblings, 0 replies; 33+ messages in thread
From: Segher Boessenkool @ 2022-07-11 16:39 UTC (permalink / raw)
To: Christophe Leroy
Cc: Michael Ellerman, Nicholas Piggin, linuxppc-dev, linux-kernel
Hi!
On Mon, Jul 11, 2022 at 04:19:29PM +0200, Christophe Leroy wrote:
> Commit 0e00a8c9fd92 ("powerpc: Allow CPU selection also on PPC32")
> enlarged the CPU selection logic to PPC32 by removing depend to
> PPC64, and failed to restrict that depend to E5500_CPU and E6500_CPU.
> Fortunately that got unnoticed because -mcpu=8540 will override the
> -mcpu=e500mc64 or -mpcu=e6500 as they are ealier, but that's
> fragile and may no be right in the future.
A later -mcpu= always overrides an earlier one. This is the same as
with all other GCC option flags, and will not change in the future.
Segher
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 2/5] powerpc/32: Don't always pass -mcpu=powerpc to the compiler
2022-07-11 14:19 ` Christophe Leroy
@ 2022-07-11 16:50 ` Segher Boessenkool
-1 siblings, 0 replies; 33+ messages in thread
From: Segher Boessenkool @ 2022-07-11 16:50 UTC (permalink / raw)
To: Christophe Leroy
Cc: Michael Ellerman, Nicholas Piggin, linux-kernel, linuxppc-dev,
Pali Rohár, Arnd Bergmann
On Mon, Jul 11, 2022 at 04:19:30PM +0200, Christophe Leroy wrote:
> Since commit 4bf4f42a2feb ("powerpc/kbuild: Set default generic
> machine type for 32-bit compile"), when building a 32 bits kernel
> with a bi-arch version of GCC, or when building a book3s/32 kernel,
> the option -mcpu=powerpc is passed to GCC at all time, relying on it
> being eventually overriden by a subsequent -mcpu=xxxx.
>
> But when building the same kernel with a 32 bits only version of GCC,
> that is not done, relying on gcc being built with the expected default
> CPU.
>
> This logic has two problems. First, it is a bit fragile to rely on
> whether the GCC version is bi-arch or not, because today we can have
> bi-arch versions of GCC configured with a 32 bits default. Second,
> there are some versions of GCC which don't support -mcpu=powerpc,
> for instance for e500 SPE-only versions.
More fundamentally, the *only* thing you should check biarch for is
for determining if you can use both -m32 and -m64 with the same
compiler. Everything behaves identically in a biarch and a non-biarch
compiler, other than the latter screams bloody murder if you try to
change the architecture from 32 to 64 bit or vice versa.
> So, stop relying on this approximative logic and allow the user to
> decide whether he/she wants to use the toolchain's default CPU or if
> he/she wants to set one, and allow only possible CPUs based on the
> selected target.
>
> Reported-by: Pali Rohár <pali@kernel.org>
> Tested-by: Pali Rohár <pali@kernel.org>
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> Cc: Segher Boessenkool <segher@kernel.crashing.org>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
Looks good to me. This untangles/demystifies quite some code :-)
Segher
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 2/5] powerpc/32: Don't always pass -mcpu=powerpc to the compiler
@ 2022-07-11 16:50 ` Segher Boessenkool
0 siblings, 0 replies; 33+ messages in thread
From: Segher Boessenkool @ 2022-07-11 16:50 UTC (permalink / raw)
To: Christophe Leroy
Cc: Arnd Bergmann, linuxppc-dev, Nicholas Piggin, linux-kernel,
Pali Rohár
On Mon, Jul 11, 2022 at 04:19:30PM +0200, Christophe Leroy wrote:
> Since commit 4bf4f42a2feb ("powerpc/kbuild: Set default generic
> machine type for 32-bit compile"), when building a 32 bits kernel
> with a bi-arch version of GCC, or when building a book3s/32 kernel,
> the option -mcpu=powerpc is passed to GCC at all time, relying on it
> being eventually overriden by a subsequent -mcpu=xxxx.
>
> But when building the same kernel with a 32 bits only version of GCC,
> that is not done, relying on gcc being built with the expected default
> CPU.
>
> This logic has two problems. First, it is a bit fragile to rely on
> whether the GCC version is bi-arch or not, because today we can have
> bi-arch versions of GCC configured with a 32 bits default. Second,
> there are some versions of GCC which don't support -mcpu=powerpc,
> for instance for e500 SPE-only versions.
More fundamentally, the *only* thing you should check biarch for is
for determining if you can use both -m32 and -m64 with the same
compiler. Everything behaves identically in a biarch and a non-biarch
compiler, other than the latter screams bloody murder if you try to
change the architecture from 32 to 64 bit or vice versa.
> So, stop relying on this approximative logic and allow the user to
> decide whether he/she wants to use the toolchain's default CPU or if
> he/she wants to set one, and allow only possible CPUs based on the
> selected target.
>
> Reported-by: Pali Rohár <pali@kernel.org>
> Tested-by: Pali Rohár <pali@kernel.org>
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> Cc: Segher Boessenkool <segher@kernel.crashing.org>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
Looks good to me. This untangles/demystifies quite some code :-)
Segher
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 4/5] powerpc/44x: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
2022-07-11 15:05 ` Arnd Bergmann
@ 2022-07-11 17:12 ` Segher Boessenkool
-1 siblings, 0 replies; 33+ messages in thread
From: Segher Boessenkool @ 2022-07-11 17:12 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linuxppc-dev, Linux Kernel Mailing List, Nicholas Piggin
On Mon, Jul 11, 2022 at 05:05:04PM +0200, Arnd Bergmann wrote:
> Is there any value in building for -mcpu=440 or -mcpu=464 when targeting a 476?
The original 440 had a very short pipeline. Later IBM 4xx have a longer
pipeline. Getting this right (with -mtune=, or just with -mcpu=) is
important for performance. So, no?
> Maybe add another !PPC_47x dependency for the first two. Ideally we would also
> enforce that 440/464 based boards cannot be selected together with 476, though
> I guess that is a separate issue.
>
> Is there a practical difference between 440 and 464 when building kernels?
> gcc seems to treat them the same way, so maybe one option for both is enough
> here.
-mcpu= is used as the default for -mtune=, so that is always a
consideration. PPC464 is treated the same as PPC440 in binutils as
well, so I don't think there is any issue there.
Segher
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 4/5] powerpc/44x: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
@ 2022-07-11 17:12 ` Segher Boessenkool
0 siblings, 0 replies; 33+ messages in thread
From: Segher Boessenkool @ 2022-07-11 17:12 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Christophe Leroy, linuxppc-dev, Linux Kernel Mailing List,
Nicholas Piggin
On Mon, Jul 11, 2022 at 05:05:04PM +0200, Arnd Bergmann wrote:
> Is there any value in building for -mcpu=440 or -mcpu=464 when targeting a 476?
The original 440 had a very short pipeline. Later IBM 4xx have a longer
pipeline. Getting this right (with -mtune=, or just with -mcpu=) is
important for performance. So, no?
> Maybe add another !PPC_47x dependency for the first two. Ideally we would also
> enforce that 440/464 based boards cannot be selected together with 476, though
> I guess that is a separate issue.
>
> Is there a practical difference between 440 and 464 when building kernels?
> gcc seems to treat them the same way, so maybe one option for both is enough
> here.
-mcpu= is used as the default for -mtune=, so that is always a
consideration. PPC464 is treated the same as PPC440 in binutils as
well, so I don't think there is any issue there.
Segher
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 1/5] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32
2022-07-11 16:39 ` Segher Boessenkool
@ 2022-07-11 17:42 ` Christophe Leroy
-1 siblings, 0 replies; 33+ messages in thread
From: Christophe Leroy @ 2022-07-11 17:42 UTC (permalink / raw)
To: Segher Boessenkool
Cc: Michael Ellerman, Nicholas Piggin, linuxppc-dev, linux-kernel
Le 11/07/2022 à 18:39, Segher Boessenkool a écrit :
> Hi!
>
> On Mon, Jul 11, 2022 at 04:19:29PM +0200, Christophe Leroy wrote:
>> Commit 0e00a8c9fd92 ("powerpc: Allow CPU selection also on PPC32")
>> enlarged the CPU selection logic to PPC32 by removing depend to
>> PPC64, and failed to restrict that depend to E5500_CPU and E6500_CPU.
>> Fortunately that got unnoticed because -mcpu=8540 will override the
>> -mcpu=e500mc64 or -mpcu=e6500 as they are ealier, but that's
>> fragile and may no be right in the future.
>
> A later -mcpu= always overrides an earlier one. This is the same as
> with all other GCC option flags, and will not change in the future.
>
By "future" I meant after patch 2.
At the time being, if you select PPC32 and MPC_85xx and E6500_CPU, you
get -mcpu=e6500 -mcpu=8540.
After patch 2, if you select PPC32 and MPC_85xx and E6500_CPU, you get
-mcpu=e6500
Christophe
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 1/5] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32
@ 2022-07-11 17:42 ` Christophe Leroy
0 siblings, 0 replies; 33+ messages in thread
From: Christophe Leroy @ 2022-07-11 17:42 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev, linux-kernel, Nicholas Piggin
Le 11/07/2022 à 18:39, Segher Boessenkool a écrit :
> Hi!
>
> On Mon, Jul 11, 2022 at 04:19:29PM +0200, Christophe Leroy wrote:
>> Commit 0e00a8c9fd92 ("powerpc: Allow CPU selection also on PPC32")
>> enlarged the CPU selection logic to PPC32 by removing depend to
>> PPC64, and failed to restrict that depend to E5500_CPU and E6500_CPU.
>> Fortunately that got unnoticed because -mcpu=8540 will override the
>> -mcpu=e500mc64 or -mpcu=e6500 as they are ealier, but that's
>> fragile and may no be right in the future.
>
> A later -mcpu= always overrides an earlier one. This is the same as
> with all other GCC option flags, and will not change in the future.
>
By "future" I meant after patch 2.
At the time being, if you select PPC32 and MPC_85xx and E6500_CPU, you
get -mcpu=e6500 -mcpu=8540.
After patch 2, if you select PPC32 and MPC_85xx and E6500_CPU, you get
-mcpu=e6500
Christophe
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 1/5] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32
2022-07-11 14:19 ` Christophe Leroy
` (5 preceding siblings ...)
(?)
@ 2022-07-29 13:02 ` Michael Ellerman
-1 siblings, 0 replies; 33+ messages in thread
From: Michael Ellerman @ 2022-07-29 13:02 UTC (permalink / raw)
To: Christophe Leroy, Michael Ellerman, Nicholas Piggin
Cc: linuxppc-dev, linux-kernel
On Mon, 11 Jul 2022 16:19:29 +0200, Christophe Leroy wrote:
> Commit 0e00a8c9fd92 ("powerpc: Allow CPU selection also on PPC32")
> enlarged the CPU selection logic to PPC32 by removing depend to
> PPC64, and failed to restrict that depend to E5500_CPU and E6500_CPU.
> Fortunately that got unnoticed because -mcpu=8540 will override the
> -mcpu=e500mc64 or -mpcu=e6500 as they are ealier, but that's
> fragile and may no be right in the future.
>
> [...]
Applied to powerpc/next.
[1/5] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32
https://git.kernel.org/powerpc/c/9be013b2a9ecb29b5168e4b9db0e48ed53acf37c
[2/5] powerpc/32: Don't always pass -mcpu=powerpc to the compiler
https://git.kernel.org/powerpc/c/446cda1b21d9a6b3697fe399c6a3a00ff4a285f5
[3/5] powerpc/405: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
https://git.kernel.org/powerpc/c/ff27d9200a98757efc7c2cdf198904fd79cf4ffd
[4/5] powerpc/44x: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
https://git.kernel.org/powerpc/c/2255411d1d0f0661d1e5acd5f6edf4e6652a345a
[5/5] powerpc/64e: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
https://git.kernel.org/powerpc/c/d6b551b8f90cc92c7d3c09cf38c748efe305ecb4
cheers
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 2/5] powerpc/32: Don't always pass -mcpu=powerpc to the compiler
2022-07-11 14:19 ` Christophe Leroy
@ 2022-08-18 17:46 ` Pali Rohár
-1 siblings, 0 replies; 33+ messages in thread
From: Pali Rohár @ 2022-08-18 17:46 UTC (permalink / raw)
To: Christophe Leroy
Cc: Michael Ellerman, Nicholas Piggin, linux-kernel, linuxppc-dev,
Arnd Bergmann, Segher Boessenkool
On Monday 11 July 2022 16:19:30 Christophe Leroy wrote:
> Since commit 4bf4f42a2feb ("powerpc/kbuild: Set default generic
> machine type for 32-bit compile"), when building a 32 bits kernel
> with a bi-arch version of GCC, or when building a book3s/32 kernel,
> the option -mcpu=powerpc is passed to GCC at all time, relying on it
> being eventually overriden by a subsequent -mcpu=xxxx.
>
> But when building the same kernel with a 32 bits only version of GCC,
> that is not done, relying on gcc being built with the expected default
> CPU.
>
> This logic has two problems. First, it is a bit fragile to rely on
> whether the GCC version is bi-arch or not, because today we can have
> bi-arch versions of GCC configured with a 32 bits default. Second,
> there are some versions of GCC which don't support -mcpu=powerpc,
> for instance for e500 SPE-only versions.
>
> So, stop relying on this approximative logic and allow the user to
> decide whether he/she wants to use the toolchain's default CPU or if
> he/she wants to set one, and allow only possible CPUs based on the
> selected target.
Hello! Exactly same issue is still in file arch/powerpc/boot/Makefile:
ifdef CONFIG_PPC64_BOOT_WRAPPER
ifdef CONFIG_CPU_LITTLE_ENDIAN
BOOTCFLAGS += -m64 -mcpu=powerpc64le
else
BOOTCFLAGS += -m64 -mcpu=powerpc64
endif
else
BOOTCFLAGS += -m32 -mcpu=powerpc
endif
It cause compile error:
make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnuspe- mpc85xx_smp_defconfig uImage
...
BOOTAS arch/powerpc/boot/crt0.o
powerpc-linux-gnuspe-gcc: error: unrecognized argument in option ‘-mcpu=powerpc’
powerpc-linux-gnuspe-gcc: note: valid arguments to ‘-mcpu=’ are: 8540 8548 native
make[1]: *** [arch/powerpc/boot/Makefile:231: arch/powerpc/boot/crt0.o] Error 1
> Reported-by: Pali Rohár <pali@kernel.org>
> Tested-by: Pali Rohár <pali@kernel.org>
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> Cc: Segher Boessenkool <segher@kernel.crashing.org>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> arch/powerpc/Makefile | 26 +-------------------------
> arch/powerpc/platforms/Kconfig.cputype | 21 ++++++++++++++++++---
> 2 files changed, 19 insertions(+), 28 deletions(-)
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 2/5] powerpc/32: Don't always pass -mcpu=powerpc to the compiler
@ 2022-08-18 17:46 ` Pali Rohár
0 siblings, 0 replies; 33+ messages in thread
From: Pali Rohár @ 2022-08-18 17:46 UTC (permalink / raw)
To: Christophe Leroy
Cc: Arnd Bergmann, linux-kernel, Nicholas Piggin, linuxppc-dev
On Monday 11 July 2022 16:19:30 Christophe Leroy wrote:
> Since commit 4bf4f42a2feb ("powerpc/kbuild: Set default generic
> machine type for 32-bit compile"), when building a 32 bits kernel
> with a bi-arch version of GCC, or when building a book3s/32 kernel,
> the option -mcpu=powerpc is passed to GCC at all time, relying on it
> being eventually overriden by a subsequent -mcpu=xxxx.
>
> But when building the same kernel with a 32 bits only version of GCC,
> that is not done, relying on gcc being built with the expected default
> CPU.
>
> This logic has two problems. First, it is a bit fragile to rely on
> whether the GCC version is bi-arch or not, because today we can have
> bi-arch versions of GCC configured with a 32 bits default. Second,
> there are some versions of GCC which don't support -mcpu=powerpc,
> for instance for e500 SPE-only versions.
>
> So, stop relying on this approximative logic and allow the user to
> decide whether he/she wants to use the toolchain's default CPU or if
> he/she wants to set one, and allow only possible CPUs based on the
> selected target.
Hello! Exactly same issue is still in file arch/powerpc/boot/Makefile:
ifdef CONFIG_PPC64_BOOT_WRAPPER
ifdef CONFIG_CPU_LITTLE_ENDIAN
BOOTCFLAGS += -m64 -mcpu=powerpc64le
else
BOOTCFLAGS += -m64 -mcpu=powerpc64
endif
else
BOOTCFLAGS += -m32 -mcpu=powerpc
endif
It cause compile error:
make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnuspe- mpc85xx_smp_defconfig uImage
...
BOOTAS arch/powerpc/boot/crt0.o
powerpc-linux-gnuspe-gcc: error: unrecognized argument in option ‘-mcpu=powerpc’
powerpc-linux-gnuspe-gcc: note: valid arguments to ‘-mcpu=’ are: 8540 8548 native
make[1]: *** [arch/powerpc/boot/Makefile:231: arch/powerpc/boot/crt0.o] Error 1
> Reported-by: Pali Rohár <pali@kernel.org>
> Tested-by: Pali Rohár <pali@kernel.org>
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> Cc: Segher Boessenkool <segher@kernel.crashing.org>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> arch/powerpc/Makefile | 26 +-------------------------
> arch/powerpc/platforms/Kconfig.cputype | 21 ++++++++++++++++++---
> 2 files changed, 19 insertions(+), 28 deletions(-)
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 2/5] powerpc/32: Don't always pass -mcpu=powerpc to the compiler
2022-08-18 17:46 ` Pali Rohár
@ 2022-08-20 10:55 ` Pali Rohár
-1 siblings, 0 replies; 33+ messages in thread
From: Pali Rohár @ 2022-08-20 10:55 UTC (permalink / raw)
To: Christophe Leroy
Cc: Michael Ellerman, Nicholas Piggin, linux-kernel, linuxppc-dev,
Arnd Bergmann, Segher Boessenkool
On Thursday 18 August 2022 19:46:34 Pali Rohár wrote:
> On Monday 11 July 2022 16:19:30 Christophe Leroy wrote:
> > Since commit 4bf4f42a2feb ("powerpc/kbuild: Set default generic
> > machine type for 32-bit compile"), when building a 32 bits kernel
> > with a bi-arch version of GCC, or when building a book3s/32 kernel,
> > the option -mcpu=powerpc is passed to GCC at all time, relying on it
> > being eventually overriden by a subsequent -mcpu=xxxx.
> >
> > But when building the same kernel with a 32 bits only version of GCC,
> > that is not done, relying on gcc being built with the expected default
> > CPU.
> >
> > This logic has two problems. First, it is a bit fragile to rely on
> > whether the GCC version is bi-arch or not, because today we can have
> > bi-arch versions of GCC configured with a 32 bits default. Second,
> > there are some versions of GCC which don't support -mcpu=powerpc,
> > for instance for e500 SPE-only versions.
> >
> > So, stop relying on this approximative logic and allow the user to
> > decide whether he/she wants to use the toolchain's default CPU or if
> > he/she wants to set one, and allow only possible CPUs based on the
> > selected target.
>
> Hello! Exactly same issue is still in file arch/powerpc/boot/Makefile:
>
> ifdef CONFIG_PPC64_BOOT_WRAPPER
> ifdef CONFIG_CPU_LITTLE_ENDIAN
> BOOTCFLAGS += -m64 -mcpu=powerpc64le
> else
> BOOTCFLAGS += -m64 -mcpu=powerpc64
> endif
> else
> BOOTCFLAGS += -m32 -mcpu=powerpc
> endif
>
> It cause compile error:
>
> make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnuspe- mpc85xx_smp_defconfig uImage
> ...
> BOOTAS arch/powerpc/boot/crt0.o
> powerpc-linux-gnuspe-gcc: error: unrecognized argument in option ‘-mcpu=powerpc’
> powerpc-linux-gnuspe-gcc: note: valid arguments to ‘-mcpu=’ are: 8540 8548 native
> make[1]: *** [arch/powerpc/boot/Makefile:231: arch/powerpc/boot/crt0.o] Error 1
Now I have sent patch for this issue:
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20220820105200.30425-1-pali@kernel.org/
> > Reported-by: Pali Rohár <pali@kernel.org>
> > Tested-by: Pali Rohár <pali@kernel.org>
> > Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> > Cc: Segher Boessenkool <segher@kernel.crashing.org>
> > Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> > ---
> > arch/powerpc/Makefile | 26 +-------------------------
> > arch/powerpc/platforms/Kconfig.cputype | 21 ++++++++++++++++++---
> > 2 files changed, 19 insertions(+), 28 deletions(-)
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 2/5] powerpc/32: Don't always pass -mcpu=powerpc to the compiler
@ 2022-08-20 10:55 ` Pali Rohár
0 siblings, 0 replies; 33+ messages in thread
From: Pali Rohár @ 2022-08-20 10:55 UTC (permalink / raw)
To: Christophe Leroy
Cc: Arnd Bergmann, linux-kernel, Nicholas Piggin, linuxppc-dev
On Thursday 18 August 2022 19:46:34 Pali Rohár wrote:
> On Monday 11 July 2022 16:19:30 Christophe Leroy wrote:
> > Since commit 4bf4f42a2feb ("powerpc/kbuild: Set default generic
> > machine type for 32-bit compile"), when building a 32 bits kernel
> > with a bi-arch version of GCC, or when building a book3s/32 kernel,
> > the option -mcpu=powerpc is passed to GCC at all time, relying on it
> > being eventually overriden by a subsequent -mcpu=xxxx.
> >
> > But when building the same kernel with a 32 bits only version of GCC,
> > that is not done, relying on gcc being built with the expected default
> > CPU.
> >
> > This logic has two problems. First, it is a bit fragile to rely on
> > whether the GCC version is bi-arch or not, because today we can have
> > bi-arch versions of GCC configured with a 32 bits default. Second,
> > there are some versions of GCC which don't support -mcpu=powerpc,
> > for instance for e500 SPE-only versions.
> >
> > So, stop relying on this approximative logic and allow the user to
> > decide whether he/she wants to use the toolchain's default CPU or if
> > he/she wants to set one, and allow only possible CPUs based on the
> > selected target.
>
> Hello! Exactly same issue is still in file arch/powerpc/boot/Makefile:
>
> ifdef CONFIG_PPC64_BOOT_WRAPPER
> ifdef CONFIG_CPU_LITTLE_ENDIAN
> BOOTCFLAGS += -m64 -mcpu=powerpc64le
> else
> BOOTCFLAGS += -m64 -mcpu=powerpc64
> endif
> else
> BOOTCFLAGS += -m32 -mcpu=powerpc
> endif
>
> It cause compile error:
>
> make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnuspe- mpc85xx_smp_defconfig uImage
> ...
> BOOTAS arch/powerpc/boot/crt0.o
> powerpc-linux-gnuspe-gcc: error: unrecognized argument in option ‘-mcpu=powerpc’
> powerpc-linux-gnuspe-gcc: note: valid arguments to ‘-mcpu=’ are: 8540 8548 native
> make[1]: *** [arch/powerpc/boot/Makefile:231: arch/powerpc/boot/crt0.o] Error 1
Now I have sent patch for this issue:
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20220820105200.30425-1-pali@kernel.org/
> > Reported-by: Pali Rohár <pali@kernel.org>
> > Tested-by: Pali Rohár <pali@kernel.org>
> > Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> > Cc: Segher Boessenkool <segher@kernel.crashing.org>
> > Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> > ---
> > arch/powerpc/Makefile | 26 +-------------------------
> > arch/powerpc/platforms/Kconfig.cputype | 21 ++++++++++++++++++---
> > 2 files changed, 19 insertions(+), 28 deletions(-)
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 5/5] powerpc/64e: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
2022-07-11 14:19 ` Christophe Leroy
@ 2022-12-11 17:32 ` Pali Rohár
-1 siblings, 0 replies; 33+ messages in thread
From: Pali Rohár @ 2022-12-11 17:32 UTC (permalink / raw)
To: Christophe Leroy
Cc: Michael Ellerman, Nicholas Piggin, linux-kernel, linuxppc-dev
On Monday 11 July 2022 16:19:33 Christophe Leroy wrote:
> With GCC 12, corenet64_smp_defconfig leads to the following build errors:
>
> CC arch/powerpc/kernel/irq.o
> {standard input}: Assembler messages:
> {standard input}:3616: Error: unrecognized opcode: `wrteei'
> {standard input}:5689: Error: unrecognized opcode: `wrteei'
> CC arch/powerpc/kernel/pmc.o
> {standard input}: Assembler messages:
> {standard input}:42: Error: unrecognized opcode: `mfpmr'
> {standard input}:53: Error: unrecognized opcode: `mtpmr'
> CC arch/powerpc/kernel/io.o
> {standard input}: Assembler messages:
> {standard input}:376: Error: unrecognized opcode: `mbar'
> ...
> CC arch/powerpc/mm/nohash/book3e_hugetlbpage.o
> {standard input}: Assembler messages:
> {standard input}:291: Error: unrecognized opcode: `tlbsx'
> {standard input}:482: Error: unrecognized opcode: `tlbwe'
> {standard input}:608: Error: unrecognized opcode: `lbarx'
> {standard input}:608: Error: unrecognized opcode: `stbcx.'
>
> -mpcu=powerpc64 cannot be used anymore for book3e, it must be a booke CPU.
>
> But then we get:
>
> CC arch/powerpc/lib/xor_vmx.o
> cc1: error: AltiVec not supported in this target
>
> Altivec is not supported with -mcpu=e5500 so don't allow selection
> of altivec when e5500 is selected.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> arch/powerpc/Makefile | 8 +-------
> arch/powerpc/platforms/Kconfig.cputype | 8 ++++----
> 2 files changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index d54e1fe03551..02742facf895 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -168,13 +168,7 @@ endif
> CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
> AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
>
> -# Altivec option not allowed with e500mc64 in GCC.
> -ifdef CONFIG_ALTIVEC
> -E5500_CPU := -mcpu=powerpc64
> -else
> -E5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
> -endif
> -CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
> +CFLAGS-$(CONFIG_E5500_CPU) += $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
> CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
Hello! I think that there is an issue. After removal of E5500_CPU
variable few line above, it cannot be used in CFLAGS-$(CONFIG_E6500_CPU)
assignment, because it is empty.
>
> asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
> diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
> index 3cc8452b8660..5185d942b455 100644
> --- a/arch/powerpc/platforms/Kconfig.cputype
> +++ b/arch/powerpc/platforms/Kconfig.cputype
> @@ -126,12 +126,12 @@ choice
>
> config GENERIC_CPU
> bool "Generic (POWER4 and above)"
> - depends on PPC64 && !CPU_LITTLE_ENDIAN
> - select PPC_64S_HASH_MMU if PPC_BOOK3S_64
> + depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
> + select PPC_64S_HASH_MMU
>
> config GENERIC_CPU
> bool "Generic (POWER8 and above)"
> - depends on PPC64 && CPU_LITTLE_ENDIAN
> + depends on PPC_BOOK3S_64 && CPU_LITTLE_ENDIAN
> select ARCH_HAS_FAST_MULTIPLIER
> select PPC_64S_HASH_MMU
>
> @@ -358,7 +358,7 @@ config PHYS_64BIT
>
> config ALTIVEC
> bool "AltiVec Support"
> - depends on PPC_BOOK3S_32 || PPC_BOOK3S_64 || (PPC_E500MC && PPC64)
> + depends on PPC_BOOK3S || (PPC_E500MC && PPC64 && !E5500_CPU)
> select PPC_FPU
> help
> This option enables kernel support for the Altivec extensions to the
> --
> 2.36.1
>
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 5/5] powerpc/64e: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
@ 2022-12-11 17:32 ` Pali Rohár
0 siblings, 0 replies; 33+ messages in thread
From: Pali Rohár @ 2022-12-11 17:32 UTC (permalink / raw)
To: Christophe Leroy; +Cc: linuxppc-dev, linux-kernel, Nicholas Piggin
On Monday 11 July 2022 16:19:33 Christophe Leroy wrote:
> With GCC 12, corenet64_smp_defconfig leads to the following build errors:
>
> CC arch/powerpc/kernel/irq.o
> {standard input}: Assembler messages:
> {standard input}:3616: Error: unrecognized opcode: `wrteei'
> {standard input}:5689: Error: unrecognized opcode: `wrteei'
> CC arch/powerpc/kernel/pmc.o
> {standard input}: Assembler messages:
> {standard input}:42: Error: unrecognized opcode: `mfpmr'
> {standard input}:53: Error: unrecognized opcode: `mtpmr'
> CC arch/powerpc/kernel/io.o
> {standard input}: Assembler messages:
> {standard input}:376: Error: unrecognized opcode: `mbar'
> ...
> CC arch/powerpc/mm/nohash/book3e_hugetlbpage.o
> {standard input}: Assembler messages:
> {standard input}:291: Error: unrecognized opcode: `tlbsx'
> {standard input}:482: Error: unrecognized opcode: `tlbwe'
> {standard input}:608: Error: unrecognized opcode: `lbarx'
> {standard input}:608: Error: unrecognized opcode: `stbcx.'
>
> -mpcu=powerpc64 cannot be used anymore for book3e, it must be a booke CPU.
>
> But then we get:
>
> CC arch/powerpc/lib/xor_vmx.o
> cc1: error: AltiVec not supported in this target
>
> Altivec is not supported with -mcpu=e5500 so don't allow selection
> of altivec when e5500 is selected.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> arch/powerpc/Makefile | 8 +-------
> arch/powerpc/platforms/Kconfig.cputype | 8 ++++----
> 2 files changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index d54e1fe03551..02742facf895 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -168,13 +168,7 @@ endif
> CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
> AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
>
> -# Altivec option not allowed with e500mc64 in GCC.
> -ifdef CONFIG_ALTIVEC
> -E5500_CPU := -mcpu=powerpc64
> -else
> -E5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
> -endif
> -CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
> +CFLAGS-$(CONFIG_E5500_CPU) += $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
> CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
Hello! I think that there is an issue. After removal of E5500_CPU
variable few line above, it cannot be used in CFLAGS-$(CONFIG_E6500_CPU)
assignment, because it is empty.
>
> asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
> diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
> index 3cc8452b8660..5185d942b455 100644
> --- a/arch/powerpc/platforms/Kconfig.cputype
> +++ b/arch/powerpc/platforms/Kconfig.cputype
> @@ -126,12 +126,12 @@ choice
>
> config GENERIC_CPU
> bool "Generic (POWER4 and above)"
> - depends on PPC64 && !CPU_LITTLE_ENDIAN
> - select PPC_64S_HASH_MMU if PPC_BOOK3S_64
> + depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
> + select PPC_64S_HASH_MMU
>
> config GENERIC_CPU
> bool "Generic (POWER8 and above)"
> - depends on PPC64 && CPU_LITTLE_ENDIAN
> + depends on PPC_BOOK3S_64 && CPU_LITTLE_ENDIAN
> select ARCH_HAS_FAST_MULTIPLIER
> select PPC_64S_HASH_MMU
>
> @@ -358,7 +358,7 @@ config PHYS_64BIT
>
> config ALTIVEC
> bool "AltiVec Support"
> - depends on PPC_BOOK3S_32 || PPC_BOOK3S_64 || (PPC_E500MC && PPC64)
> + depends on PPC_BOOK3S || (PPC_E500MC && PPC64 && !E5500_CPU)
> select PPC_FPU
> help
> This option enables kernel support for the Altivec extensions to the
> --
> 2.36.1
>
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 5/5] powerpc/64e: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
2022-12-11 17:32 ` Pali Rohár
@ 2022-12-12 7:36 ` Christophe Leroy
-1 siblings, 0 replies; 33+ messages in thread
From: Christophe Leroy @ 2022-12-12 7:36 UTC (permalink / raw)
To: Pali Rohár, Michael Ellerman
Cc: Nicholas Piggin, linux-kernel, linuxppc-dev
Le 11/12/2022 à 18:32, Pali Rohár a écrit :
> On Monday 11 July 2022 16:19:33 Christophe Leroy wrote:
>> With GCC 12, corenet64_smp_defconfig leads to the following build errors:
>>
>> CC arch/powerpc/kernel/irq.o
>> {standard input}: Assembler messages:
>> {standard input}:3616: Error: unrecognized opcode: `wrteei'
>> {standard input}:5689: Error: unrecognized opcode: `wrteei'
>> CC arch/powerpc/kernel/pmc.o
>> {standard input}: Assembler messages:
>> {standard input}:42: Error: unrecognized opcode: `mfpmr'
>> {standard input}:53: Error: unrecognized opcode: `mtpmr'
>> CC arch/powerpc/kernel/io.o
>> {standard input}: Assembler messages:
>> {standard input}:376: Error: unrecognized opcode: `mbar'
>> ...
>> CC arch/powerpc/mm/nohash/book3e_hugetlbpage.o
>> {standard input}: Assembler messages:
>> {standard input}:291: Error: unrecognized opcode: `tlbsx'
>> {standard input}:482: Error: unrecognized opcode: `tlbwe'
>> {standard input}:608: Error: unrecognized opcode: `lbarx'
>> {standard input}:608: Error: unrecognized opcode: `stbcx.'
>>
>> -mpcu=powerpc64 cannot be used anymore for book3e, it must be a booke CPU.
>>
>> But then we get:
>>
>> CC arch/powerpc/lib/xor_vmx.o
>> cc1: error: AltiVec not supported in this target
>>
>> Altivec is not supported with -mcpu=e5500 so don't allow selection
>> of altivec when e5500 is selected.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> ---
>> arch/powerpc/Makefile | 8 +-------
>> arch/powerpc/platforms/Kconfig.cputype | 8 ++++----
>> 2 files changed, 5 insertions(+), 11 deletions(-)
>>
>> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
>> index d54e1fe03551..02742facf895 100644
>> --- a/arch/powerpc/Makefile
>> +++ b/arch/powerpc/Makefile
>> @@ -168,13 +168,7 @@ endif
>> CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
>> AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
>>
>> -# Altivec option not allowed with e500mc64 in GCC.
>> -ifdef CONFIG_ALTIVEC
>> -E5500_CPU := -mcpu=powerpc64
>> -else
>> -E5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
>> -endif
>> -CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
>> +CFLAGS-$(CONFIG_E5500_CPU) += $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
>> CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
>
> Hello! I think that there is an issue. After removal of E5500_CPU
> variable few line above, it cannot be used in CFLAGS-$(CONFIG_E6500_CPU)
> assignment, because it is empty.
>
Ah yes, you are right.
It should be fixed by
https://github.com/linuxppc/linux/commit/f2636eaac7dee1d7d096cc115ff4f5111b0c508c
Michael, I see the patch is in next-test. Can you add:
Fixes: d6b551b8f90c ("powerpc/64e: Fix build failure with GCC 12
(unrecognized opcode: `wrteei')")
Thanks
Christophe
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 5/5] powerpc/64e: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
@ 2022-12-12 7:36 ` Christophe Leroy
0 siblings, 0 replies; 33+ messages in thread
From: Christophe Leroy @ 2022-12-12 7:36 UTC (permalink / raw)
To: Pali Rohár, Michael Ellerman
Cc: linuxppc-dev, linux-kernel, Nicholas Piggin
Le 11/12/2022 à 18:32, Pali Rohár a écrit :
> On Monday 11 July 2022 16:19:33 Christophe Leroy wrote:
>> With GCC 12, corenet64_smp_defconfig leads to the following build errors:
>>
>> CC arch/powerpc/kernel/irq.o
>> {standard input}: Assembler messages:
>> {standard input}:3616: Error: unrecognized opcode: `wrteei'
>> {standard input}:5689: Error: unrecognized opcode: `wrteei'
>> CC arch/powerpc/kernel/pmc.o
>> {standard input}: Assembler messages:
>> {standard input}:42: Error: unrecognized opcode: `mfpmr'
>> {standard input}:53: Error: unrecognized opcode: `mtpmr'
>> CC arch/powerpc/kernel/io.o
>> {standard input}: Assembler messages:
>> {standard input}:376: Error: unrecognized opcode: `mbar'
>> ...
>> CC arch/powerpc/mm/nohash/book3e_hugetlbpage.o
>> {standard input}: Assembler messages:
>> {standard input}:291: Error: unrecognized opcode: `tlbsx'
>> {standard input}:482: Error: unrecognized opcode: `tlbwe'
>> {standard input}:608: Error: unrecognized opcode: `lbarx'
>> {standard input}:608: Error: unrecognized opcode: `stbcx.'
>>
>> -mpcu=powerpc64 cannot be used anymore for book3e, it must be a booke CPU.
>>
>> But then we get:
>>
>> CC arch/powerpc/lib/xor_vmx.o
>> cc1: error: AltiVec not supported in this target
>>
>> Altivec is not supported with -mcpu=e5500 so don't allow selection
>> of altivec when e5500 is selected.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> ---
>> arch/powerpc/Makefile | 8 +-------
>> arch/powerpc/platforms/Kconfig.cputype | 8 ++++----
>> 2 files changed, 5 insertions(+), 11 deletions(-)
>>
>> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
>> index d54e1fe03551..02742facf895 100644
>> --- a/arch/powerpc/Makefile
>> +++ b/arch/powerpc/Makefile
>> @@ -168,13 +168,7 @@ endif
>> CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
>> AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
>>
>> -# Altivec option not allowed with e500mc64 in GCC.
>> -ifdef CONFIG_ALTIVEC
>> -E5500_CPU := -mcpu=powerpc64
>> -else
>> -E5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
>> -endif
>> -CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
>> +CFLAGS-$(CONFIG_E5500_CPU) += $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
>> CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
>
> Hello! I think that there is an issue. After removal of E5500_CPU
> variable few line above, it cannot be used in CFLAGS-$(CONFIG_E6500_CPU)
> assignment, because it is empty.
>
Ah yes, you are right.
It should be fixed by
https://github.com/linuxppc/linux/commit/f2636eaac7dee1d7d096cc115ff4f5111b0c508c
Michael, I see the patch is in next-test. Can you add:
Fixes: d6b551b8f90c ("powerpc/64e: Fix build failure with GCC 12
(unrecognized opcode: `wrteei')")
Thanks
Christophe
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 5/5] powerpc/64e: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
2022-12-12 7:36 ` Christophe Leroy
@ 2022-12-12 10:27 ` Michael Ellerman
-1 siblings, 0 replies; 33+ messages in thread
From: Michael Ellerman @ 2022-12-12 10:27 UTC (permalink / raw)
To: Christophe Leroy, Pali Rohár
Cc: linuxppc-dev, linux-kernel, Nicholas Piggin
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 11/12/2022 à 18:32, Pali Rohár a écrit :
>> On Monday 11 July 2022 16:19:33 Christophe Leroy wrote:
>>> With GCC 12, corenet64_smp_defconfig leads to the following build errors:
>>>
>>> CC arch/powerpc/kernel/irq.o
>>> {standard input}: Assembler messages:
>>> {standard input}:3616: Error: unrecognized opcode: `wrteei'
>>> {standard input}:5689: Error: unrecognized opcode: `wrteei'
>>> CC arch/powerpc/kernel/pmc.o
>>> {standard input}: Assembler messages:
>>> {standard input}:42: Error: unrecognized opcode: `mfpmr'
>>> {standard input}:53: Error: unrecognized opcode: `mtpmr'
>>> CC arch/powerpc/kernel/io.o
>>> {standard input}: Assembler messages:
>>> {standard input}:376: Error: unrecognized opcode: `mbar'
>>> ...
>>> CC arch/powerpc/mm/nohash/book3e_hugetlbpage.o
>>> {standard input}: Assembler messages:
>>> {standard input}:291: Error: unrecognized opcode: `tlbsx'
>>> {standard input}:482: Error: unrecognized opcode: `tlbwe'
>>> {standard input}:608: Error: unrecognized opcode: `lbarx'
>>> {standard input}:608: Error: unrecognized opcode: `stbcx.'
>>>
>>> -mpcu=powerpc64 cannot be used anymore for book3e, it must be a booke CPU.
>>>
>>> But then we get:
>>>
>>> CC arch/powerpc/lib/xor_vmx.o
>>> cc1: error: AltiVec not supported in this target
>>>
>>> Altivec is not supported with -mcpu=e5500 so don't allow selection
>>> of altivec when e5500 is selected.
>>>
>>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>>> ---
>>> arch/powerpc/Makefile | 8 +-------
>>> arch/powerpc/platforms/Kconfig.cputype | 8 ++++----
>>> 2 files changed, 5 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
>>> index d54e1fe03551..02742facf895 100644
>>> --- a/arch/powerpc/Makefile
>>> +++ b/arch/powerpc/Makefile
>>> @@ -168,13 +168,7 @@ endif
>>> CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
>>> AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
>>>
>>> -# Altivec option not allowed with e500mc64 in GCC.
>>> -ifdef CONFIG_ALTIVEC
>>> -E5500_CPU := -mcpu=powerpc64
>>> -else
>>> -E5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
>>> -endif
>>> -CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
>>> +CFLAGS-$(CONFIG_E5500_CPU) += $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
>>> CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
>>
>> Hello! I think that there is an issue. After removal of E5500_CPU
>> variable few line above, it cannot be used in CFLAGS-$(CONFIG_E6500_CPU)
>> assignment, because it is empty.
>>
>
> Ah yes, you are right.
>
> It should be fixed by
> https://github.com/linuxppc/linux/commit/f2636eaac7dee1d7d096cc115ff4f5111b0c508c
>
> Michael, I see the patch is in next-test. Can you add:
>
> Fixes: d6b551b8f90c ("powerpc/64e: Fix build failure with GCC 12
> (unrecognized opcode: `wrteei')")
Yep, will do.
cheers
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v1 5/5] powerpc/64e: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
@ 2022-12-12 10:27 ` Michael Ellerman
0 siblings, 0 replies; 33+ messages in thread
From: Michael Ellerman @ 2022-12-12 10:27 UTC (permalink / raw)
To: Christophe Leroy, Pali Rohár
Cc: Nicholas Piggin, linux-kernel, linuxppc-dev
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 11/12/2022 à 18:32, Pali Rohár a écrit :
>> On Monday 11 July 2022 16:19:33 Christophe Leroy wrote:
>>> With GCC 12, corenet64_smp_defconfig leads to the following build errors:
>>>
>>> CC arch/powerpc/kernel/irq.o
>>> {standard input}: Assembler messages:
>>> {standard input}:3616: Error: unrecognized opcode: `wrteei'
>>> {standard input}:5689: Error: unrecognized opcode: `wrteei'
>>> CC arch/powerpc/kernel/pmc.o
>>> {standard input}: Assembler messages:
>>> {standard input}:42: Error: unrecognized opcode: `mfpmr'
>>> {standard input}:53: Error: unrecognized opcode: `mtpmr'
>>> CC arch/powerpc/kernel/io.o
>>> {standard input}: Assembler messages:
>>> {standard input}:376: Error: unrecognized opcode: `mbar'
>>> ...
>>> CC arch/powerpc/mm/nohash/book3e_hugetlbpage.o
>>> {standard input}: Assembler messages:
>>> {standard input}:291: Error: unrecognized opcode: `tlbsx'
>>> {standard input}:482: Error: unrecognized opcode: `tlbwe'
>>> {standard input}:608: Error: unrecognized opcode: `lbarx'
>>> {standard input}:608: Error: unrecognized opcode: `stbcx.'
>>>
>>> -mpcu=powerpc64 cannot be used anymore for book3e, it must be a booke CPU.
>>>
>>> But then we get:
>>>
>>> CC arch/powerpc/lib/xor_vmx.o
>>> cc1: error: AltiVec not supported in this target
>>>
>>> Altivec is not supported with -mcpu=e5500 so don't allow selection
>>> of altivec when e5500 is selected.
>>>
>>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>>> ---
>>> arch/powerpc/Makefile | 8 +-------
>>> arch/powerpc/platforms/Kconfig.cputype | 8 ++++----
>>> 2 files changed, 5 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
>>> index d54e1fe03551..02742facf895 100644
>>> --- a/arch/powerpc/Makefile
>>> +++ b/arch/powerpc/Makefile
>>> @@ -168,13 +168,7 @@ endif
>>> CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
>>> AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
>>>
>>> -# Altivec option not allowed with e500mc64 in GCC.
>>> -ifdef CONFIG_ALTIVEC
>>> -E5500_CPU := -mcpu=powerpc64
>>> -else
>>> -E5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
>>> -endif
>>> -CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
>>> +CFLAGS-$(CONFIG_E5500_CPU) += $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
>>> CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
>>
>> Hello! I think that there is an issue. After removal of E5500_CPU
>> variable few line above, it cannot be used in CFLAGS-$(CONFIG_E6500_CPU)
>> assignment, because it is empty.
>>
>
> Ah yes, you are right.
>
> It should be fixed by
> https://github.com/linuxppc/linux/commit/f2636eaac7dee1d7d096cc115ff4f5111b0c508c
>
> Michael, I see the patch is in next-test. Can you add:
>
> Fixes: d6b551b8f90c ("powerpc/64e: Fix build failure with GCC 12
> (unrecognized opcode: `wrteei')")
Yep, will do.
cheers
^ permalink raw reply [flat|nested] 33+ messages in thread
end of thread, other threads:[~2022-12-12 10:30 UTC | newest]
Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-11 14:19 [PATCH v1 1/5] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32 Christophe Leroy
2022-07-11 14:19 ` Christophe Leroy
2022-07-11 14:19 ` [PATCH v1 2/5] powerpc/32: Don't always pass -mcpu=powerpc to the compiler Christophe Leroy
2022-07-11 14:19 ` Christophe Leroy
2022-07-11 16:50 ` Segher Boessenkool
2022-07-11 16:50 ` Segher Boessenkool
2022-08-18 17:46 ` Pali Rohár
2022-08-18 17:46 ` Pali Rohár
2022-08-20 10:55 ` Pali Rohár
2022-08-20 10:55 ` Pali Rohár
2022-07-11 14:19 ` [PATCH v1 3/5] powerpc/405: Fix build failure with GCC 12 (unrecognized opcode: `wrteei') Christophe Leroy
2022-07-11 14:19 ` Christophe Leroy
2022-07-11 14:19 ` [PATCH v1 4/5] powerpc/44x: " Christophe Leroy
2022-07-11 14:19 ` Christophe Leroy
2022-07-11 15:05 ` Arnd Bergmann
2022-07-11 15:05 ` Arnd Bergmann
2022-07-11 15:49 ` Christophe Leroy
2022-07-11 15:49 ` Christophe Leroy
2022-07-11 17:12 ` Segher Boessenkool
2022-07-11 17:12 ` Segher Boessenkool
2022-07-11 14:19 ` [PATCH v1 5/5] powerpc/64e: " Christophe Leroy
2022-07-11 14:19 ` Christophe Leroy
2022-12-11 17:32 ` Pali Rohár
2022-12-11 17:32 ` Pali Rohár
2022-12-12 7:36 ` Christophe Leroy
2022-12-12 7:36 ` Christophe Leroy
2022-12-12 10:27 ` Michael Ellerman
2022-12-12 10:27 ` Michael Ellerman
2022-07-11 16:39 ` [PATCH v1 1/5] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32 Segher Boessenkool
2022-07-11 16:39 ` Segher Boessenkool
2022-07-11 17:42 ` Christophe Leroy
2022-07-11 17:42 ` Christophe Leroy
2022-07-29 13:02 ` Michael Ellerman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.