[RFC][PATCH] powerpc/CoreNet64: compile with CONFIG_E{5,6}500_CPU well

Scott Wood scottwood at freescale.com
Fri Nov 22 04:42:59 EST 2013


On Thu, 2013-11-21 at 16:59 +0800, "“tiejun.chen”" wrote:
> On 11/21/2013 12:41 AM, Scott Wood wrote:
> > On Wed, 2013-11-20 at 16:35 +0800, Tiejun Chen wrote:
> >> +# Altivec and Spe options not allowed with e500mc64 in GCC.
> >> +ifeq ($(call cc-option-yn,-mcpu=e500mc64),n)
> >>   obj-$(CONFIG_ALTIVEC)	+= xor_vmx.o
> >>   CFLAGS_xor_vmx.o += -maltivec -mabi=altivec
> >> +endif
> >
> > This does not seem like the right fix.  What if GCC supports both
> > -mcpu=e500mc64 and -mcpu=e6500, and we're using the latter?  Or for that
> 
> I can understand what you mean, but in current kernel, -mcpu=e500mc64 should be 
> excluded from -mcpu=e6500,
> 
> arch/powerpc/Makefile:
> 
> E5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
> CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
> CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))

But your patch doesn't test what options we're actually using.  You
tested what options the compiler supports.

> But unfortunately, another place also use the same option,
> 
> lib/raid6/Makefile:
> 
> raid6_pq-$(CONFIG_ALTIVEC) += altivec1.o altivec2.o altivec4.o altivec8.o
> ...
> ifeq ($(CONFIG_ALTIVEC),y)
> altivec_flags := -maltivec -mabi=altivec
> endif
> 
> Looks we have to do something in this common Makefile file as well, but it may 
> be a bit ugly if still judge some cpu-specific flags...
> 
> So what about this version?
> 
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index 607acf5..872a85c 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -127,7 +127,12 @@ CFLAGS-$(CONFIG_POWER5_CPU) += $(call cc-option,-mcpu=power5)
>   CFLAGS-$(CONFIG_POWER6_CPU) += $(call cc-option,-mcpu=power6)
>   CFLAGS-$(CONFIG_POWER7_CPU) += $(call cc-option,-mcpu=power7)
> 
> +# Altivec and Spe options not allowed with e500mc64 in GCC.
> +ifeq ($(CONFIG_ALTIVEC),)
>   E5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
> +else
> +E5500_CPU := -mcpu=powerpc64
> +endif
>   CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
>   CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))

Reverse the if/else so it uses positive logic, and remove the irrelevant
SPE from the comment, but otherwise I guess it's OK.

-Scott





More information about the Linuxppc-dev mailing list