powerpc: Require gcc 4.0 on 64-bit
PATCH 1/4 powerpc: Require gcc 4.0 on 64-bit
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.
---
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?
arch/powerpc/Makefile +10 -3
@@ -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 ' ; \
PATCH 2/4 powerpc: Remove altivec fix for gcc versions before 4.0
Now we require gcc 4.0 on 64-bit we can remove the pre gcc 4.0 -maltivec workaround.
---
arch/powerpc/Makefile +0 -10
@@ -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
PATCH 3/4 powerpc: Add 64-bit CPU targets for gcc
In reply to Anton BlanchardAdd 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.
---
arch/powerpc/Makefile +12 -13
@@ -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)
arch/powerpc/platforms/Kconfig.cputype +30 -0
@@ -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
PATCH 4/4 powerpc: Remove CONFIG_POWER4_ONLY
In reply to Anton BlanchardRemove 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.
---
arch/powerpc/configs/g5_defconfig +0 -1
@@ -1,5 +1,4 @@ CONFIG_PPC64=y -CONFIG_POWER4_ONLY=y CONFIG_ALTIVEC=y CONFIG_SMP=y CONFIG_NR_CPUS=4
arch/powerpc/configs/maple_defconfig +0 -1
@@ -1,5 +1,4 @@ CONFIG_PPC64=y -CONFIG_POWER4_ONLY=y CONFIG_SMP=y CONFIG_NR_CPUS=4 CONFIG_EXPERIMENTAL=y
arch/powerpc/configs/pasemi_defconfig +0 -1
@@ -1,5 +1,4 @@ CONFIG_PPC64=y -CONFIG_POWER4_ONLY=y CONFIG_ALTIVEC=y # CONFIG_VIRT_CPU_ACCOUNTING is not set CONFIG_SMP=y
arch/powerpc/kernel/exceptions-64s.S +0 -4
@@ -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)
arch/powerpc/platforms/Kconfig.cputype +0 -9
@@ -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
arch/powerpc/include/asm/asm-compat.h +1 -10
@@ -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 */
arch/powerpc/lib/copyuser_64.S +3 -3
@@ -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
arch/powerpc/lib/memcpy_64.S +3 -3
@@ -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
arch/powerpc/lib/mem_64.S +3 -3
@@ -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)
arch/powerpc/include/asm/ppc_asm.h +9 -1
@@ -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.
arch/powerpc/include/asm/cputable.h +2 -2
@@ -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)
Re: [PATCH 4/4] powerpc: Remove CONFIG_POWER4_ONLY
Quoted 1 line · Anton Blanchard
+
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.
Re: [PATCH 4/4] powerpc: Remove CONFIG_POWER4_ONLY
Hi Ben,
Quoted 4 lines
So if I remember properly, this means you key off if both
CPU_FTR_NOEXECUTEandCPU_FTR_NODISRALIGNare clear... is there a point ? You make the patch simpler by only keying onNO_EXECUTEwhich 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
Re: [PATCH 4/4] powerpc: Remove CONFIG_POWER4_ONLY
Quoted 5 lines · Anton Blanchard
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.
PATCH 4/4 powerpc: Remove CONFIG_POWER4_ONLY
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.
---
v2: Use CPU_FTR_NOEXECUTE to select the newer mtocrf
arch/powerpc/configs/g5_defconfig +0 -1
@@ -1,5 +1,4 @@ CONFIG_PPC64=y -CONFIG_POWER4_ONLY=y CONFIG_ALTIVEC=y CONFIG_SMP=y CONFIG_NR_CPUS=4
arch/powerpc/configs/maple_defconfig +0 -1
@@ -1,5 +1,4 @@ CONFIG_PPC64=y -CONFIG_POWER4_ONLY=y CONFIG_SMP=y CONFIG_NR_CPUS=4 CONFIG_EXPERIMENTAL=y
arch/powerpc/configs/pasemi_defconfig +0 -1
@@ -1,5 +1,4 @@ CONFIG_PPC64=y -CONFIG_POWER4_ONLY=y CONFIG_ALTIVEC=y # CONFIG_VIRT_CPU_ACCOUNTING is not set CONFIG_SMP=y
arch/powerpc/kernel/exceptions-64s.S +0 -4
@@ -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)
arch/powerpc/platforms/Kconfig.cputype +0 -9
@@ -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
arch/powerpc/include/asm/asm-compat.h +1 -10
@@ -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 */
arch/powerpc/lib/copyuser_64.S +3 -3
@@ -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
arch/powerpc/lib/memcpy_64.S +3 -3
@@ -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
arch/powerpc/lib/mem_64.S +3 -3
@@ -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)
arch/powerpc/include/asm/ppc_asm.h +9 -1
@@ -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.
Quoted 8 lines · Anton Blanchard
=20
Older versions of gcc had issues with using -maltivec together with(quoted diff) +0
-2-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
Quoted 8 lines
Signed-off-by Anton Blanchard <[email protected]>---
=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=
Re: [PATCH 3/4] powerpc: Add 64-bit CPU targets for gcc
In reply to Anton BlanchardQuoted 7 lines · Anton Blanchard
=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.
=20Signed-off-by Anton Blanchard <[email protected]>---
Can you add a target for e5500 cpu.
- k
Quoted 3 lines
=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
Quoted 1 line
--- linux-build.orig/arch/powerpc/Makefile 2012-04-18 =
14:31:31.614666419 +1000
Quoted 1 line
+++ linux-build/arch/powerpc/Makefile 2012-04-18 14:37:08.680708678 =
+1000
Quoted 3 lines
(quoted diff) +0
-0@@ -69,6 +69,16 @@ LDFLAGS_vmlinux :=3D $(LDFLAGS_vmlinux-y)=20
CFLAGS-$(CONFIG_PPC64) :=3D -mminimal-toc -mtraceback=3Dno =
-mcall-aixdesc
Review
Quoted 3 lines
CFLAGS-$(CONFIG_PPC32) :=3D -ffixed-r2 -mmultiple
(quoted diff) +2
-0+ +CFLAGS-$(CONFIG_GENERIC_CPU) +=3D $(call =
cc-option,-mtune=3Dpower7,-mtune=3Dpower4)
Quoted 12 lines
(quoted diff) +8
-0+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)(quoted diff) +0
-0@@ -76,22 +86,11 @@ CPP =3D $(CC) -E $(KBUILD_CFLAGS)
Quoted 2 lines
=20
CHECKFLAGS +=3D -m$(CONFIG_WORD_SIZE) -D__powerpc__ =
-D__powerpc$(CONFIG_WORD_SIZE)__
Quoted 17 lines
=20
arch/powerpc/Makefile +0
-8-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+=3Darch/powerpc/lib/crtsavres.o=20arch/powerpc/Makefile +1
-5-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
Quoted 7 lines
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
Quoted 1 line
--- linux-build.orig/arch/powerpc/platforms/Kconfig.cputype =
2012-04-18 14:31:25.134549903 +1000
Quoted 1 line
+++ linux-build/arch/powerpc/platforms/Kconfig.cputype =
2012-04-18 14:36:40.576207829 +1000
arch/powerpc/platforms/Kconfig.cputype config PPC_BOOK3E_64
Quoted 10 lines
(quoted diff) +0
-0@@ -78,6 +78,36 @@ config PPC_BOOK3E_64=20
endchoice
=20arch/powerpc/platforms/Kconfig.cputype +6
-0+choice + prompt "CPU selection" + depends on PPC64 + default GENERIC_CPU + help + This will create a kernel which is optimised for a particular =
CPU.
Review
Quoted 1 line
(quoted diff) +1
-0+ The resulting kernel may not run on other CPUs, so use this =
with care.
Quoted 30 lines
arch/powerpc/platforms/Kconfig.cputype +23
-0+ + 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_BOOK3Sdef_bool y depends on PPC_BOOK3S_32 || PPC_BOOK3S_64_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev
Quoted 13 lines · Kumar Gala
Quoted 11 lines · Anton Blanchard
Older versions of gcc had issues with using -maltivec together with
(quoted diff) +0
-2-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 <[email protected]>---
Quoted 7 lines
Quoted 5 lines
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.
Re: [PATCH 3/4] powerpc: Add 64-bit CPU targets for gcc
In reply to Kumar GalaQuoted 11 lines · Kumar Gala
Quoted 7 lines · Anton Blanchard
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 <[email protected]>---
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.
Quoted 94 lines
- k
Quoted 92 lines
Index: linux-build/arch/powerpc/Makefile
===================================================================arch/powerpc/Makefile +0
-0@@ -69,6 +69,16 @@ LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y)CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=no -mcall-aixdesc
CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 -mmultiplearch/powerpc/Makefile +10
-0+ +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)arch/powerpc/Makefile +0
-0@@ -76,22 +86,11 @@ CPP = $(CC) -E $(KBUILD_CFLAGS)CHECKFLAGS += -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__
arch/powerpc/Makefile +0
-8-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.oarch/powerpc/Makefile +1
-5-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
===================================================================arch/powerpc/platforms/Kconfig.cputype +0
-0@@ -78,6 +78,36 @@ config PPC_BOOK3E_64endchoice
arch/powerpc/platforms/Kconfig.cputype +30
-0+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_BOOK3Sdef_bool y depends on PPC_BOOK3S_32 || PPC_BOOK3S_64_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev