Skip to contentSkip to conversation

powerpc: unify two CONFIG_POWERPC64_CPU entries in the same choice block

PATCH Applied Masahiro Yamada 4 participants 5 messages Jun 7, 2025 – Aug 28, 2025 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: unify two CONFIG_POWERPC64_CPU entries in the same choice block

There are two CONFIG_POWERPC64_CPU entries in the "CPU selection" choice block.

I guess the intent is to display a different prompt depending on
CPU_LITTLE_ENDIAN: "Generic (POWER5 and PowerPC 970 and above)" for big endian, and "Generic (POWER8 and above)" for little endian.

I stumbled on this tricky use case, and worked around it on Kconfig with commit 4d46b5b623e0 ("kconfig: fix infinite loop in sym_calc_choice()"). However, I doubt that supporting multiple entries with the same symbol in a choice block is worth the complexity - this is the only such case in the kernel tree.

This commit merges the two entries. Once this cleanup is accepted in the powerpc subsystem, I will proceed to refactor the Kconfig parser.

---

 arch/powerpc/platforms/Kconfig.cputype | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
arch/powerpc/platforms/Kconfig.cputype +4 -9
index 613b383ed8b3..7b527d18aa5e 100644
@@ -122,16 +122,11 @@ choice
 	  If unsure, select Generic.
 
 config POWERPC64_CPU
-	bool "Generic (POWER5 and PowerPC 970 and above)"
-	depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
+	bool "Generic 64 bits powerpc"
+	depends on PPC_BOOK3S_64
+	select ARCH_HAS_FAST_MULTIPLIER if CPU_LITTLE_ENDIAN
 	select PPC_64S_HASH_MMU
-
-config POWERPC64_CPU
-	bool "Generic (POWER8 and above)"
-	depends on PPC_BOOK3S_64 && CPU_LITTLE_ENDIAN
-	select ARCH_HAS_FAST_MULTIPLIER
-	select PPC_64S_HASH_MMU
-	select PPC_HAS_LBARX_LHARX
+	select PPC_HAS_LBARX_LHARX if CPU_LITTLE_ENDIAN
 
 config POWERPC_CPU
 	bool "Generic 32 bits powerpc"
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw

Le 07/06/2025 à 12:13, Masahiro Yamada a écrit :

Quoted 13 lines

There are two CONFIG_POWERPC64_CPU entries in the "CPU selection" choice block.

I guess the intent is to display a different prompt depending on
CPU_LITTLE_ENDIAN: "Generic (POWER5 and PowerPC 970 and above)" for big endian, and "Generic (POWER8 and above)" for little endian.

I stumbled on this tricky use case, and worked around it on Kconfig with commit 4d46b5b623e0 ("kconfig: fix infinite loop in sym_calc_choice()"). However, I doubt that supporting multiple entries with the same symbol in a choice block is worth the complexity - this is the only such case in the kernel tree.

Quoted 4 lines

This commit merges the two entries. Once this cleanup is accepted in the powerpc subsystem, I will proceed to refactor the Kconfig parser.

Quoted 30 lines

---

  arch/powerpc/platforms/Kconfig.cputype | 13 ++++---------
  1 file changed, 4 insertions(+), 9 deletions(-)
arch/powerpc/platforms/Kconfig.cputype +4 -9
index 613b383ed8b3..7b527d18aa5e 100644
@@ -122,16 +122,11 @@ choice
  	  If unsure, select Generic.
 
  config POWERPC64_CPU
-	bool "Generic (POWER5 and PowerPC 970 and above)"
-	depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
+	bool "Generic 64 bits powerpc"
+	depends on PPC_BOOK3S_64
+	select ARCH_HAS_FAST_MULTIPLIER if CPU_LITTLE_ENDIAN
  	select PPC_64S_HASH_MMU
-
-config POWERPC64_CPU
-	bool "Generic (POWER8 and above)"
-	depends on PPC_BOOK3S_64 && CPU_LITTLE_ENDIAN
-	select ARCH_HAS_FAST_MULTIPLIER
-	select PPC_64S_HASH_MMU
-	select PPC_HAS_LBARX_LHARX
+	select PPC_HAS_LBARX_LHARX if CPU_LITTLE_ENDIAN
 
  config POWERPC_CPU
  	bool "Generic 32 bits powerpc"
reviewer Acked-by on v1 1/1
#2 lore raw
In reply to Masahiro Yamada
Quoted 6 lines · Masahiro Yamada

There are two CONFIG_POWERPC64_CPU entries in the "CPU selection" choice block.

I guess the intent is to display a different prompt depending on
CPU_LITTLE_ENDIAN: "Generic (POWER5 and PowerPC 970 and above)" for big endian, and "Generic (POWER8 and above)" for little endian.

Yeah.

Quoted 8 lines

I stumbled on this tricky use case, and worked around it on Kconfig with commit 4d46b5b623e0 ("kconfig: fix infinite loop in sym_calc_choice()"). However, I doubt that supporting multiple entries with the same symbol in a choice block is worth the complexity - this is the only such case in the kernel tree.

This commit merges the two entries. Once this cleanup is accepted in the powerpc subsystem, I will proceed to refactor the Kconfig parser.

OK. Sorry for the trouble.

It could be split into two symbols to keep the separate prompts, but it's probably not worth the trouble.

cheers

Quoted 27 lines
arch/powerpc/platforms/Kconfig.cputype +4 -9
index 613b383ed8b3..7b527d18aa5e 100644
@@ -122,16 +122,11 @@ choice
 	  If unsure, select Generic.
 
 config POWERPC64_CPU
-	bool "Generic (POWER5 and PowerPC 970 and above)"
-	depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
+	bool "Generic 64 bits powerpc"
+	depends on PPC_BOOK3S_64
+	select ARCH_HAS_FAST_MULTIPLIER if CPU_LITTLE_ENDIAN
 	select PPC_64S_HASH_MMU
-
-config POWERPC64_CPU
-	bool "Generic (POWER8 and above)"
-	depends on PPC_BOOK3S_64 && CPU_LITTLE_ENDIAN
-	select ARCH_HAS_FAST_MULTIPLIER
-	select PPC_64S_HASH_MMU
-	select PPC_HAS_LBARX_LHARX
+	select PPC_HAS_LBARX_LHARX if CPU_LITTLE_ENDIAN
 
 config POWERPC_CPU
 	bool "Generic 32 bits powerpc"
Signature · 1 line
2.43.0
#3 lore raw
Quoted 20 lines · Michael Ellerman
Quoted 6 lines · Masahiro Yamada

There are two CONFIG_POWERPC64_CPU entries in the "CPU selection" choice block.

I guess the intent is to display a different prompt depending on
CPU_LITTLE_ENDIAN: "Generic (POWER5 and PowerPC 970 and above)" for big endian, and "Generic (POWER8 and above)" for little endian.

Yeah.

Quoted 8 lines

I stumbled on this tricky use case, and worked around it on Kconfig with commit 4d46b5b623e0 ("kconfig: fix infinite loop in sym_calc_choice()"). However, I doubt that supporting multiple entries with the same symbol in a choice block is worth the complexity - this is the only such case in the kernel tree.

This commit merges the two entries. Once this cleanup is accepted in the powerpc subsystem, I will proceed to refactor the Kconfig parser.

Quoted 6 lines

OK. Sorry for the trouble.

It could be split into two symbols to keep the separate prompts, but it's probably not worth the trouble.

No rush for this patch.
Please take it to your ppc tree.
Thank you.

Best Regards
Masahiro Yamada

maintainer Applied
#4 lore raw
In reply to Masahiro Yamada
Quoted 8 lines · Masahiro Yamada

There are two CONFIG_POWERPC64_CPU entries in the "CPU selection" choice block.

I guess the intent is to display a different prompt depending on
CPU_LITTLE_ENDIAN: "Generic (POWER5 and PowerPC 970 and above)" for big endian, and "Generic (POWER8 and above)" for little endian.

[...]

Applied to powerpc/fixes.

[1/1] powerpc: unify two CONFIG_POWERPC64_CPU entries in the same choice block

      https://git.kernel.org/powerpc/c/6a859f1a19d1f8756ffb097f5973dfebbca4811a

Thanks