2022-07-11 14:54:15

by Christophe Leroy

[permalink] [raw]
Subject: [PATCH v1 1/5] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32

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 <[email protected]>
---
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


2022-07-11 17:42:06

by Segher Boessenkool

[permalink] [raw]
Subject: Re: [PATCH v1 1/5] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32

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

2022-07-11 17:50:26

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH v1 1/5] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32



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

2022-07-29 13:52:27

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH v1 1/5] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32

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