diff mbox series

[2/9] arch/powerpc: Clarify generic CPUs

Message ID 20220729000904.1295295-3-joel@jms.id.au
State Changes Requested
Headers show
Series powerpc: Fix ppc64le configurations | expand

Commit Message

Joel Stanley July 29, 2022, 12:08 a.m. UTC
In the case where a specific CPU is not selected, set an appropriate
gcc target for the architecture.

For clarity this introduces a BR2_generic_powerpc64 as a generic 64 bit
CPU as this makes the it clearer when browsing menuconfig.

We can't have a generic ppc64le GCC, as attempting to configure glibc
for powerpc64le fails:

 configure: error: ***  POWER8 or newer is required on powerpc64le.
 __builtin_signbit is broken.  GCC 7.4 or newer is required to resolve
 (PR83862). The compiler must support -mabi=ieeelongdouble and
 -mlong-double-128 simultaneously.

Hence set Power8 as the default CPU for powerpc64le.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 arch/Config.in.powerpc | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Comments

Cédric Le Goater July 29, 2022, 6:48 a.m. UTC | #1
On 7/29/22 02:08, Joel Stanley wrote:
> In the case where a specific CPU is not selected, set an appropriate
> gcc target for the architecture.
> 
> For clarity this introduces a BR2_generic_powerpc64 as a generic 64 bit
> CPU as this makes the it clearer when browsing menuconfig.
> 
> We can't have a generic ppc64le GCC, as attempting to configure glibc
> for powerpc64le fails:
> 
>   configure: error: ***  POWER8 or newer is required on powerpc64le.
>   __builtin_signbit is broken.  GCC 7.4 or newer is required to resolve
>   (PR83862). The compiler must support -mabi=ieeelongdouble and
>   -mlong-double-128 simultaneously.
> 
> Hence set Power8 as the default CPU for powerpc64le.

power8 is now 8 years old. Is there any value in adding a power9
target ?

Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.

> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
>   arch/Config.in.powerpc | 13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/Config.in.powerpc b/arch/Config.in.powerpc
> index ef0e85fec680..8d392bfde814 100644
> --- a/arch/Config.in.powerpc
> +++ b/arch/Config.in.powerpc
> @@ -9,12 +9,17 @@ config BR2_POWERPC_CPU_HAS_SPE
>   
>   choice
>   	prompt "Target Architecture Variant"
> -	default BR2_generic_powerpc
> +	default BR2_generic_powerpc if !BR2_ARCH_IS_64
> +	default BR2_generic_powerpc64 if BR2_ARCH_IS_64
> +	default BR2_powerpc_power8 if BR2_powerpc64le
>
>   	help
>   	  Specific CPU variant to use
>   config BR2_generic_powerpc
> -	bool "generic"
> -	# No C library supports this variant on ppc64le
> +	bool "generic (32 bit)"
> +	depends on !BR2_ARCH_IS_64
> +config BR2_generic_powerpc64
> +	bool "generic (64 bit)"
> +	depends on BR2_ARCH_IS_64
>   	depends on !BR2_powerpc64le
>   config BR2_powerpc_401
>   	bool "401"
> @@ -220,6 +225,8 @@ config BR2_GCC_TARGET_CPU
>   	default "power6"	if BR2_powerpc_power6
>   	default "power7"	if BR2_powerpc_power7
>   	default "power8"	if BR2_powerpc_power8
> +	default "powerpc64"	if BR2_generic_powerpc64
> +	default "powerpc"	if BR2_generic_powerpc
>   
>   config BR2_READELF_ARCH_NAME
>   	default "PowerPC"	if BR2_powerpc
Yann E. MORIN July 29, 2022, 9:25 p.m. UTC | #2
Joel, All,

On 2022-07-29 09:38 +0930, Joel Stanley spake thusly:
> In the case where a specific CPU is not selected, set an appropriate
> gcc target for the architecture.

Sorry, I am not sure I understood this. Currently, there is always at
least one CPU variant that is available in the variant choice; it is
never empty.

So, how come we can have a situation where "a specific CPU is not
selected"?

> For clarity this introduces a BR2_generic_powerpc64 as a generic 64 bit
> CPU as this makes the it clearer when browsing menuconfig.
> 
> We can't have a generic ppc64le GCC, as attempting to configure glibc
> for powerpc64le fails:
> 
>  configure: error: ***  POWER8 or newer is required on powerpc64le.
>  __builtin_signbit is broken.  GCC 7.4 or newer is required to resolve
>  (PR83862). The compiler must support -mabi=ieeelongdouble and
>  -mlong-double-128 simultaneously.
> 
> Hence set Power8 as the default CPU for powerpc64le.

If the other CPUs are not valid for ppc64le, then they should not be
selectable, like is already dine e.g. for e5500 or e6500 (among others).
Currently, ppc64le allows:
    970
    power6
    power7
    power8

So, maybe all but power8 should be hidden?

Also, it looks like it should be a separate, previous patch in the
series.

Regards,
Yann E. MORIN.

> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
>  arch/Config.in.powerpc | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/Config.in.powerpc b/arch/Config.in.powerpc
> index ef0e85fec680..8d392bfde814 100644
> --- a/arch/Config.in.powerpc
> +++ b/arch/Config.in.powerpc
> @@ -9,12 +9,17 @@ config BR2_POWERPC_CPU_HAS_SPE
>  
>  choice
>  	prompt "Target Architecture Variant"
> -	default BR2_generic_powerpc
> +	default BR2_generic_powerpc if !BR2_ARCH_IS_64
> +	default BR2_generic_powerpc64 if BR2_ARCH_IS_64
> +	default BR2_powerpc_power8 if BR2_powerpc64le
>  	help
>  	  Specific CPU variant to use
>  config BR2_generic_powerpc
> -	bool "generic"
> -	# No C library supports this variant on ppc64le
> +	bool "generic (32 bit)"
> +	depends on !BR2_ARCH_IS_64
> +config BR2_generic_powerpc64
> +	bool "generic (64 bit)"
> +	depends on BR2_ARCH_IS_64
>  	depends on !BR2_powerpc64le
>  config BR2_powerpc_401
>  	bool "401"
> @@ -220,6 +225,8 @@ config BR2_GCC_TARGET_CPU
>  	default "power6"	if BR2_powerpc_power6
>  	default "power7"	if BR2_powerpc_power7
>  	default "power8"	if BR2_powerpc_power8
> +	default "powerpc64"	if BR2_generic_powerpc64
> +	default "powerpc"	if BR2_generic_powerpc
>  
>  config BR2_READELF_ARCH_NAME
>  	default "PowerPC"	if BR2_powerpc
> -- 
> 2.35.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Petazzoni Aug. 3, 2022, 9:28 p.m. UTC | #3
On Fri, 29 Jul 2022 09:38:57 +0930
Joel Stanley <joel@jms.id.au> wrote:

> In the case where a specific CPU is not selected, set an appropriate
> gcc target for the architecture.
> 
> For clarity this introduces a BR2_generic_powerpc64 as a generic 64 bit
> CPU as this makes the it clearer when browsing menuconfig.
> 
> We can't have a generic ppc64le GCC, as attempting to configure glibc
> for powerpc64le fails:
> 
>  configure: error: ***  POWER8 or newer is required on powerpc64le.
>  __builtin_signbit is broken.  GCC 7.4 or newer is required to resolve
>  (PR83862). The compiler must support -mabi=ieeelongdouble and
>  -mlong-double-128 simultaneously.
> 
> Hence set Power8 as the default CPU for powerpc64le.
> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
>  arch/Config.in.powerpc | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/Config.in.powerpc b/arch/Config.in.powerpc
> index ef0e85fec680..8d392bfde814 100644
> --- a/arch/Config.in.powerpc
> +++ b/arch/Config.in.powerpc
> @@ -9,12 +9,17 @@ config BR2_POWERPC_CPU_HAS_SPE
>  
>  choice
>  	prompt "Target Architecture Variant"
> -	default BR2_generic_powerpc
> +	default BR2_generic_powerpc if !BR2_ARCH_IS_64
> +	default BR2_generic_powerpc64 if BR2_ARCH_IS_64
> +	default BR2_powerpc_power8 if BR2_powerpc64le

This default will never be used, because BR2_ARCH_IS_64 is true when
BR2_powerpc64le is true. So on powerpc64le, "default
BR2_generic_powerpc64 if BR2_ARCH_IS_64" will match.

So a better solution is:

+	default BR2_generic_powerpc if BR2_powerpc
+	default BR2_generic_powerpc64 if BR2_powerpc64
+	default BR2_powerpc_power8 if BR2_powerpc64le

>  	help
>  	  Specific CPU variant to use
>  config BR2_generic_powerpc
> -	bool "generic"
> -	# No C library supports this variant on ppc64le
> +	bool "generic (32 bit)"
> +	depends on !BR2_ARCH_IS_64

I think the (32 bit) is useless, because this one will only show up on
32-bit powerpc.

> +config BR2_generic_powerpc64
> +	bool "generic (64 bit)"
> +	depends on BR2_ARCH_IS_64
>  	depends on !BR2_powerpc64le

Ditto here.

However, a help text for both of these options would be useful, as
these "generic" options are always a bit magic as to what CPUs they
support exactly. The help text should also say that they map to
-mcpu=powerpc and -mcpu=powerpc64 respectively.

As Yann requested, the commit log needs to be changed, as "In the case
where a specific CPU is not selected, set an appropriate gcc target for
the architecture." is incorrect, as a specific CPU is always selected.

Thanks!

Thomas
diff mbox series

Patch

diff --git a/arch/Config.in.powerpc b/arch/Config.in.powerpc
index ef0e85fec680..8d392bfde814 100644
--- a/arch/Config.in.powerpc
+++ b/arch/Config.in.powerpc
@@ -9,12 +9,17 @@  config BR2_POWERPC_CPU_HAS_SPE
 
 choice
 	prompt "Target Architecture Variant"
-	default BR2_generic_powerpc
+	default BR2_generic_powerpc if !BR2_ARCH_IS_64
+	default BR2_generic_powerpc64 if BR2_ARCH_IS_64
+	default BR2_powerpc_power8 if BR2_powerpc64le
 	help
 	  Specific CPU variant to use
 config BR2_generic_powerpc
-	bool "generic"
-	# No C library supports this variant on ppc64le
+	bool "generic (32 bit)"
+	depends on !BR2_ARCH_IS_64
+config BR2_generic_powerpc64
+	bool "generic (64 bit)"
+	depends on BR2_ARCH_IS_64
 	depends on !BR2_powerpc64le
 config BR2_powerpc_401
 	bool "401"
@@ -220,6 +225,8 @@  config BR2_GCC_TARGET_CPU
 	default "power6"	if BR2_powerpc_power6
 	default "power7"	if BR2_powerpc_power7
 	default "power8"	if BR2_powerpc_power8
+	default "powerpc64"	if BR2_generic_powerpc64
+	default "powerpc"	if BR2_generic_powerpc
 
 config BR2_READELF_ARCH_NAME
 	default "PowerPC"	if BR2_powerpc