Skip to contentSkip to conversation

CPU features again

PATCH Benjamin Herrenschmidt 7 participants 7 messages Apr 18, 2001 – Apr 22, 2001 1 message not in the archive PowerPC

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

While we are at it, the CPU features stuff is now working properly on SMP too.

It relies on another change to binfmt_elf.c and friends that Alan have merged in the ac tree and I pushed to bk today.

It still need a head_4/8xx.S implementation (possibly copy&paste of the head.S one, I'm not too sure about the phys/virt stuffs on those as the code is meant to run very early in head.S, before the kernel is relocated down to 0)

Also, the definition of the feature bits exposed to glibc should be reworked to put there features that really matter (they are different from in-kernel features). I've filled them with "trivial" things like FPU, Altivec or MMU presence (will there be a uClinux for PPC ?) for now.

Those feature bits have to be common accross the entire PPC range (and possibly common with ppc64 too since ppc64 is supposed to run ppc32 binaries, except that ppc64 has 32 more bits to stuff it's own features for 64 bits binaries).

Ben.

arch/ppc/boot/misc.c +1 -0
diff -Nru a/arch/ppc/boot/misc.c b/arch/ppc/boot/misc.c
@@ -12,6 +12,7 @@
 #include <linux/types.h>
 #include "../coffboot/zlib.h"
 #include "asm/residual.h"
+#include <linux/threads.h>
 #include <linux/elf.h>
 #include <linux/config.h>
 #include <asm/page.h>
arch/ppc/kernel/Makefile +1 -1
diff -Nru a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile
@@ -32,7 +32,7 @@
 obj-y				:= entry.o traps.o irq.o idle.o time.o misc.o \
 					process.o signal.o bitops.o ptrace.o \
 					ppc_htab.o semaphore.o syscalls.o  \
-					align.o setup.o
+					align.o setup.o cputable.o
 obj-$(CONFIG_MODULES)		+= ppc_ksyms.o
 obj-$(CONFIG_POWER4)		+= xics.o
 obj-$(CONFIG_PCI)		+= pci.o pci-dma.o
arch/ppc/kernel/cputable.c new file +23 -0
diff -Nru a/arch/ppc/kernel/cputable.c b/arch/ppc/kernel/cputable.c
@@ -0,0 +1,224 @@
+#include <linux/config.h>
+#include <linux/string.h>
+#include <linux/sched.h>
+#include <linux/threads.h>
+#include <linux/init.h>
+#include <asm/cputable.h>
+
+struct cpu_spec* cur_cpu_spec[NR_CPUS];
+
+extern void __setup_cpu_601(int cpu_nr);
+extern void __setup_cpu_603(int cpu_nr);
+extern void __setup_cpu_604(int cpu_nr);
+extern void __setup_cpu_750(int cpu_nr);
+extern void __setup_cpu_7400(int cpu_nr);
+extern void __setup_cpu_7450(int cpu_nr);
+extern void __setup_cpu_power3(int cpu_nr);
+extern void __setup_cpu_power4(int cpu_nr);
+extern void __setup_cpu_generic(int cpu_nr);
+
+#define CLASSIC_PPC (!defined(CONFIG_8260) && !defined(CONFIG_8xx) && \
+	!defined(CONFIG_4xx) && !defined(CONFIG_POWER3) && !defined(CONFIG_POWER4))
+
+/* This table only contains "desktop" CPUs, it need to be filled with

embedded
+ * ones as well...
+ */
+#define COMMON_PPC PPC_FEATURE_32 | PPC_FEATURE_HAS_FPU |
PPC_FEATURE_HAS_MMU | \
+ PPC_FEATURE_UISA | PPC_FEATURE_OEA | PPC_FEATURE_VEA
+
+struct cpu_spec cpu_specs[] = {
+#if CLASSIC_PPC
+ { /* 601 */
+ 0xffff0000, 0x00010000, "601",
+ CPU_FTR_601_BROKEN_SYNC,
+ COMMON_PPC | PPC_FEATURE_601_INSTR | PPC_FEATURE_UNIFIED_CACHE,
+ 32, 32,
+ __setup_cpu_601

+    },
+    {	/* 603 */
+    	0xffff0000, 0x00030000, "603",
+    	CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_CAN_DOZE | CPU_FTR_USE_TB,
+	COMMON_PPC,
+    	32, 32,
+	__setup_cpu_603
+    },
+    {	/* 603e */
+    	0xffff0000, 0x00060000, "603e",
+    	CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_CAN_DOZE | CPU_FTR_USE_TB,
+	COMMON_PPC,
+	32, 32,
+	__setup_cpu_603
+    },
+    {	/* 603ev */
+    	0xffff0000, 0x00070000, "603ev",
+    	CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_CAN_DOZE | CPU_FTR_USE_TB,
+	COMMON_PPC,
+	32, 32,
+	__setup_cpu_603
+    },
+    {	/* 604 */
+    	0xffff0000, 0x00040000, "604",
+    	CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_604_PERF_MON,
+	COMMON_PPC,
+	32, 32,
+	__setup_cpu_604
+    },
+    {	/* 604e */
+    	0xfffff000, 0x00090000, "604e",
+    	CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_604_PERF_MON,
+	COMMON_PPC,
+	32, 32,
+	__setup_cpu_604
+    },
+    {	/* 604r */
+    	0xffff0000, 0x00090000, "604r",
+    	CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_604_PERF_MON,
+	COMMON_PPC,
+	32, 32,
+	__setup_cpu_604
+    },
+    {	/* 604ev */
+    	0xffff0000, 0x000a0000, "604ev",
+    	CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_604_PERF_MON,
+	COMMON_PPC,
+	32, 32,
+	__setup_cpu_604
+    },
+    {	/* 750 (0x4202, don't support TAU ?) */
+    	0xffffffff, 0x00084202, "750",
+    	CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_CAN_DOZE | CPU_FTR_USE_TB |

CPU_FTR_L2CR,
+ COMMON_PPC,
+ 32, 32,
+ __setup_cpu_750

+    },
+    {	/* 750CX */
+    	0xffffff00, 0x00082200, "750CX",
+    	CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_CAN_DOZE | CPU_FTR_USE_TB |

CPU_FTR_L2CR |
+ CPU_FTR_TAU | CPU_FTR_ONCHIP_L2,
+ COMMON_PPC,
+ 32, 32,
+ __setup_cpu_750

+    },
+    {	/* 740/750 (L2CR bit need fixup for 740) */
+    	0xffff0000, 0x00080000, "740/750",
+    	CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_CAN_DOZE | CPU_FTR_USE_TB |

CPU_FTR_L2CR |
+ CPU_FTR_TAU,
+ COMMON_PPC,
+ 32, 32,
+ __setup_cpu_750

+    },
+    {	/* 7400 rev 1.1 ? (no TAU) */
+    	0xffffffff, 0x000c1101, "7400 (1.1)",
+    	CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_CAN_DOZE | CPU_FTR_USE_TB |

CPU_FTR_L2CR |
+ CPU_FTR_ALTIVEC,
+ COMMON_PPC | PPC_FEATURE_HAS_ALTIVEC,
+ 32, 32,
+ __setup_cpu_7400

+    },
+    {	/* 7400 */
+    	0xffff0000, 0x000c0000, "7400",
+    	CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_CAN_DOZE | CPU_FTR_USE_TB |

CPU_FTR_L2CR |
+ CPU_FTR_TAU | CPU_FTR_ALTIVEC,
+ COMMON_PPC | PPC_FEATURE_HAS_ALTIVEC,
+ 32, 32,
+ __setup_cpu_7400

+    },
+    {	/* 7410 */
+    	0xffff0000, 0x800c0000, "7410",
+    	CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_CAN_DOZE | CPU_FTR_USE_TB |

CPU_FTR_L2CR |
+ CPU_FTR_TAU | CPU_FTR_ALTIVEC,
+ COMMON_PPC | PPC_FEATURE_HAS_ALTIVEC,
+ 32, 32,
+ __setup_cpu_7400

+    },
+    {	/* default match, we assume split I/D cache & TB (non-601)... */
+    	0x00000000, 0x00000000, "(generic PPC)",
+    	CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB,

+ COMMON_PPC,
+ 32, 32,
+ __setup_cpu_generic
+ },
+#endif /* CLASSIC_PPC */
+#ifdef CONFIG_POWER3

+    {	/* Power3 */
+    	0xffff0000, 0x00400000, "Power3 (630)",
+    	0, /* FixMe */
+    	PPC_FEATURE_32 | PPC_FEATURE_64,
+	128, 128,
+	__setup_cpu_power3
+    },
+    {	/* Power3+ */
+    	0xffff0000, 0x00410000, "Power3 (630+)",
+    	0, /* FixMe */
+    	PPC_FEATURE_32 | PPC_FEATURE_64,

+ 128, 128,
+ __setup_cpu_power3
+ },
+#endif /* CONFIG_POWER3 */
+#ifdef CONFIG_POWER4

+    {	/* Power4 */
+    	0xffff0000, 0x00500000, "Power4",
+    	0, /* FixMe */
+    	PPC_FEATURE_32 | PPC_FEATURE_64,

+ 128, 128,
+ __setup_cpu_power4
+ },
+#endif /* CONFIG_POWER4 */
+#ifdef CONFIG_8260

+    {	/* 8260 */
+    	0xffff0000, 0x00810000, "8260",
+    	0, /* FixMe */
+    	PPC_FEATURE_32,

+ 32,32, /* ??? */
+ 0, /*__setup_cpu_8260 */
+ },
+#endif /* CONFIG_8260 */
+#ifdef CONFIG_8xx

+    {	/* 8xx */
+    	0xffff0000, 0x00500000, "8xx",
+    	0, /* FixMe */
+    	PPC_FEATURE_32,

+ 16,16,
+ 0, /*__setup_cpu_8xx */
+ },
+#endif /* CONFIG_8xx */
+#ifdef CONFIG_4xx

+    {	/* 403GC */
+    	0xffffff00, 0x00200200, "403GC",
+    	0, /* FixMe */
+    	PPC_FEATURE_32,
+	16,16,
+	0, /*__setup_cpu_403 */
+    },
+    {	/* 403GCX */
+    	0xffffff00, 0x00201400, "403GCX",
+    	0, /* FixMe */
+    	PPC_FEATURE_32,
+	16,16,
+	0, /*__setup_cpu_403 */
+    },
+    {	/* 403G ?? */
+    	0xffff0000, 0x00200000, "403G ??",
+    	0, /* FixMe */
+    	PPC_FEATURE_32,
+	16,16,
+	0, /*__setup_cpu_403 */
+    },
+    {	/* 405GP */
+    	0xffff0000, 0x40110000, "405GP",
+    	0, /* FixMe */
+    	PPC_FEATURE_32,

+ 16,16,
+ 0, /*__setup_cpu_405 */
+ },
+#endif /* CONFIG_4xx */
+#if !CLASSIC_PPC

+    {	/* default match */
+    	0x00000000, 0x00000000, "(generic PPC)",
+    	0,
+    	PPC_FEATURE_32,

+ 32,32,
+ 0,
+ }
+#endif /* !CLASSIC_PPC */
+};

arch/ppc/kernel/entry.S +9 -7
diff -Nru a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S
@@ -24,12 +24,14 @@
  */
 
 #include "ppc_asm.h"
+#include <linux/config.h>
+#include <linux/errno.h>
+#include <linux/sys.h>
+#include <linux/threads.h>
 #include <asm/processor.h>
 #include <asm/page.h>
 #include <asm/mmu.h>
-#include <linux/errno.h>
-#include <linux/sys.h>
-#include <linux/config.h>
+#include <asm/cputable.h>
 
 #undef SHOW_SYSCALLS
 #undef SHOW_SYSCALLS_TASK
@@ -218,7 +220,9 @@
 	mfmsr	r22
 	li	r0,MSR_FP	/* Disable floating-point */
 #ifdef CONFIG_ALTIVEC
+	BEGIN_FTR_SECTION()
 	oris	r0,r0,MSR_VEC@h
+	END_FTR_SECTION(CPU_FTR_ALTIVEC,CPU_FTR_ALTIVEC)
 #endif /* CONFIG_ALTIVEC */
 	andc	r22,r22,r0
 	stw	r20,_NIP(r1)
@@ -368,12 +372,10 @@
 	andi.	r0,r0,MSR_PR
 	beq+	1f
 #ifdef CONFIG_ALTIVEC
-	mfpvr	r8			/* check if we are on a G4 */
-	srwi	r8,r8,16
-	cmpwi	r8,PVR_7400@h
-	bne	2f
+	BEGIN_FTR_SECTION()
 	lwz	r0,THREAD+THREAD_VRSAVE(r2)
 	mtspr	SPRN_VRSAVE,r0		/* if so, restore VRSAVE reg */
+	END_FTR_SECTION(CPU_FTR_ALTIVEC,CPU_FTR_ALTIVEC)
 2:
 #endif /* CONFIG_ALTIVEC */
 	addi	r0,r1,INT_FRAME_SIZE	/* size of frame */
arch/ppc/kernel/hashtable.S +1 -0
diff -Nru a/arch/ppc/kernel/hashtable.S b/arch/ppc/kernel/hashtable.S
@@ -27,6 +27,7 @@
 #include <asm/processor.h>
 #include <asm/page.h>
 #include <linux/config.h>
+#include <asm/cputable.h>
 
 /*
  * Load a PTE into the hash table, if possible.
arch/ppc/kernel/head.S +181 -37

287 lines not on this page · raw message

arch/ppc/kernel/idle.c +2 -8
diff -Nru a/arch/ppc/kernel/idle.c b/arch/ppc/kernel/idle.c
@@ -30,6 +30,7 @@
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <asm/cache.h>
+#include <asm/cputable.h>
 
 void zero_paged(void);
 void power_save(void);
@@ -49,15 +50,8 @@
 {
 	int do_power_save = 0;
 
-	/* only sleep on the 603-family/750 processors */
-	switch (_get_PVR() >> 16) {
-	case 3:			/* 603 */
-	case 6:			/* 603e */
-	case 7:			/* 603ev */
-	case 8:			/* 750 */
-	case 12:		/* 7400 */
+	if (cur_cpu_spec[smp_processor_id()]->cpu_features & CPU_FTR_CAN_DOZE)
 		do_power_save = 1;
-	}
 
 	/* endless loop with no priority at all */
 	current->nice = 20;
arch/ppc/kernel/misc.S +9 -19
diff -Nru a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
@@ -14,11 +14,13 @@
 
 #include <linux/config.h>
 #include <linux/sys.h>
+#include <linux/threads.h>
 #include <asm/unistd.h>
 #include <asm/errno.h>
 #include <asm/processor.h>
 #include <asm/page.h>
 #include <asm/cache.h>
+#include <asm/cputable.h>
 #include "ppc_asm.h"
 
 	.text
@@ -896,14 +898,10 @@
  *   -- paulus.
  */
 _GLOBAL(_set_L2CR)
-	/* Make sure this is a 750 or 7400 chip */
-	mfspr	r4,PVR
-	rlwinm	r4,r4,16,16,31
-	cmpwi	r4,0x0008
-	cmpwi	cr1,r4,0x000c
-	cror	2,2,4*cr1+2
-	bne	99f
-
+	BEGIN_FTR_SECTION()
+	li	r3,-1
+	blr
+	END_FTR_SECTION(CPU_FTR_L2CR,0)
 	/* Turn off interrupts and data relocation. */
 	mfmsr	r7		/* Save MSR in r7 */
 	rlwinm	r4,r7,0,17,15
@@ -1007,20 +1005,12 @@
 	isync
 	blr
 
-99:	li	r3,-1
-	blr
-
 _GLOBAL(_get_L2CR)
-	/* Make sure this is a 750 chip */
-	mfspr	r3,PVR
-	srwi	r3,r3,16
-	cmpwi	r3,0x0008
-	cmpwi	cr1,r3,0x000c
-	li	r3,0
-	cror	2,2,4*cr1+2
-	bnelr
 	/* Return the L2CR contents */
+	li	r3, 0
+	BEGIN_FTR_SECTION()
 	mfspr	r3,L2CR
+	END_FTR_SECTION(CPU_FTR_L2CR,CPU_FTR_L2CR)
 	blr
 
 /* --- End of PowerLogix code ---
arch/ppc/kernel/mk_defs.c +7 -0
diff -Nru a/arch/ppc/kernel/mk_defs.c b/arch/ppc/kernel/mk_defs.c
@@ -23,6 +23,7 @@
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
+#include <asm/cputable.h>
 
 #define DEFINE(sym, val) \
 	asm volatile("\n#define\t" #sym "\t%0" : : "i" (val))
@@ -114,5 +115,11 @@
 	DEFINE(RESULT, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, result));
 	DEFINE(TRAP, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, trap));
 	DEFINE(CLONE_VM, CLONE_VM);
+	/* About the CPU features table */
+	DEFINE(CPU_SPEC_ENTRY_SIZE, sizeof(struct cpu_spec));
+	DEFINE(CPU_SPEC_PVR_MASK_OFFSET, offsetof(struct cpu_spec, pvr_mask));
+	DEFINE(CPU_SPEC_PVR_VALUE_OFFSET, offsetof(struct cpu_spec, pvr_value));
+	DEFINE(CPU_SPEC_FEATURES_OFFSET, offsetof(struct cpu_spec, cpu_features));
+	DEFINE(CPU_SPEC_SETUP_OFFSET, offsetof(struct cpu_spec, cpu_setup));
 	return 0;
 }
arch/ppc/kernel/pmac_setup.c +7 -4
diff -Nru a/arch/ppc/kernel/pmac_setup.c b/arch/ppc/kernel/pmac_setup.c
@@ -62,6 +62,7 @@
 #include <asm/keyboard.h>
 #include <asm/dma.h>
 #include <asm/bootx.h>
+#include <asm/cputable.h>
 
 #include <asm/time.h>
 #include "local_irq.h"
@@ -134,7 +135,7 @@
 {
 	int cpu = smp_processor_id();
 
-	if ( (_get_PVR() >> 16) != 8 && (_get_PVR() >> 16) != 12 )
+	if (!(cur_cpu_spec[0]->cpu_features & CPU_FTR_L2CR))
 		return;
 
 	if (cpu == 0){
@@ -275,20 +276,22 @@
 {
 	struct device_node *cpu;
 	int *fp;
-
+	unsigned long pvr = (_get_PVR() >> 16) & 0xffff;
+
 	/* Set loops_per_jiffy to a half-way reasonable value,
 	   for use until calibrate_delay gets called. */
 	cpu = find_type_devices("cpu");
 	if (cpu != 0) {
 		fp = (int *) get_property(cpu, "clock-frequency", NULL);
 		if (fp != 0) {
-			switch (_get_PVR() >> 16) {
+			switch (pvr) {
 			case 4:		/* 604 */
 			case 8:		/* G3 */
 			case 9:		/* 604e */
 			case 10:	/* mach V (604ev5) */
 			case 12:	/* G4 */
 			case 20:	/* 620 */
+			case 0x800c:	/* 7410 */
 				loops_per_jiffy = *fp / HZ;
 				break;
 			default:	/* 601, 603, etc. */
@@ -308,7 +311,7 @@
 	pmac_find_bridges();
 
 	/* Checks "l2cr-value" property in the registry */
-	if ( (_get_PVR() >> 16) == 8 || (_get_PVR() >> 16) == 12 ) {
+	if (cur_cpu_spec[0]->cpu_features & CPU_FTR_L2CR) {
 		struct device_node *np = find_devices("cpus");
 		if (np == 0)
 			np = find_type_devices("cpu");
arch/ppc/kernel/ppc_asm.h +3 -2
diff -Nru a/arch/ppc/kernel/ppc_asm.h b/arch/ppc/kernel/ppc_asm.h
@@ -67,9 +67,10 @@
 #define REST_32VR(n,b,base)	REST_16VR(n,b,base); REST_16VR(n+16,b,base)
 
 #ifdef CONFIG_PPC601_SYNC_FIX
-#define SYNC \
+#define SYNC BEGIN_FTR_SECTION()  \
 	sync; \
-	isync
+	isync; \
+	END_FTR_SECTION(CPU_FTR_601_BROKEN_SYNC,CPU_FTR_601_BROKEN_SYNC)
 #else
 #define	SYNC
 #endif
arch/ppc/kernel/ppc_htab.c +14 -67

186 lines not on this page · raw message

arch/ppc/kernel/ppc_ksyms.c +3 -0
diff -Nru a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
@@ -45,6 +45,7 @@
 #include <asm/smp.h>
 #endif /* CONFIG_SMP */
 #include <asm/time.h>
+#include <asm/cputable.h>
 
 #ifdef  CONFIG_8xx
 #include "../8xx_io/commproc.h"
@@ -372,3 +373,5 @@
 #endif
 extern long *ret_from_intercept;
 EXPORT_SYMBOL(ret_from_intercept);
+EXPORT_SYMBOL(cur_cpu_spec);
+
arch/ppc/kernel/setup.c +14 -82

123 lines not on this page · raw message

cache */
@@ -711,18 +643,12 @@
* Systems with OF can look in the properties on the cpu node(s)
* for a possibly more accurate value.
*/
- dcache_bsize = icache_bsize = 32; /* most common value */
- switch (_get_PVR() >> 16) {
- case 1: /* 601, with unified cache */
- ucache_bsize = 32;
- break;
- /* XXX need definitions in here for 8xx etc. */
- case 0x40:
- case 0x41:
- case 0x35: /* 64-bit POWER3, POWER3+, POWER4 */
- dcache_bsize = icache_bsize = 128;
- break;
- }
+ if (cur_cpu_spec[0]->cpu_features & CPU_FTR_SPLIT_ID_CACHE) {
+ dcache_bsize = cur_cpu_spec[0]->dcache_bsize;
+ icache_bsize = cur_cpu_spec[0]->icache_bsize;
+ ucache_bsize = 0;
+ } else
+ ucache_bsize = dcache_bsize = icache_bsize = cur_cpu_spec[0]->dcache_bsize;

/* reboot on panic */
panic_timeout = 180;

arch/ppc/mbxboot/misc.c +1 -0
diff -Nru a/arch/ppc/mbxboot/misc.c b/arch/ppc/mbxboot/misc.c
@@ -12,6 +12,7 @@
 #include <linux/types.h>
 #include "../coffboot/zlib.h"
 #include "asm/residual.h"
+#include <linux/threads.h>
 #include <linux/elf.h>
 #include <linux/config.h>
 #include <asm/page.h>
arch/ppc/vmlinux.lds +4 -0
diff -Nru a/arch/ppc/vmlinux.lds b/arch/ppc/vmlinux.lds
@@ -65,6 +65,10 @@
   __ex_table : { *(__ex_table) }
   __stop___ex_table = .;
 
+  __start___ftr_fixup = .;
+  __ftr_fixup : { *(__ftr_fixup) }
+  __stop___ftr_fixup = .;
+
   __start___ksymtab = .;	/* Kernel symbol table */
   __ksymtab : { *(__ksymtab) }
   __stop___ksymtab = .;
include/asm-ppc/cputable.h new file +74 -0

75 lines not on this page · raw message

include/asm-ppc/elf.h +2 -1
diff -Nru a/include/asm-ppc/elf.h b/include/asm-ppc/elf.h
@@ -5,6 +5,7 @@
  * ELF register definitions..
  */
 #include <asm/ptrace.h>
+#include <asm/cputable.h>
 
 #define ELF_NGREG	48	/* includes nip, msr, lr, etc. */
 #define ELF_NFPREG	33	/* includes fpscr */
@@ -57,7 +58,7 @@
    instruction set this cpu supports.  This could be done in userspace,
    but it's not easy, and we've already done it here.  */
 
-#define ELF_HWCAP	(0)
+#define ELF_HWCAP	(cur_cpu_spec[0]->cpu_user_features)
 
 /* This yields a string that ld.so will use to load implementation
    specific libraries for optimization.  This is more specific in

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#2 lore raw
Quoted 4 lines · Benjamin Herrenschmidt

Those feature bits have to be common accross the entire PPC range (and possibly common with ppc64 too since ppc64 is supposed to run ppc32 binaries, except that ppc64 has 32 more bits to stuff it's own features for 64 bits binaries).

BTW, we don't take the sparc64/mips64 approach and create arch/ppc64/? Sparc64/mips64 run 32-bit binaries as well.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#3 lore raw
Quoted 8 lines · Geert Uytterhoeven
Quoted 4 lines · Benjamin Herrenschmidt

Those feature bits have to be common accross the entire PPC range (and possibly common with ppc64 too since ppc64 is supposed to run ppc32 binaries, except that ppc64 has 32 more bits to stuff it's own features for 64 bits binaries).

BTW, we don't take the sparc64/mips64 approach and create arch/ppc64/? Sparc64/mips64 run 32-bit binaries as well.

That's a 2.5 planned thing, I believe.

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#4 lore raw
In reply to Geert Uytterhoeven
Quoted 8 lines
Quoted 5 lines

Those feature bits have to be common accross the entire PPC range (and possibly common with ppc64 too since ppc64 is supposed to run ppc32 binaries, except that ppc64 has 32 more bits to stuff it's own features for 64 bits binaries).

BTW, we don't take the sparc64/mips64 approach and create arch/ppc64/? Sparc64/mips64 run 32-bit binaries as well.

I think we do, not sure, ask the IBM guys or paulus.

But the idea is to make sure the low 32 bits of features they expose to userland via the asm/ppc64/elf.h (if they implement the HWCAP stuff) are defined the same as ppc 32 bits.

Ben.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#5 lore raw
Quoted 11 lines · Benjamin Herrenschmidt
Quoted 9 lines
Quoted 5 lines

Benjamin Herrenschmidt wrote:
Those feature bits have to be common accross the entire PPC range (and possibly common with ppc64 too since ppc64 is supposed to run ppc32 binaries, except that ppc64 has 32 more bits to stuff it's own features for 64 bits binaries).

Geert Uytterhoeven wrote:
BTW, we don't take the sparc64/mips64 approach and create arch/ppc64/? Sparc64/mips64 run 32-bit binaries as well.

I think we do, not sure, ask the IBM guys or paulus.

Yes, we will have an arch/ppc64/ subtree. Although we can run unmodified 32-bit user programs, there were enough changes to the kernel to warrent the split.

On a related subject, we're still trying to figure out what to do with the "uname -m" thing (ie, ppc vs ppc64) and its use in configure scripts, rpm,...

Benjamin Herrenschmidt wrote:
: But the idea is to make sure the low 32 bits of features they expose to : userland via the asm/ppc64/elf.h (if they implement the HWCAP stuff) : are defined the same as ppc 32 bits.

I haven't thought about the feature bits, let alone looked into it.

Peter

--
Peter Bergner
SLIC Optimizing Translator Development / Linux PPC64 Kernel Development IBM Rochester, MN
[email protected]

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#6 lore raw
Quoted 5 lines

On a related subject, we're still trying to figure out what to do with the "uname -m" thing (ie, ppc vs ppc64) and its use in configure scripts, rpm,...

$ uname -m
sparc64
$ ./sparc32 uname -m
sparc
$ cat sparc32.c
int main(int argc, char **argv)
{
        personality(PER_LINUX32);
        execvp(argv[1], &argv[1]);
}

You then build things with sparc32 ./configure etc.

Anton

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/