Skip to contentSkip to conversation

powerpc/CoreNet64: compile with CONFIG_E{5, 6}500_CPU well

RFC PATCH In review Tiejun Chen 3 participants 6 messages Nov 20, 2013 – Nov 21, 2013 PowerPC

lore
Share & tools
lore
#0 lore raw

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

CONFIG_ALTIVEC is always enabled for CoreNet64. And if we select CONFIG_E{5,6}500_CPU this may introduce -mcpu=e500mc64 into $CFLAGS. But Altivec and Spe options not allowed with e500mc64, so :

CC arch/powerpc/lib/xor_vmx.o
arch/powerpc/lib/xor_vmx.c:1:0: error: AltiVec not supported in this target make[1]: *** [arch/powerpc/lib/xor_vmx.o] Error 1
make: *** [arch/powerpc/lib] Error 2

---
 arch/powerpc/lib/Makefile |    3 +++
 1 file changed, 3 insertions(+)
arch/powerpc/lib/Makefile +3 -0
index 95a20e1..641a77d 100644
@@ -40,5 +40,8 @@ obj-y			+= code-patching.o
 obj-y			+= feature-fixups.o
 obj-$(CONFIG_FTR_FIXUP_SELFTEST) += feature-fixups-test.o
 
+# 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
Signature · 1 line
1.7.9.5
#1 lore raw

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

Quoted 1 line · Tiejun Chen

CONFIG_ALTIVEC is always enabled for CoreNet64.

In the defconfig perhaps, but this isn't a generally true statement.

Quoted 3 lines

And if we select CONFIG_E{5,6}500_CPU this may introduce -mcpu=e500mc64 into $CFLAGS. But Altivec and Spe options not allowed with e500mc64, so :

Sigh.

Quoted 15 lines

CC arch/powerpc/lib/xor_vmx.o
arch/powerpc/lib/xor_vmx.c:1:0: error: AltiVec not supported in this target make[1]: *** [arch/powerpc/lib/xor_vmx.o] Error 1
make: *** [arch/powerpc/lib] Error 2

---
 arch/powerpc/lib/Makefile |    3 +++
 1 file changed, 3 insertions(+)
arch/powerpc/lib/Makefile +0 -0
index 95a20e1..641a77d 100644

arch/powerpc/lib/Makefile obj-y += code-patching.o · line 47

Quoted 8 lines
arch/powerpc/lib/Makefile +3 -0
@@ -40,5 +40,8 @@ obj-y			+= code-patching.o
 obj-y			+= feature-fixups.o
 obj-$(CONFIG_FTR_FIXUP_SELFTEST) += feature-fixups-test.o
 
+# 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 matter, if we're using -mcpu=whatever-ibm-chip-has-this?

Plus, wouldn't you need to do something to prevent code in that file from being called?

-Scott

#2 lore raw
Quoted 6 lines · On Nov 20, 2013, at 10:41 AM, Scott Wood <[email protected]> = wrote:
Quoted 1 line · Tiejun Chen

CONFIG_ALTIVEC is always enabled for CoreNet64.

=20
In the defconfig perhaps, but this isn't a generally true statement. =20

Quoted 1 line

And if we select CONFIG_E{5,6}500_CPU this may introduce =

-mcpu=3De500mc64

Quoted 7 lines
Quoted 2 lines

into $CFLAGS. But Altivec and Spe options not allowed with e500mc64, so :

=20
Sigh.
=20

Quoted 2 lines

CC arch/powerpc/lib/xor_vmx.o
arch/powerpc/lib/xor_vmx.c:1:0: error: AltiVec not supported in this =

target

Quoted 16 lines
Quoted 16 lines

make[1]: *** [arch/powerpc/lib/xor_vmx.o] Error 1
make: *** [arch/powerpc/lib] Error 2
=20

---
arch/powerpc/lib/Makefile | 3 +++

1 file changed, 3 insertions(+)

=20

arch/powerpc/lib/Makefile +0 -0
index 95a20e1..641a77d 100644
@@ -40,5 +40,8 @@ obj-y			+=3D code-patching.o

obj-y +=3D feature-fixups.o
obj-$(CONFIG_FTR_FIXUP_SELFTEST) +=3D feature-fixups-test.o =20

Quoted 8 lines
Quoted 5 lines
arch/powerpc/lib/Makefile +2 -0
+# Altivec and Spe options not allowed with e500mc64 in GCC.
+ifeq ($(call cc-option-yn,-mcpu=3De500mc64),n)

obj-$(CONFIG_ALTIVEC) +=3D xor_vmx.o
CFLAGS_xor_vmx.o +=3D -maltivec -mabi=3Daltivec
+endif

=20
This does not seem like the right fix. What if GCC supports both -mcpu=3De500mc64 and -mcpu=3De6500, and we're using the latter? Or =

for that

Quoted 6 lines

matter, if we're using -mcpu=3Dwhatever-ibm-chip-has-this? =20
Plus, wouldn't you need to do something to prevent code in that file from being called?
=20
-Scott

Why does -mcpu=3De500mc64 get you spe enabled? It shouldn=92t as no = e500mc or greater part has spe. Can you try using -mno-spe -maltivec?

- k=

#3 lore raw

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

Quoted 1 line · Kumar Gala

On Nov 20, 2013, at 10:41 AM, Scott Wood <[email protected]> wrot=

e:

Quoted 7 lines

=20

Quoted 6 lines · Tiejun Chen
Quoted 1 line

CONFIG_ALTIVEC is always enabled for CoreNet64.

=20
In the defconfig perhaps, but this isn't a generally true statement. =20

Quoted 1 line

And if we select CONFIG_E{5,6}500_CPU this may introduce -mcpu=3De50=

0mc64

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

into $CFLAGS. But Altivec and Spe options not allowed with e500mc64, so :

=20
Sigh.
=20

Quoted 2 lines

CC arch/powerpc/lib/xor_vmx.o
arch/powerpc/lib/xor_vmx.c:1:0: error: AltiVec not supported in this=

target

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

make[1]: *** [arch/powerpc/lib/xor_vmx.o] Error 1
make: *** [arch/powerpc/lib] Error 2
=20

---
arch/powerpc/lib/Makefile | 3 +++

1 file changed, 3 insertions(+)

=20

arch/powerpc/lib/Makefile +0 -0
index 95a20e1..641a77d 100644
@@ -40,5 +40,8 @@ obj-y			+=3D code-patching.o

obj-y +=3D feature-fixups.o
obj-$(CONFIG_FTR_FIXUP_SELFTEST) +=3D feature-fixups-test.o =20

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
arch/powerpc/lib/Makefile +2 -0
+# Altivec and Spe options not allowed with e500mc64 in GCC.
+ifeq ($(call cc-option-yn,-mcpu=3De500mc64),n)

obj-$(CONFIG_ALTIVEC) +=3D xor_vmx.o
CFLAGS_xor_vmx.o +=3D -maltivec -mabi=3Daltivec
+endif

=20
This does not seem like the right fix. What if GCC supports both -mcpu=3De500mc64 and -mcpu=3De6500, and we're using the latter? Or f=

or that

Quoted 8 lines
Quoted 6 lines

matter, if we're using -mcpu=3Dwhatever-ibm-chip-has-this? =20
Plus, wouldn't you need to do something to prevent code in that file from being called?
=20
-Scott

=20
Why does -mcpu=3De500mc64 get you spe enabled? It shouldn=E2=80=99t as=

no e500mc or greater part has spe. Can you try using -mno-spe -maltivec=
?

I don't think SPE is relevant. The problem is that GCC refuses to allow -maltivec to be combined with -mcpu=3De500mc64. -mno-spe doesn't make a difference.

-Scott

#4 lore raw
In reply to Scott Wood
Quoted 5 lines · Scott Wood
Quoted 1 line · Tiejun Chen

CONFIG_ALTIVEC is always enabled for CoreNet64.

In the defconfig perhaps, but this isn't a generally true statement.

Yes, but I think we should avoid this probable scenario :)

Quoted 24 lines
Quoted 3 lines

And if we select CONFIG_E{5,6}500_CPU this may introduce -mcpu=e500mc64 into $CFLAGS. But Altivec and Spe options not allowed with e500mc64, so :

Sigh.

Quoted 18 lines

CC arch/powerpc/lib/xor_vmx.o
arch/powerpc/lib/xor_vmx.c:1:0: error: AltiVec not supported in this target make[1]: *** [arch/powerpc/lib/xor_vmx.o] Error 1
make: *** [arch/powerpc/lib] Error 2

---
  arch/powerpc/lib/Makefile |    3 +++
  1 file changed, 3 insertions(+)
arch/powerpc/lib/Makefile +0 -0
index 95a20e1..641a77d 100644
@@ -40,5 +40,8 @@ obj-y			+= code-patching.o
  obj-y			+= feature-fixups.o
  obj-$(CONFIG_FTR_FIXUP_SELFTEST) += feature-fixups-test.o
 
Quoted 8 lines

arch/powerpc/lib/Makefile obj-y += code-patching.o · line 47

Quoted 5 lines
arch/powerpc/lib/Makefile +3 -0
+# 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 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?

arch/powerpc/Makefile +5 -0
index 607acf5..872a85c 100644
@@ -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))
 

Tiejun

Quoted 10 lines

matter, if we're using -mcpu=whatever-ibm-chip-has-this?

Plus, wouldn't you need to do something to prevent code in that file from being called?

-Scott

#5 lore raw

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

Quoted 10 lines · On Thu, 2013-11-21 at 16:59 +0800, "=E2=80=9Ctiejun.chen=E2=80=9D" wrote:
Quoted 9 lines · Scott Wood

Review

Quoted 5 lines · Tiejun Chen
(quoted diff) +3 -0
+# Altivec and Spe options not allowed with e500mc64 in GCC.
+ifeq ($(call cc-option-yn,-mcpu=3De500mc64),n)
  obj-$(CONFIG_ALTIVEC)	+=3D xor_vmx.o
  CFLAGS_xor_vmx.o +=3D -maltivec -mabi=3Daltivec
+endif

This does not seem like the right fix. What if GCC supports both -mcpu=3De500mc64 and -mcpu=3De6500, and we're using the latter? Or f=

or that

Quoted 2 lines

=20
I can understand what you mean, but in current kernel, -mcpu=3De500mc64=

should be=20

Quoted 7 lines

excluded from -mcpu=3De6500,
=20
arch/powerpc/Makefile:
=20
E5500_CPU :=3D $(call cc-option,-mcpu=3De500mc64,-mcpu=3Dpowerpc64) CFLAGS-$(CONFIG_E5500_CPU) +=3D $(E5500_CPU) CFLAGS-$(CONFIG_E6500_CPU) +=3D $(call cc-option,-mcpu=3De6500,$(E5500_=

CPU))

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

Quoted 5 lines

But unfortunately, another place also use the same option, =20
lib/raid6/Makefile:
=20
raid6_pq-$(CONFIG_ALTIVEC) +=3D altivec1.o altivec2.o altivec4.o altive=

c8.o

Quoted 6 lines

...
ifeq ($(CONFIG_ALTIVEC),y)
altivec_flags :=3D -maltivec -mabi=3Daltivec
endif
=20
Looks we have to do something in this common Makefile file as well, but=

it may=20

arch/powerpc/Makefile CFLAGS-$(CONFIG_POWER5_CPU) +=3D $(call cc-option,=

Quoted 9 lines

be a bit ugly if still judge some cpu-specific flags... =20
So what about this version?
=20

arch/powerpc/Makefile +0 -0
index 607acf5..872a85c 100644
@@ -127,7 +127,12 @@ CFLAGS-$(CONFIG_POWER5_CPU) +=3D $(call cc-option,=

-mcpu=3Dpower5)

arch/powerpc/Makefile CFLAGS-$(CONFIG_POWER5_CPU) += $(call cc-option,-mcpu=power5)

Quoted 11 lines
arch/powerpc/Makefile +0 -0
  CFLAGS-$(CONFIG_POWER6_CPU) +=3D $(call cc-option,-mcpu=3Dpower6)
  CFLAGS-$(CONFIG_POWER7_CPU) +=3D $(call cc-option,-mcpu=3Dpower7)

=20

arch/powerpc/Makefile +5 -0
+# Altivec and Spe options not allowed with e500mc64 in GCC.
+ifeq ($(CONFIG_ALTIVEC),)
  E5500_CPU :=3D $(call cc-option,-mcpu=3De500mc64,-mcpu=3Dpowerpc64)
+else
+E5500_CPU :=3D -mcpu=3Dpowerpc64
+endif
  CFLAGS-$(CONFIG_E5500_CPU) +=3D $(E5500_CPU)
  CFLAGS-$(CONFIG_E6500_CPU) +=3D $(call cc-option,-mcpu=3De6500,$(E550=

0_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