Skip to contentSkip to conversation

powerpc: Kconfig: remove BE-only platforms from LE kernel build

PATCH Applied Boqun Feng 3 participants 9 messages Sep 6, 2015 – Oct 2, 2015

Subsystems (4)
lore
Share & tools
lore

Boqun Feng

author
#0 lore raw

PATCH 1/1 powerpc: Kconfig: remove BE-only platforms from LE kernel build

Currently, little endian is only supported on powernv and pseries, however, Kconfigs still allow us to include other platforms in a LE kernel, this may result in space wasting or even build error if some BE-only platforms always assume they are built for a BE kernel. So just modify the Kconfigs of BE-only platforms to remove them from being built for a LE kernel.

For 32bit only platforms, nothing needs to be done, because CPU_LITTLE_ENDIAN depends on PPC64. For 64bit supported platforms, add CPU_BIG_ENDIAN to dependencies explicitly, so that these platforms will be disabled for LE [Suggested-by: Cédric Le Goater <[email protected]>].

---
 arch/powerpc/platforms/cell/Kconfig     | 4 ++--
 arch/powerpc/platforms/maple/Kconfig    | 2 +-
 arch/powerpc/platforms/pasemi/Kconfig   | 2 +-
 arch/powerpc/platforms/powermac/Kconfig | 2 +-
 arch/powerpc/platforms/ps3/Kconfig      | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/platforms/cell/Kconfig +2 -2
index 2f23133..808a904 100644
@@ -25,7 +25,7 @@ config PPC_CELL_NATIVE
 
 config PPC_IBM_CELL_BLADE
 	bool "IBM Cell Blade"
-	depends on PPC64 && PPC_BOOK3S
+	depends on PPC64 && PPC_BOOK3S && CPU_BIG_ENDIAN
 	select PPC_CELL_NATIVE
 	select PPC_OF_PLATFORM_PCI
 	select PCI
@@ -35,7 +35,7 @@ config PPC_IBM_CELL_BLADE
 
 config PPC_CELL_QPACE
 	bool "IBM Cell - QPACE"
-	depends on PPC64 && PPC_BOOK3S
+	depends on PPC64 && PPC_BOOK3S && CPU_BIG_ENDIAN
 	select PPC_CELL_COMMON
 
 config AXON_MSI
arch/powerpc/platforms/maple/Kconfig +1 -1
index 1ea621a..e359d0d 100644
@@ -1,5 +1,5 @@
 config PPC_MAPLE
-	depends on PPC64 && PPC_BOOK3S
+	depends on PPC64 && PPC_BOOK3S && CPU_BIG_ENDIAN
 	bool "Maple 970FX Evaluation Board"
 	select PCI
 	select MPIC
arch/powerpc/platforms/pasemi/Kconfig +1 -1
index a2aeb32..00d4b28 100644
@@ -1,5 +1,5 @@
 config PPC_PASEMI
-	depends on PPC64 && PPC_BOOK3S
+	depends on PPC64 && PPC_BOOK3S && CPU_BIG_ENDIAN
 	bool "PA Semi SoC-based platforms"
 	default n
 	select MPIC
arch/powerpc/platforms/powermac/Kconfig +1 -1
index 607124b..43c6062 100644
@@ -1,6 +1,6 @@
 config PPC_PMAC
 	bool "Apple PowerMac based machines"
-	depends on PPC_BOOK3S
+	depends on PPC_BOOK3S && CPU_BIG_ENDIAN
 	select MPIC
 	select PCI
 	select PPC_INDIRECT_PCI if PPC32
arch/powerpc/platforms/ps3/Kconfig +1 -1
index 56f2740..b27f40f 100644
@@ -1,6 +1,6 @@
 config PPC_PS3
 	bool "Sony PS3"
-	depends on PPC64 && PPC_BOOK3S
+	depends on PPC64 && PPC_BOOK3S && CPU_BIG_ENDIAN
 	select PPC_CELL
 	select USB_OHCI_LITTLE_ENDIAN
 	select USB_OHCI_BIG_ENDIAN_MMIO
Signature · 1 line
2.5.1
#2 lore raw
In reply to Boqun Feng

arch/powerpc/platforms/cell/Kconfig config PPC_CELL_NATIVE · line 28

Quoted 10 lines · Boqun Feng
arch/powerpc/platforms/cell/Kconfig +1 -1
index 2f23133..808a904 100644
@@ -25,7 +25,7 @@ config PPC_CELL_NATIVE
 
 config PPC_IBM_CELL_BLADE
 	bool "IBM Cell Blade"
-	depends on PPC64 && PPC_BOOK3S
+	depends on PPC64 && PPC_BOOK3S && CPU_BIG_ENDIAN

We end up saying this five times.

We already have PPC_BOOK3S_64 which captures the first two conditions, should we add a PPC_BOOK3S_64_BE which expresses it all?

cheers

author
#3 lore raw

Hi Michael,

Quoted 14 lines · Michael Ellerman

arch/powerpc/platforms/cell/Kconfig config PPC_CELL_NATIVE · line 28

Quoted 10 lines · Boqun Feng
arch/powerpc/platforms/cell/Kconfig +1 -1
index 2f23133..808a904 100644
@@ -25,7 +25,7 @@ config PPC_CELL_NATIVE
 
 config PPC_IBM_CELL_BLADE
 	bool "IBM Cell Blade"
-	depends on PPC64 && PPC_BOOK3S
+	depends on PPC64 && PPC_BOOK3S && CPU_BIG_ENDIAN

We end up saying this five times.

Quoted 3 lines

We already have PPC_BOOK3S_64 which captures the first two conditions, should we add a PPC_BOOK3S_64_BE which expresses it all?

I'm not sure whether this is worth.. IMO, we add a config option only if

1. we can use this config somewhere in the code, for example,
"#ifdef CONFIG_XXX"
or

2. we want to offer a option for users to choose.

PPC_BOOK3S_64_BE satisfies neither condition. Further more, CONFIG_PPC64, CONFIG_PPC_BOOK3S and CONFIG_CPU_BIG_ENDIAN all are used in some #ifdefs in current code. As a newbie of kernel, I'm happy to get some knowledge like: "If I'm hacking PS3, then #ifndef CONFIG_PPC64 is guaranteed to be false, so I can just ignore the code guarded by them". But if we add a PPC_BOOK3S_64_BE, it will take a little more effort to see this.

Regards,
Boqun

#4 lore raw
Quoted 28 lines · Boqun Feng

Hi Michael,

Quoted 14 lines · Michael Ellerman

arch/powerpc/platforms/cell/Kconfig config PPC_CELL_NATIVE · line 28

Quoted 10 lines · Boqun Feng
arch/powerpc/platforms/cell/Kconfig +1 -1
index 2f23133..808a904 100644
@@ -25,7 +25,7 @@ config PPC_CELL_NATIVE
 
 config PPC_IBM_CELL_BLADE
 	bool "IBM Cell Blade"
-	depends on PPC64 && PPC_BOOK3S
+	depends on PPC64 && PPC_BOOK3S && CPU_BIG_ENDIAN

We end up saying this five times.

Quoted 2 lines

We already have PPC_BOOK3S_64 which captures the first two conditions, should we add a PPC_BOOK3S_64_BE which expresses it all?

I'm not sure whether this is worth.. IMO, we add a config option only if

1. we can use this config somewhere in the code, for example,
"#ifdef CONFIG_XXX"
or

2. we want to offer a option for users to choose.

Quoted 7 lines

PPC_BOOK3S_64_BE satisfies neither condition. Further more, CONFIG_PPC64, CONFIG_PPC_BOOK3S and CONFIG_CPU_BIG_ENDIAN all are used in some #ifdefs in current code. As a newbie of kernel, I'm happy to get some knowledge like: "If I'm hacking PS3, then #ifndef CONFIG_PPC64 is guaranteed to be false, so I can just ignore the code guarded by them". But if we add a PPC_BOOK3S_64_BE, it will take a little more effort to see this.

Yeah those are good points, so I'll take it as is. Thanks for thinking about it :)

cheers

author
#5 lore raw
In reply to Boqun Feng

Ping ;-)

Regards,
Boqun

Quoted 92 lines · Boqun Feng

Currently, little endian is only supported on powernv and pseries, however, Kconfigs still allow us to include other platforms in a LE kernel, this may result in space wasting or even build error if some BE-only platforms always assume they are built for a BE kernel. So just modify the Kconfigs of BE-only platforms to remove them from being built for a LE kernel.

For 32bit only platforms, nothing needs to be done, because CPU_LITTLE_ENDIAN depends on PPC64. For 64bit supported platforms, add CPU_BIG_ENDIAN to dependencies explicitly, so that these platforms will be disabled for LE [Suggested-by: Cédric Le Goater <[email protected]>].

---
 arch/powerpc/platforms/cell/Kconfig     | 4 ++--
 arch/powerpc/platforms/maple/Kconfig    | 2 +-
 arch/powerpc/platforms/pasemi/Kconfig   | 2 +-
 arch/powerpc/platforms/powermac/Kconfig | 2 +-
 arch/powerpc/platforms/ps3/Kconfig      | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/platforms/cell/Kconfig +2 -2
index 2f23133..808a904 100644
@@ -25,7 +25,7 @@ config PPC_CELL_NATIVE
 
 config PPC_IBM_CELL_BLADE
 	bool "IBM Cell Blade"
-	depends on PPC64 && PPC_BOOK3S
+	depends on PPC64 && PPC_BOOK3S && CPU_BIG_ENDIAN
 	select PPC_CELL_NATIVE
 	select PPC_OF_PLATFORM_PCI
 	select PCI
@@ -35,7 +35,7 @@ config PPC_IBM_CELL_BLADE
 
 config PPC_CELL_QPACE
 	bool "IBM Cell - QPACE"
-	depends on PPC64 && PPC_BOOK3S
+	depends on PPC64 && PPC_BOOK3S && CPU_BIG_ENDIAN
 	select PPC_CELL_COMMON
 
 config AXON_MSI
arch/powerpc/platforms/maple/Kconfig +1 -1
index 1ea621a..e359d0d 100644
@@ -1,5 +1,5 @@
 config PPC_MAPLE
-	depends on PPC64 && PPC_BOOK3S
+	depends on PPC64 && PPC_BOOK3S && CPU_BIG_ENDIAN
 	bool "Maple 970FX Evaluation Board"
 	select PCI
 	select MPIC
arch/powerpc/platforms/pasemi/Kconfig +1 -1
index a2aeb32..00d4b28 100644
@@ -1,5 +1,5 @@
 config PPC_PASEMI
-	depends on PPC64 && PPC_BOOK3S
+	depends on PPC64 && PPC_BOOK3S && CPU_BIG_ENDIAN
 	bool "PA Semi SoC-based platforms"
 	default n
 	select MPIC
arch/powerpc/platforms/powermac/Kconfig +1 -1
index 607124b..43c6062 100644
@@ -1,6 +1,6 @@
 config PPC_PMAC
 	bool "Apple PowerMac based machines"
-	depends on PPC_BOOK3S
+	depends on PPC_BOOK3S && CPU_BIG_ENDIAN
 	select MPIC
 	select PCI
 	select PPC_INDIRECT_PCI if PPC32
arch/powerpc/platforms/ps3/Kconfig +1 -1
index 56f2740..b27f40f 100644
@@ -1,6 +1,6 @@
 config PPC_PS3
 	bool "Sony PS3"
-	depends on PPC64 && PPC_BOOK3S
+	depends on PPC64 && PPC_BOOK3S && CPU_BIG_ENDIAN
 	select PPC_CELL
 	select USB_OHCI_LITTLE_ENDIAN
 	select USB_OHCI_BIG_ENDIAN_MMIO
Signature · 1 line
2.5.1
author
#7 lore raw
Quoted 5 lines · Michael Ellerman
Quoted 1 line · Boqun Feng

Ping ;-)

Hi Boqun,

Hello,

Quoted 4 lines

We keep track of patches in patchwork:

http://patchwork.ozlabs.org/project/linuxppc-dev/list/?submitter=67102

Good to know ;-)

Quoted 6 lines

So your patch won't be forgotten.

I tend to start taking patches for next after rc2, which should come out on Sunday. So I'll probably merge this patch next week, when I do you'll get an email.

Understood. Thank you!

Regards,
Boqun

reviewer Applied
#8 lore raw
In reply to Boqun Feng
Quoted 7 lines · Boqun Feng

Currently, little endian is only supported on powernv and pseries, however, Kconfigs still allow us to include other platforms in a LE kernel, this may result in space wasting or even build error if some BE-only platforms always assume they are built for a BE kernel. So just modify the Kconfigs of BE-only platforms to remove them from being built for a LE kernel.

Quoted 7 lines

For 32bit only platforms, nothing needs to be done, because CPU_LITTLE_ENDIAN depends on PPC64. For 64bit supported platforms, add CPU_BIG_ENDIAN to dependencies explicitly, so that these platforms will be disabled for LE [Suggested-by: Cédric Le Goater <[email protected]>].

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/e5e16d8f3ec6973af2068897

cheers