linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] powerpc: Require gcc 4.0 on 64-bit
@ 2012-04-18  4:42 Anton Blanchard
  2012-04-18  4:44 ` [PATCH 2/4] powerpc: Remove altivec fix for gcc versions before 4.0 Anton Blanchard
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Anton Blanchard @ 2012-04-18  4:42 UTC (permalink / raw)
  To: benh, paulus; +Cc: linuxppc-dev


Older versions of gcc had issues with using -maltivec together with
-mcpu of a non altivec capable CPU. We work around it by specifying
-mcpu=970, but the logic is complicated.

In preparation for adding more -mcpu targets, remove the workaround
and just require gcc 4.0 for 64-bit builds.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

4.0 came out in 2005 and the gcc on RHEL5 and SLES10 looks to be 4.1.
I highly doubt a ppc64 kernel will build these days on either RHEL4 or
SLES9.

Anything else we have to worry about?

Index: linux-build/arch/powerpc/Makefile
===================================================================
--- linux-build.orig/arch/powerpc/Makefile	2012-04-18 11:59:31.444220933 +1000
+++ linux-build/arch/powerpc/Makefile	2012-04-18 11:59:58.860721391 +1000
@@ -234,10 +234,11 @@ archprepare: checkbin
 # Use the file '.tmp_gas_check' for binutils tests, as gas won't output
 # to stdout and these checks are run even on install targets.
 TOUT	:= .tmp_gas_check
-# Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec
-# instructions.
-# gcc-3.4 and binutils-2.14 are a fatal combination.
 
+# Check gcc and binutils versions:
+# - gcc-3.4 and binutils-2.14 are a fatal combination
+# - Require gcc 4.0 or above on 64-bit
+# - gcc-4.2.0 has issues compiling modules on 64-bit
 checkbin:
 	@if test "$(call cc-version)" = "0304" ; then \
 		if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \
@@ -247,6 +248,12 @@ checkbin:
 			false; \
 		fi ; \
 	fi
+	@if test "$(call cc-version)" -lt "0400" \
+	    && test "x${CONFIG_PPC64}" = "xy" ; then \
+                echo -n "Sorry, GCC v4.0 or above is required to build " ; \
+                echo "the 64-bit powerpc kernel." ; \
+                false ; \
+        fi
 	@if test "$(call cc-fullversion)" = "040200" \
 	    && test "x${CONFIG_MODULES}${CONFIG_PPC64}" = "xyy" ; then \
 		echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/4] powerpc: Remove altivec fix for gcc versions before 4.0
  2012-04-18  4:42 [PATCH 1/4] powerpc: Require gcc 4.0 on 64-bit Anton Blanchard
@ 2012-04-18  4:44 ` Anton Blanchard
  2012-04-18  4:45 ` [PATCH 3/4] powerpc: Add 64-bit CPU targets for gcc Anton Blanchard
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Anton Blanchard @ 2012-04-18  4:44 UTC (permalink / raw)
  To: benh, paulus; +Cc: linuxppc-dev


Now we require gcc 4.0 on 64-bit we can remove the pre gcc 4.0
-maltivec workaround.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Index: linux-build/arch/powerpc/Makefile
===================================================================
--- linux-build.orig/arch/powerpc/Makefile	2012-04-18 07:49:24.024963656 +1000
+++ linux-build/arch/powerpc/Makefile	2012-04-18 11:58:18.278885496 +1000
@@ -77,18 +77,8 @@ CPP		= $(CC) -E $(KBUILD_CFLAGS)
 CHECKFLAGS	+= -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__
 
 ifeq ($(CONFIG_PPC64),y)
-GCC_BROKEN_VEC	:= $(call cc-ifversion, -lt, 0400, y)
-
 ifeq ($(CONFIG_POWER4_ONLY),y)
-ifeq ($(CONFIG_ALTIVEC),y)
-ifeq ($(GCC_BROKEN_VEC),y)
-	KBUILD_CFLAGS += $(call cc-option,-mcpu=970)
-else
-	KBUILD_CFLAGS += $(call cc-option,-mcpu=power4)
-endif
-else
 	KBUILD_CFLAGS += $(call cc-option,-mcpu=power4)
-endif
 else
 	KBUILD_CFLAGS += $(call cc-option,-mtune=power4)
 endif

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 3/4] powerpc: Add 64-bit CPU targets for gcc
  2012-04-18  4:42 [PATCH 1/4] powerpc: Require gcc 4.0 on 64-bit Anton Blanchard
  2012-04-18  4:44 ` [PATCH 2/4] powerpc: Remove altivec fix for gcc versions before 4.0 Anton Blanchard
@ 2012-04-18  4:45 ` Anton Blanchard
  2012-04-18 14:33   ` Kumar Gala
  2012-04-18  4:46 ` [PATCH 4/4] powerpc: Remove CONFIG_POWER4_ONLY Anton Blanchard
  2012-04-18 14:28 ` [PATCH 1/4] powerpc: Require gcc 4.0 on 64-bit Kumar Gala
  3 siblings, 1 reply; 12+ messages in thread
From: Anton Blanchard @ 2012-04-18  4:45 UTC (permalink / raw)
  To: benh, paulus; +Cc: linuxppc-dev


Add a menu to select various 64-bit CPU targets for gcc. We
default to -mtune=power7 and if gcc doesn't understand that we
fallback to -mtune=power4.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Index: linux-build/arch/powerpc/Makefile
===================================================================
--- linux-build.orig/arch/powerpc/Makefile	2012-04-18 14:31:31.614666419 +1000
+++ linux-build/arch/powerpc/Makefile	2012-04-18 14:37:08.680708678 +1000
@@ -69,6 +69,16 @@ LDFLAGS_vmlinux	:= $(LDFLAGS_vmlinux-y)
 
 CFLAGS-$(CONFIG_PPC64)	:= -mminimal-toc -mtraceback=no -mcall-aixdesc
 CFLAGS-$(CONFIG_PPC32)	:= -ffixed-r2 -mmultiple
+
+CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,-mtune=power4)
+CFLAGS-$(CONFIG_CELL_CPU) += $(call cc-option,-mcpu=cell)
+CFLAGS-$(CONFIG_POWER4_CPU) += $(call cc-option,-mcpu=power4)
+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)
+
+CFLAGS-$(CONFIG_TUNE_CELL) += $(call cc-option,-mtune=cell)
+
 KBUILD_CPPFLAGS	+= -Iarch/$(ARCH)
 KBUILD_AFLAGS	+= -Iarch/$(ARCH)
 KBUILD_CFLAGS	+= -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y)
@@ -76,22 +86,11 @@ CPP		= $(CC) -E $(KBUILD_CFLAGS)
 
 CHECKFLAGS	+= -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__
 
-ifeq ($(CONFIG_PPC64),y)
-ifeq ($(CONFIG_POWER4_ONLY),y)
-	KBUILD_CFLAGS += $(call cc-option,-mcpu=power4)
-else
-	KBUILD_CFLAGS += $(call cc-option,-mtune=power4)
-endif
-endif
-
 KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
 
-ifeq ($(CONFIG_TUNE_CELL),y)
-	KBUILD_CFLAGS += $(call cc-option,-mtune=cell)
-endif
-
-# No AltiVec instruction when building kernel
+# No AltiVec or VSX instructions when building kernel
 KBUILD_CFLAGS += $(call cc-option,-mno-altivec)
+KBUILD_CFLAGS += $(call cc-option,-mno-vsx)
 
 # No SPE instruction when building kernel
 # (We use all available options to help semi-broken compilers)
Index: linux-build/arch/powerpc/platforms/Kconfig.cputype
===================================================================
--- linux-build.orig/arch/powerpc/platforms/Kconfig.cputype	2012-04-18 14:31:25.134549903 +1000
+++ linux-build/arch/powerpc/platforms/Kconfig.cputype	2012-04-18 14:36:40.576207829 +1000
@@ -78,6 +78,36 @@ config PPC_BOOK3E_64
 
 endchoice
 
+choice
+	prompt "CPU selection"
+	depends on PPC64
+	default GENERIC_CPU
+	help
+	  This will create a kernel which is optimised for a particular CPU.
+	  The resulting kernel may not run on other CPUs, so use this with care.
+
+	  If unsure, select Generic.
+
+config GENERIC_CPU
+	bool "Generic"
+
+config CELL_CPU
+	bool "Cell Broadband Engine"
+
+config POWER4_CPU
+	bool "POWER4"
+
+config POWER5_CPU
+	bool "POWER5"
+
+config POWER6_CPU
+	bool "POWER6"
+
+config POWER7_CPU
+	bool "POWER7"
+
+endchoice
+
 config PPC_BOOK3S
 	def_bool y
 	depends on PPC_BOOK3S_32 || PPC_BOOK3S_64

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 4/4] powerpc: Remove CONFIG_POWER4_ONLY
  2012-04-18  4:42 [PATCH 1/4] powerpc: Require gcc 4.0 on 64-bit Anton Blanchard
  2012-04-18  4:44 ` [PATCH 2/4] powerpc: Remove altivec fix for gcc versions before 4.0 Anton Blanchard
  2012-04-18  4:45 ` [PATCH 3/4] powerpc: Add 64-bit CPU targets for gcc Anton Blanchard
@ 2012-04-18  4:46 ` Anton Blanchard
  2012-04-18  6:46   ` Benjamin Herrenschmidt
  2012-04-18 14:28 ` [PATCH 1/4] powerpc: Require gcc 4.0 on 64-bit Kumar Gala
  3 siblings, 1 reply; 12+ messages in thread
From: Anton Blanchard @ 2012-04-18  4:46 UTC (permalink / raw)
  To: benh, paulus; +Cc: linuxppc-dev


Remove CONFIG_POWER4_ONLY, the option is badly named and only does two
things:

- It wraps the MMU segment table code. With feature fixups there is
  little downside to compiling this in.

- It uses the newer mtocrf instruction in various assembly functions.
  Instead of making this a compile option just do it at runtime via
  a feature fixup.

I had to expose CPU_FTR_PPCAS_ARCH_V2 to assembly since I key off
that.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Index: linux-build/arch/powerpc/configs/g5_defconfig
===================================================================
--- linux-build.orig/arch/powerpc/configs/g5_defconfig	2012-04-18 14:36:40.568207687 +1000
+++ linux-build/arch/powerpc/configs/g5_defconfig	2012-04-18 14:37:46.125376070 +1000
@@ -1,5 +1,4 @@
 CONFIG_PPC64=y
-CONFIG_POWER4_ONLY=y
 CONFIG_ALTIVEC=y
 CONFIG_SMP=y
 CONFIG_NR_CPUS=4
Index: linux-build/arch/powerpc/configs/maple_defconfig
===================================================================
--- linux-build.orig/arch/powerpc/configs/maple_defconfig	2012-04-18 14:36:40.556207473 +1000
+++ linux-build/arch/powerpc/configs/maple_defconfig	2012-04-18 14:37:46.125376070 +1000
@@ -1,5 +1,4 @@
 CONFIG_PPC64=y
-CONFIG_POWER4_ONLY=y
 CONFIG_SMP=y
 CONFIG_NR_CPUS=4
 CONFIG_EXPERIMENTAL=y
Index: linux-build/arch/powerpc/configs/pasemi_defconfig
===================================================================
--- linux-build.orig/arch/powerpc/configs/pasemi_defconfig	2012-04-18 14:36:40.560207544 +1000
+++ linux-build/arch/powerpc/configs/pasemi_defconfig	2012-04-18 14:37:46.125376070 +1000
@@ -1,5 +1,4 @@
 CONFIG_PPC64=y
-CONFIG_POWER4_ONLY=y
 CONFIG_ALTIVEC=y
 # CONFIG_VIRT_CPU_ACCOUNTING is not set
 CONFIG_SMP=y
Index: linux-build/arch/powerpc/kernel/exceptions-64s.S
===================================================================
--- linux-build.orig/arch/powerpc/kernel/exceptions-64s.S	2012-04-18 14:36:40.548207330 +1000
+++ linux-build/arch/powerpc/kernel/exceptions-64s.S	2012-04-18 14:37:46.125376070 +1000
@@ -94,12 +94,10 @@ machine_check_pSeries_1:
 data_access_pSeries:
 	HMT_MEDIUM
 	SET_SCRATCH0(r13)
-#ifndef CONFIG_POWER4_ONLY
 BEGIN_FTR_SECTION
 	b	data_access_check_stab
 data_access_not_stab:
 END_MMU_FTR_SECTION_IFCLR(MMU_FTR_SLB)
-#endif
 	EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, data_access_common, EXC_STD,
 				 KVMTEST, 0x300)
 
@@ -301,7 +299,6 @@ machine_check_fwnmi:
 				 EXC_STD, KVMTEST, 0x200)
 	KVM_HANDLER_SKIP(PACA_EXMC, EXC_STD, 0x200)
 
-#ifndef CONFIG_POWER4_ONLY
 	/* moved from 0x300 */
 data_access_check_stab:
 	GET_PACA(r13)
@@ -328,7 +325,6 @@ do_stab_bolted_pSeries:
 	GET_SCRATCH0(r10)
 	std	r10,PACA_EXSLB+EX_R13(r13)
 	EXCEPTION_PROLOG_PSERIES_1(.do_stab_bolted, EXC_STD)
-#endif /* CONFIG_POWER4_ONLY */
 
 	KVM_HANDLER_SKIP(PACA_EXGEN, EXC_STD, 0x300)
 	KVM_HANDLER_SKIP(PACA_EXSLB, EXC_STD, 0x380)
Index: linux-build/arch/powerpc/platforms/Kconfig.cputype
===================================================================
--- linux-build.orig/arch/powerpc/platforms/Kconfig.cputype	2012-04-18 14:36:40.576207829 +1000
+++ linux-build/arch/powerpc/platforms/Kconfig.cputype	2012-04-18 14:37:46.125376070 +1000
@@ -116,15 +116,6 @@ config PPC_BOOK3E
 	def_bool y
 	depends on PPC_BOOK3E_64
 
-config POWER4_ONLY
-	bool "Optimize for POWER4"
-	depends on PPC64 && PPC_BOOK3S
-	default n
-	---help---
-	  Cause the compiler to optimize for POWER4/POWER5/PPC970 processors.
-	  The resulting binary will not work on POWER3 or RS64 processors
-	  when compiled with binutils 2.15 or later.
-
 config 6xx
 	def_bool y
 	depends on PPC32 && PPC_BOOK3S
Index: linux-build/arch/powerpc/include/asm/asm-compat.h
===================================================================
--- linux-build.orig/arch/powerpc/include/asm/asm-compat.h	2012-04-18 14:36:40.540207188 +1000
+++ linux-build/arch/powerpc/include/asm/asm-compat.h	2012-04-18 14:37:46.125376070 +1000
@@ -29,18 +29,9 @@
 #define PPC_LLARX(t, a, b, eh)	PPC_LDARX(t, a, b, eh)
 #define PPC_STLCX	stringify_in_c(stdcx.)
 #define PPC_CNTLZL	stringify_in_c(cntlzd)
+#define PPC_MTOCRF(FXM, RS) MTOCRF((FXM), (RS))
 #define PPC_LR_STKOFF	16
 #define PPC_MIN_STKFRM	112
-
-/* Move to CR, single-entry optimized version. Only available
- * on POWER4 and later.
- */
-#ifdef CONFIG_POWER4_ONLY
-#define PPC_MTOCRF	stringify_in_c(mtocrf)
-#else
-#define PPC_MTOCRF	stringify_in_c(mtcrf)
-#endif
-
 #else /* 32-bit */
 
 /* operations for longs and pointers */
Index: linux-build/arch/powerpc/lib/copyuser_64.S
===================================================================
--- linux-build.orig/arch/powerpc/lib/copyuser_64.S	2012-04-18 14:36:40.504206546 +1000
+++ linux-build/arch/powerpc/lib/copyuser_64.S	2012-04-18 14:37:46.125376070 +1000
@@ -30,7 +30,7 @@ _GLOBAL(__copy_tofrom_user_base)
 	dcbt	0,r4
 	beq	.Lcopy_page_4K
 	andi.	r6,r6,7
-	PPC_MTOCRF	0x01,r5
+	PPC_MTOCRF(0x01,r5)
 	blt	cr1,.Lshort_copy
 /* Below we want to nop out the bne if we're on a CPU that has the
  * CPU_FTR_UNALIGNED_LD_STD bit set and the CPU_FTR_CP_USE_DCBTZ bit
@@ -186,7 +186,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_
 	blr
 
 .Ldst_unaligned:
-	PPC_MTOCRF	0x01,r6		/* put #bytes to 8B bdry into cr7 */
+	PPC_MTOCRF(0x01,r6)		/* put #bytes to 8B bdry into cr7 */
 	subf	r5,r6,r5
 	li	r7,0
 	cmpldi	cr1,r5,16
@@ -201,7 +201,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_
 2:	bf	cr7*4+1,3f
 37:	lwzx	r0,r7,r4
 83:	stwx	r0,r7,r3
-3:	PPC_MTOCRF	0x01,r5
+3:	PPC_MTOCRF(0x01,r5)
 	add	r4,r6,r4
 	add	r3,r6,r3
 	b	.Ldst_aligned
Index: linux-build/arch/powerpc/lib/memcpy_64.S
===================================================================
--- linux-build.orig/arch/powerpc/lib/memcpy_64.S	2012-04-18 14:36:40.512206689 +1000
+++ linux-build/arch/powerpc/lib/memcpy_64.S	2012-04-18 14:37:46.129376142 +1000
@@ -12,7 +12,7 @@
 	.align	7
 _GLOBAL(memcpy)
 	std	r3,48(r1)	/* save destination pointer for return value */
-	PPC_MTOCRF	0x01,r5
+	PPC_MTOCRF(0x01,r5)
 	cmpldi	cr1,r5,16
 	neg	r6,r3		# LS 3 bits = # bytes to 8-byte dest bdry
 	andi.	r6,r6,7
@@ -154,7 +154,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_
 	blr
 
 .Ldst_unaligned:
-	PPC_MTOCRF	0x01,r6		# put #bytes to 8B bdry into cr7
+	PPC_MTOCRF(0x01,r6)		# put #bytes to 8B bdry into cr7
 	subf	r5,r6,r5
 	li	r7,0
 	cmpldi	cr1,r5,16
@@ -169,7 +169,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_
 2:	bf	cr7*4+1,3f
 	lwzx	r0,r7,r4
 	stwx	r0,r7,r3
-3:	PPC_MTOCRF	0x01,r5
+3:	PPC_MTOCRF(0x01,r5)
 	add	r4,r6,r4
 	add	r3,r6,r3
 	b	.Ldst_aligned
Index: linux-build/arch/powerpc/lib/mem_64.S
===================================================================
--- linux-build.orig/arch/powerpc/lib/mem_64.S	2012-04-18 14:36:40.508206617 +1000
+++ linux-build/arch/powerpc/lib/mem_64.S	2012-04-18 14:37:46.129376142 +1000
@@ -19,7 +19,7 @@ _GLOBAL(memset)
 	rlwimi	r4,r4,16,0,15
 	cmplw	cr1,r5,r0		/* do we get that far? */
 	rldimi	r4,r4,32,0
-	PPC_MTOCRF	1,r0
+	PPC_MTOCRF(1,r0)
 	mr	r6,r3
 	blt	cr1,8f
 	beq+	3f			/* if already 8-byte aligned */
@@ -49,7 +49,7 @@ _GLOBAL(memset)
 	bdnz	4b
 5:	srwi.	r0,r5,3
 	clrlwi	r5,r5,29
-	PPC_MTOCRF	1,r0
+	PPC_MTOCRF(1,r0)
 	beq	8f
 	bf	29,6f
 	std	r4,0(r6)
@@ -65,7 +65,7 @@ _GLOBAL(memset)
 	std	r4,0(r6)
 	addi	r6,r6,8
 8:	cmpwi	r5,0
-	PPC_MTOCRF	1,r5
+	PPC_MTOCRF(1,r5)
 	beqlr+
 	bf	29,9f
 	stw	r4,0(r6)
Index: linux-build/arch/powerpc/include/asm/ppc_asm.h
===================================================================
--- linux-build.orig/arch/powerpc/include/asm/ppc_asm.h	2012-04-18 14:36:40.532207045 +1000
+++ linux-build/arch/powerpc/include/asm/ppc_asm.h	2012-04-18 14:37:46.129376142 +1000
@@ -369,7 +369,15 @@ BEGIN_FTR_SECTION			\
 END_FTR_SECTION_IFCLR(CPU_FTR_601)
 #endif
 
-	
+#ifdef CONFIG_PPC64
+#define MTOCRF(FXM, RS)			\
+	BEGIN_FTR_SECTION_NESTED(487);	\
+	mtcrf	(FXM), (RS);		\
+	FTR_SECTION_ELSE_NESTED(487);	\
+	mtocrf (FXM), (RS);		\
+	ALT_FTR_SECTION_END_NESTED_IFCLR((CPU_FTR_PPCAS_ARCH_V2), 487)
+#endif
+
 /*
  * This instruction is not implemented on the PPC 603 or 601; however, on
  * the 403GCX and 405GP tlbia IS defined and tlbie is not.
Index: linux-build/arch/powerpc/include/asm/cputable.h
===================================================================
--- linux-build.orig/arch/powerpc/include/asm/cputable.h	2012-04-18 14:36:40.520206831 +1000
+++ linux-build/arch/powerpc/include/asm/cputable.h	2012-04-18 14:37:46.129376142 +1000
@@ -203,10 +203,10 @@ extern const char *powerpc_base_platform
 #define CPU_FTR_ICSWX			LONG_ASM_CONST(0x1000000000000000)
 #define CPU_FTR_VMX_COPY		LONG_ASM_CONST(0x2000000000000000)
 
-#ifndef __ASSEMBLY__
-
 #define CPU_FTR_PPCAS_ARCH_V2	(CPU_FTR_NOEXECUTE | CPU_FTR_NODSISRALIGN)
 
+#ifndef __ASSEMBLY__
+
 #define MMU_FTR_PPCAS_ARCH_V2 	(MMU_FTR_SLB | MMU_FTR_TLBIEL | \
 				 MMU_FTR_16M_PAGE)
 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] powerpc: Remove CONFIG_POWER4_ONLY
  2012-04-18  4:46 ` [PATCH 4/4] powerpc: Remove CONFIG_POWER4_ONLY Anton Blanchard
@ 2012-04-18  6:46   ` Benjamin Herrenschmidt
  2012-04-18  6:51     ` Anton Blanchard
  0 siblings, 1 reply; 12+ messages in thread
From: Benjamin Herrenschmidt @ 2012-04-18  6:46 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: linuxppc-dev, paulus

On Wed, 2012-04-18 at 14:46 +1000, Anton Blanchard wrote:

> +       ALT_FTR_SECTION_END_NESTED_IFCLR((CPU_FTR_PPCAS_ARCH_V2), 487)

So if I remember properly, this means you key off if both
CPU_FTR_NOEXECUTE and CPU_FTR_NODISRALIGN are clear... is
there a point ? You make the patch simpler by only keying
on NO_EXECUTE which afaik is a power4 or later only feature no ?

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] powerpc: Remove CONFIG_POWER4_ONLY
  2012-04-18  6:46   ` Benjamin Herrenschmidt
@ 2012-04-18  6:51     ` Anton Blanchard
  2012-04-18  6:57       ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 12+ messages in thread
From: Anton Blanchard @ 2012-04-18  6:51 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, paulus


Hi Ben,

> So if I remember properly, this means you key off if both
> CPU_FTR_NOEXECUTE and CPU_FTR_NODISRALIGN are clear... is
> there a point ? You make the patch simpler by only keying
> on NO_EXECUTE which afaik is a power4 or later only feature no ?

Was going to do that, but noticed ARCH_V2 was used elsewhere:

arch/powerpc/kernel/sysfs.c: if (cpu_has_feature(CPU_FTR_PPCAS_ARCH_V2))

I'm ok either way, should I respin to use CPU_FTR_NO_EXECUTE?

Anton

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] powerpc: Remove CONFIG_POWER4_ONLY
  2012-04-18  6:51     ` Anton Blanchard
@ 2012-04-18  6:57       ` Benjamin Herrenschmidt
  2012-04-18 12:21         ` Anton Blanchard
  0 siblings, 1 reply; 12+ messages in thread
From: Benjamin Herrenschmidt @ 2012-04-18  6:57 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: linuxppc-dev, paulus

On Wed, 2012-04-18 at 16:51 +1000, Anton Blanchard wrote:
> 
> arch/powerpc/kernel/sysfs.c: if
> (cpu_has_feature(CPU_FTR_PPCAS_ARCH_V2))
> 
> I'm ok either way, should I respin to use CPU_FTR_NO_EXECUTE?

Yeah, that sysfs bit will be true if -either- of the two bits is true,
which is yet another different logic, better avoid it I think.

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 4/4] powerpc: Remove CONFIG_POWER4_ONLY
  2012-04-18  6:57       ` Benjamin Herrenschmidt
@ 2012-04-18 12:21         ` Anton Blanchard
  0 siblings, 0 replies; 12+ messages in thread
From: Anton Blanchard @ 2012-04-18 12:21 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, paulus


Remove CONFIG_POWER4_ONLY, the option is badly named and only does two
things:

- It wraps the MMU segment table code. With feature fixups there is
  little downside to compiling this in.

- It uses the newer mtocrf instruction in various assembly functions.
  Instead of making this a compile option just do it at runtime via
  a feature fixup.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

v2: Use CPU_FTR_NOEXECUTE to select the newer mtocrf

Index: linux-build/arch/powerpc/configs/g5_defconfig
===================================================================
--- linux-build.orig/arch/powerpc/configs/g5_defconfig	2012-04-18 22:12:59.292790202 +1000
+++ linux-build/arch/powerpc/configs/g5_defconfig	2012-04-18 22:13:13.029035714 +1000
@@ -1,5 +1,4 @@
 CONFIG_PPC64=y
-CONFIG_POWER4_ONLY=y
 CONFIG_ALTIVEC=y
 CONFIG_SMP=y
 CONFIG_NR_CPUS=4
Index: linux-build/arch/powerpc/configs/maple_defconfig
===================================================================
--- linux-build.orig/arch/powerpc/configs/maple_defconfig	2012-04-18 22:12:59.264789702 +1000
+++ linux-build/arch/powerpc/configs/maple_defconfig	2012-04-18 22:13:13.029035714 +1000
@@ -1,5 +1,4 @@
 CONFIG_PPC64=y
-CONFIG_POWER4_ONLY=y
 CONFIG_SMP=y
 CONFIG_NR_CPUS=4
 CONFIG_EXPERIMENTAL=y
Index: linux-build/arch/powerpc/configs/pasemi_defconfig
===================================================================
--- linux-build.orig/arch/powerpc/configs/pasemi_defconfig	2012-04-18 22:12:59.280789988 +1000
+++ linux-build/arch/powerpc/configs/pasemi_defconfig	2012-04-18 22:13:13.029035714 +1000
@@ -1,5 +1,4 @@
 CONFIG_PPC64=y
-CONFIG_POWER4_ONLY=y
 CONFIG_ALTIVEC=y
 # CONFIG_VIRT_CPU_ACCOUNTING is not set
 CONFIG_SMP=y
Index: linux-build/arch/powerpc/kernel/exceptions-64s.S
===================================================================
--- linux-build.orig/arch/powerpc/kernel/exceptions-64s.S	2012-04-18 22:12:59.252789487 +1000
+++ linux-build/arch/powerpc/kernel/exceptions-64s.S	2012-04-18 22:13:13.029035714 +1000
@@ -94,12 +94,10 @@ machine_check_pSeries_1:
 data_access_pSeries:
 	HMT_MEDIUM
 	SET_SCRATCH0(r13)
-#ifndef CONFIG_POWER4_ONLY
 BEGIN_FTR_SECTION
 	b	data_access_check_stab
 data_access_not_stab:
 END_MMU_FTR_SECTION_IFCLR(MMU_FTR_SLB)
-#endif
 	EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, data_access_common, EXC_STD,
 				 KVMTEST, 0x300)
 
@@ -301,7 +299,6 @@ machine_check_fwnmi:
 				 EXC_STD, KVMTEST, 0x200)
 	KVM_HANDLER_SKIP(PACA_EXMC, EXC_STD, 0x200)
 
-#ifndef CONFIG_POWER4_ONLY
 	/* moved from 0x300 */
 data_access_check_stab:
 	GET_PACA(r13)
@@ -328,7 +325,6 @@ do_stab_bolted_pSeries:
 	GET_SCRATCH0(r10)
 	std	r10,PACA_EXSLB+EX_R13(r13)
 	EXCEPTION_PROLOG_PSERIES_1(.do_stab_bolted, EXC_STD)
-#endif /* CONFIG_POWER4_ONLY */
 
 	KVM_HANDLER_SKIP(PACA_EXGEN, EXC_STD, 0x300)
 	KVM_HANDLER_SKIP(PACA_EXSLB, EXC_STD, 0x380)
Index: linux-build/arch/powerpc/platforms/Kconfig.cputype
===================================================================
--- linux-build.orig/arch/powerpc/platforms/Kconfig.cputype	2012-04-18 22:12:59.312790560 +1000
+++ linux-build/arch/powerpc/platforms/Kconfig.cputype	2012-04-18 22:13:13.029035714 +1000
@@ -116,15 +116,6 @@ config PPC_BOOK3E
 	def_bool y
 	depends on PPC_BOOK3E_64
 
-config POWER4_ONLY
-	bool "Optimize for POWER4"
-	depends on PPC64 && PPC_BOOK3S
-	default n
-	---help---
-	  Cause the compiler to optimize for POWER4/POWER5/PPC970 processors.
-	  The resulting binary will not work on POWER3 or RS64 processors
-	  when compiled with binutils 2.15 or later.
-
 config 6xx
 	def_bool y
 	depends on PPC32 && PPC_BOOK3S
Index: linux-build/arch/powerpc/include/asm/asm-compat.h
===================================================================
--- linux-build.orig/arch/powerpc/include/asm/asm-compat.h	2012-04-18 22:12:59.236789201 +1000
+++ linux-build/arch/powerpc/include/asm/asm-compat.h	2012-04-18 22:13:13.033035785 +1000
@@ -29,18 +29,9 @@
 #define PPC_LLARX(t, a, b, eh)	PPC_LDARX(t, a, b, eh)
 #define PPC_STLCX	stringify_in_c(stdcx.)
 #define PPC_CNTLZL	stringify_in_c(cntlzd)
+#define PPC_MTOCRF(FXM, RS) MTOCRF((FXM), (RS))
 #define PPC_LR_STKOFF	16
 #define PPC_MIN_STKFRM	112
-
-/* Move to CR, single-entry optimized version. Only available
- * on POWER4 and later.
- */
-#ifdef CONFIG_POWER4_ONLY
-#define PPC_MTOCRF	stringify_in_c(mtocrf)
-#else
-#define PPC_MTOCRF	stringify_in_c(mtcrf)
-#endif
-
 #else /* 32-bit */
 
 /* operations for longs and pointers */
Index: linux-build/arch/powerpc/lib/copyuser_64.S
===================================================================
--- linux-build.orig/arch/powerpc/lib/copyuser_64.S	2012-04-18 22:12:59.180788200 +1000
+++ linux-build/arch/powerpc/lib/copyuser_64.S	2012-04-18 22:13:13.033035785 +1000
@@ -30,7 +30,7 @@ _GLOBAL(__copy_tofrom_user_base)
 	dcbt	0,r4
 	beq	.Lcopy_page_4K
 	andi.	r6,r6,7
-	PPC_MTOCRF	0x01,r5
+	PPC_MTOCRF(0x01,r5)
 	blt	cr1,.Lshort_copy
 /* Below we want to nop out the bne if we're on a CPU that has the
  * CPU_FTR_UNALIGNED_LD_STD bit set and the CPU_FTR_CP_USE_DCBTZ bit
@@ -186,7 +186,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_
 	blr
 
 .Ldst_unaligned:
-	PPC_MTOCRF	0x01,r6		/* put #bytes to 8B bdry into cr7 */
+	PPC_MTOCRF(0x01,r6)		/* put #bytes to 8B bdry into cr7 */
 	subf	r5,r6,r5
 	li	r7,0
 	cmpldi	cr1,r5,16
@@ -201,7 +201,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_
 2:	bf	cr7*4+1,3f
 37:	lwzx	r0,r7,r4
 83:	stwx	r0,r7,r3
-3:	PPC_MTOCRF	0x01,r5
+3:	PPC_MTOCRF(0x01,r5)
 	add	r4,r6,r4
 	add	r3,r6,r3
 	b	.Ldst_aligned
Index: linux-build/arch/powerpc/lib/memcpy_64.S
===================================================================
--- linux-build.orig/arch/powerpc/lib/memcpy_64.S	2012-04-18 22:12:59.208788700 +1000
+++ linux-build/arch/powerpc/lib/memcpy_64.S	2012-04-18 22:13:13.033035785 +1000
@@ -12,7 +12,7 @@
 	.align	7
 _GLOBAL(memcpy)
 	std	r3,48(r1)	/* save destination pointer for return value */
-	PPC_MTOCRF	0x01,r5
+	PPC_MTOCRF(0x01,r5)
 	cmpldi	cr1,r5,16
 	neg	r6,r3		# LS 3 bits = # bytes to 8-byte dest bdry
 	andi.	r6,r6,7
@@ -154,7 +154,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_
 	blr
 
 .Ldst_unaligned:
-	PPC_MTOCRF	0x01,r6		# put #bytes to 8B bdry into cr7
+	PPC_MTOCRF(0x01,r6)		# put #bytes to 8B bdry into cr7
 	subf	r5,r6,r5
 	li	r7,0
 	cmpldi	cr1,r5,16
@@ -169,7 +169,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_
 2:	bf	cr7*4+1,3f
 	lwzx	r0,r7,r4
 	stwx	r0,r7,r3
-3:	PPC_MTOCRF	0x01,r5
+3:	PPC_MTOCRF(0x01,r5)
 	add	r4,r6,r4
 	add	r3,r6,r3
 	b	.Ldst_aligned
Index: linux-build/arch/powerpc/lib/mem_64.S
===================================================================
--- linux-build.orig/arch/powerpc/lib/mem_64.S	2012-04-18 22:12:59.192788415 +1000
+++ linux-build/arch/powerpc/lib/mem_64.S	2012-04-18 22:13:13.033035785 +1000
@@ -19,7 +19,7 @@ _GLOBAL(memset)
 	rlwimi	r4,r4,16,0,15
 	cmplw	cr1,r5,r0		/* do we get that far? */
 	rldimi	r4,r4,32,0
-	PPC_MTOCRF	1,r0
+	PPC_MTOCRF(1,r0)
 	mr	r6,r3
 	blt	cr1,8f
 	beq+	3f			/* if already 8-byte aligned */
@@ -49,7 +49,7 @@ _GLOBAL(memset)
 	bdnz	4b
 5:	srwi.	r0,r5,3
 	clrlwi	r5,r5,29
-	PPC_MTOCRF	1,r0
+	PPC_MTOCRF(1,r0)
 	beq	8f
 	bf	29,6f
 	std	r4,0(r6)
@@ -65,7 +65,7 @@ _GLOBAL(memset)
 	std	r4,0(r6)
 	addi	r6,r6,8
 8:	cmpwi	r5,0
-	PPC_MTOCRF	1,r5
+	PPC_MTOCRF(1,r5)
 	beqlr+
 	bf	29,9f
 	stw	r4,0(r6)
Index: linux-build/arch/powerpc/include/asm/ppc_asm.h
===================================================================
--- linux-build.orig/arch/powerpc/include/asm/ppc_asm.h	2012-04-18 22:12:59.220788915 +1000
+++ linux-build/arch/powerpc/include/asm/ppc_asm.h	2012-04-18 22:13:13.033035785 +1000
@@ -369,7 +369,15 @@ BEGIN_FTR_SECTION			\
 END_FTR_SECTION_IFCLR(CPU_FTR_601)
 #endif
 
-	
+#ifdef CONFIG_PPC64
+#define MTOCRF(FXM, RS)			\
+	BEGIN_FTR_SECTION_NESTED(848);	\
+	mtcrf	(FXM), (RS);		\
+	FTR_SECTION_ELSE_NESTED(848);	\
+	mtocrf (FXM), (RS);		\
+	ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_NOEXECUTE, 848)
+#endif
+
 /*
  * This instruction is not implemented on the PPC 603 or 601; however, on
  * the 403GCX and 405GP tlbia IS defined and tlbie is not.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/4] powerpc: Require gcc 4.0 on 64-bit
  2012-04-18  4:42 [PATCH 1/4] powerpc: Require gcc 4.0 on 64-bit Anton Blanchard
                   ` (2 preceding siblings ...)
  2012-04-18  4:46 ` [PATCH 4/4] powerpc: Remove CONFIG_POWER4_ONLY Anton Blanchard
@ 2012-04-18 14:28 ` Kumar Gala
  2012-04-18 22:17   ` Benjamin Herrenschmidt
  3 siblings, 1 reply; 12+ messages in thread
From: Kumar Gala @ 2012-04-18 14:28 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: paulus, linuxppc-dev


On Apr 17, 2012, at 11:42 PM, Anton Blanchard wrote:

>=20
> Older versions of gcc had issues with using -maltivec together with
> -mcpu of a non altivec capable CPU. We work around it by specifying
> -mcpu=3D970, but the logic is complicated.
>=20
> In preparation for adding more -mcpu targets, remove the workaround
> and just require gcc 4.0 for 64-bit builds.
>=20
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
>=20
> 4.0 came out in 2005 and the gcc on RHEL5 and SLES10 looks to be 4.1.
> I highly doubt a ppc64 kernel will build these days on either RHEL4 or
> SLES9.
>=20
> Anything else we have to worry about?

There are probably embedded customers that might utilize older =
compilers, so this concerns me a little.

- k=

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/4] powerpc: Add 64-bit CPU targets for gcc
  2012-04-18  4:45 ` [PATCH 3/4] powerpc: Add 64-bit CPU targets for gcc Anton Blanchard
@ 2012-04-18 14:33   ` Kumar Gala
  2012-04-30  5:57     ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 12+ messages in thread
From: Kumar Gala @ 2012-04-18 14:33 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: paulus, linuxppc-dev


On Apr 17, 2012, at 11:45 PM, Anton Blanchard wrote:

>=20
> Add a menu to select various 64-bit CPU targets for gcc. We
> default to -mtune=3Dpower7 and if gcc doesn't understand that we
> fallback to -mtune=3Dpower4.
>=20
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---

Can you add a target for e5500 cpu.

- k

>=20
> Index: linux-build/arch/powerpc/Makefile
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-build.orig/arch/powerpc/Makefile	2012-04-18 =
14:31:31.614666419 +1000
> +++ linux-build/arch/powerpc/Makefile	2012-04-18 14:37:08.680708678 =
+1000
> @@ -69,6 +69,16 @@ LDFLAGS_vmlinux	:=3D $(LDFLAGS_vmlinux-y)
>=20
> CFLAGS-$(CONFIG_PPC64)	:=3D -mminimal-toc -mtraceback=3Dno =
-mcall-aixdesc
> CFLAGS-$(CONFIG_PPC32)	:=3D -ffixed-r2 -mmultiple
> +
> +CFLAGS-$(CONFIG_GENERIC_CPU) +=3D $(call =
cc-option,-mtune=3Dpower7,-mtune=3Dpower4)
> +CFLAGS-$(CONFIG_CELL_CPU) +=3D $(call cc-option,-mcpu=3Dcell)
> +CFLAGS-$(CONFIG_POWER4_CPU) +=3D $(call cc-option,-mcpu=3Dpower4)
> +CFLAGS-$(CONFIG_POWER5_CPU) +=3D $(call cc-option,-mcpu=3Dpower5)
> +CFLAGS-$(CONFIG_POWER6_CPU) +=3D $(call cc-option,-mcpu=3Dpower6)
> +CFLAGS-$(CONFIG_POWER7_CPU) +=3D $(call cc-option,-mcpu=3Dpower7)
> +
> +CFLAGS-$(CONFIG_TUNE_CELL) +=3D $(call cc-option,-mtune=3Dcell)
> +
> KBUILD_CPPFLAGS	+=3D -Iarch/$(ARCH)
> KBUILD_AFLAGS	+=3D -Iarch/$(ARCH)
> KBUILD_CFLAGS	+=3D -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y)
> @@ -76,22 +86,11 @@ CPP		=3D $(CC) -E $(KBUILD_CFLAGS)
>=20
> CHECKFLAGS	+=3D -m$(CONFIG_WORD_SIZE) -D__powerpc__ =
-D__powerpc$(CONFIG_WORD_SIZE)__
>=20
> -ifeq ($(CONFIG_PPC64),y)
> -ifeq ($(CONFIG_POWER4_ONLY),y)
> -	KBUILD_CFLAGS +=3D $(call cc-option,-mcpu=3Dpower4)
> -else
> -	KBUILD_CFLAGS +=3D $(call cc-option,-mtune=3Dpower4)
> -endif
> -endif
> -
> KBUILD_LDFLAGS_MODULE +=3D arch/powerpc/lib/crtsavres.o
>=20
> -ifeq ($(CONFIG_TUNE_CELL),y)
> -	KBUILD_CFLAGS +=3D $(call cc-option,-mtune=3Dcell)
> -endif
> -
> -# No AltiVec instruction when building kernel
> +# No AltiVec or VSX instructions when building kernel
> KBUILD_CFLAGS +=3D $(call cc-option,-mno-altivec)
> +KBUILD_CFLAGS +=3D $(call cc-option,-mno-vsx)
>=20
> # No SPE instruction when building kernel
> # (We use all available options to help semi-broken compilers)
> Index: linux-build/arch/powerpc/platforms/Kconfig.cputype
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-build.orig/arch/powerpc/platforms/Kconfig.cputype	=
2012-04-18 14:31:25.134549903 +1000
> +++ linux-build/arch/powerpc/platforms/Kconfig.cputype	=
2012-04-18 14:36:40.576207829 +1000
> @@ -78,6 +78,36 @@ config PPC_BOOK3E_64
>=20
> endchoice
>=20
> +choice
> +	prompt "CPU selection"
> +	depends on PPC64
> +	default GENERIC_CPU
> +	help
> +	  This will create a kernel which is optimised for a particular =
CPU.
> +	  The resulting kernel may not run on other CPUs, so use this =
with care.
> +
> +	  If unsure, select Generic.
> +
> +config GENERIC_CPU
> +	bool "Generic"
> +
> +config CELL_CPU
> +	bool "Cell Broadband Engine"
> +
> +config POWER4_CPU
> +	bool "POWER4"
> +
> +config POWER5_CPU
> +	bool "POWER5"
> +
> +config POWER6_CPU
> +	bool "POWER6"
> +
> +config POWER7_CPU
> +	bool "POWER7"
> +
> +endchoice
> +
> config PPC_BOOK3S
> 	def_bool y
> 	depends on PPC_BOOK3S_32 || PPC_BOOK3S_64
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/4] powerpc: Require gcc 4.0 on 64-bit
  2012-04-18 14:28 ` [PATCH 1/4] powerpc: Require gcc 4.0 on 64-bit Kumar Gala
@ 2012-04-18 22:17   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 12+ messages in thread
From: Benjamin Herrenschmidt @ 2012-04-18 22:17 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, paulus, Anton Blanchard

On Wed, 2012-04-18 at 09:28 -0500, Kumar Gala wrote:
> On Apr 17, 2012, at 11:42 PM, Anton Blanchard wrote:
> 
> > 
> > Older versions of gcc had issues with using -maltivec together with
> > -mcpu of a non altivec capable CPU. We work around it by specifying
> > -mcpu=970, but the logic is complicated.
> > 
> > In preparation for adding more -mcpu targets, remove the workaround
> > and just require gcc 4.0 for 64-bit builds.
> > 
> > Signed-off-by: Anton Blanchard <anton@samba.org>
> > ---
> > 
> > 4.0 came out in 2005 and the gcc on RHEL5 and SLES10 looks to be 4.1.
> > I highly doubt a ppc64 kernel will build these days on either RHEL4 or
> > SLES9.
> > 
> > Anything else we have to worry about?
> 
> There are probably embedded customers that might utilize older compilers, so this concerns me a little.

For 64-bit ? I doubt it ...

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/4] powerpc: Add 64-bit CPU targets for gcc
  2012-04-18 14:33   ` Kumar Gala
@ 2012-04-30  5:57     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 12+ messages in thread
From: Benjamin Herrenschmidt @ 2012-04-30  5:57 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, paulus, Anton Blanchard

On Wed, 2012-04-18 at 09:33 -0500, Kumar Gala wrote:
> On Apr 17, 2012, at 11:45 PM, Anton Blanchard wrote:
> 
> > 
> > Add a menu to select various 64-bit CPU targets for gcc. We
> > default to -mtune=power7 and if gcc doesn't understand that we
> > fallback to -mtune=power4.
> > 
> > Signed-off-by: Anton Blanchard <anton@samba.org>
> > ---
> 
> Can you add a target for e5500 cpu.

I'm going to put Anton patch in, can you send an add-on for e5500 ?

Cheers,
Ben.

> - k
> 
> > 
> > Index: linux-build/arch/powerpc/Makefile
> > ===================================================================
> > --- linux-build.orig/arch/powerpc/Makefile	2012-04-18 14:31:31.614666419 +1000
> > +++ linux-build/arch/powerpc/Makefile	2012-04-18 14:37:08.680708678 +1000
> > @@ -69,6 +69,16 @@ LDFLAGS_vmlinux	:= $(LDFLAGS_vmlinux-y)
> > 
> > CFLAGS-$(CONFIG_PPC64)	:= -mminimal-toc -mtraceback=no -mcall-aixdesc
> > CFLAGS-$(CONFIG_PPC32)	:= -ffixed-r2 -mmultiple
> > +
> > +CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,-mtune=power4)
> > +CFLAGS-$(CONFIG_CELL_CPU) += $(call cc-option,-mcpu=cell)
> > +CFLAGS-$(CONFIG_POWER4_CPU) += $(call cc-option,-mcpu=power4)
> > +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)
> > +
> > +CFLAGS-$(CONFIG_TUNE_CELL) += $(call cc-option,-mtune=cell)
> > +
> > KBUILD_CPPFLAGS	+= -Iarch/$(ARCH)
> > KBUILD_AFLAGS	+= -Iarch/$(ARCH)
> > KBUILD_CFLAGS	+= -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y)
> > @@ -76,22 +86,11 @@ CPP		= $(CC) -E $(KBUILD_CFLAGS)
> > 
> > CHECKFLAGS	+= -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__
> > 
> > -ifeq ($(CONFIG_PPC64),y)
> > -ifeq ($(CONFIG_POWER4_ONLY),y)
> > -	KBUILD_CFLAGS += $(call cc-option,-mcpu=power4)
> > -else
> > -	KBUILD_CFLAGS += $(call cc-option,-mtune=power4)
> > -endif
> > -endif
> > -
> > KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
> > 
> > -ifeq ($(CONFIG_TUNE_CELL),y)
> > -	KBUILD_CFLAGS += $(call cc-option,-mtune=cell)
> > -endif
> > -
> > -# No AltiVec instruction when building kernel
> > +# No AltiVec or VSX instructions when building kernel
> > KBUILD_CFLAGS += $(call cc-option,-mno-altivec)
> > +KBUILD_CFLAGS += $(call cc-option,-mno-vsx)
> > 
> > # No SPE instruction when building kernel
> > # (We use all available options to help semi-broken compilers)
> > Index: linux-build/arch/powerpc/platforms/Kconfig.cputype
> > ===================================================================
> > --- linux-build.orig/arch/powerpc/platforms/Kconfig.cputype	2012-04-18 14:31:25.134549903 +1000
> > +++ linux-build/arch/powerpc/platforms/Kconfig.cputype	2012-04-18 14:36:40.576207829 +1000
> > @@ -78,6 +78,36 @@ config PPC_BOOK3E_64
> > 
> > endchoice
> > 
> > +choice
> > +	prompt "CPU selection"
> > +	depends on PPC64
> > +	default GENERIC_CPU
> > +	help
> > +	  This will create a kernel which is optimised for a particular CPU.
> > +	  The resulting kernel may not run on other CPUs, so use this with care.
> > +
> > +	  If unsure, select Generic.
> > +
> > +config GENERIC_CPU
> > +	bool "Generic"
> > +
> > +config CELL_CPU
> > +	bool "Cell Broadband Engine"
> > +
> > +config POWER4_CPU
> > +	bool "POWER4"
> > +
> > +config POWER5_CPU
> > +	bool "POWER5"
> > +
> > +config POWER6_CPU
> > +	bool "POWER6"
> > +
> > +config POWER7_CPU
> > +	bool "POWER7"
> > +
> > +endchoice
> > +
> > config PPC_BOOK3S
> > 	def_bool y
> > 	depends on PPC_BOOK3S_32 || PPC_BOOK3S_64
> > _______________________________________________
> > Linuxppc-dev mailing list
> > Linuxppc-dev@lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-04-30  5:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-18  4:42 [PATCH 1/4] powerpc: Require gcc 4.0 on 64-bit Anton Blanchard
2012-04-18  4:44 ` [PATCH 2/4] powerpc: Remove altivec fix for gcc versions before 4.0 Anton Blanchard
2012-04-18  4:45 ` [PATCH 3/4] powerpc: Add 64-bit CPU targets for gcc Anton Blanchard
2012-04-18 14:33   ` Kumar Gala
2012-04-30  5:57     ` Benjamin Herrenschmidt
2012-04-18  4:46 ` [PATCH 4/4] powerpc: Remove CONFIG_POWER4_ONLY Anton Blanchard
2012-04-18  6:46   ` Benjamin Herrenschmidt
2012-04-18  6:51     ` Anton Blanchard
2012-04-18  6:57       ` Benjamin Herrenschmidt
2012-04-18 12:21         ` Anton Blanchard
2012-04-18 14:28 ` [PATCH 1/4] powerpc: Require gcc 4.0 on 64-bit Kumar Gala
2012-04-18 22:17   ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).