summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ad0693e)
raw | patch | inline | side by side (parent: ad0693e)
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | |
Wed, 16 Mar 2011 03:54:35 +0000 (14:54 +1100) | ||
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | |
Wed, 20 Apr 2011 01:03:24 +0000 (11:03 +1000) |
We need to wait a bit for them to have done their CPU setup
or we might end up with translation and EE on with different
LPCR values between threads
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
or we might end up with translation and EE on with different
LPCR values between threads
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
index a902a0d3ae0dbda54a11cb070df0aaccb2bc55e5..bb4c033a8fb0a7c57bc760caec2725b2af1adf4f 100644 (file)
#include <asm/percpu.h>
extern int boot_cpuid;
+extern int boot_cpu_count;
extern void cpu_die(void);
index 95944278380c44e1b65d018efc6fdae98907aa8a..0700e1135c91a63eb5fa90dedf376e3c479cb030 100644 (file)
ld r23,0(r23)
ld r23,CPU_SPEC_RESTORE(r23)
cmpdi 0,r23,0
- beq 4f
+ beq 3f
ld r23,0(r23)
mtctr r23
bctrl
-3: HMT_LOW
+3: LOAD_REG_ADDR(r3, boot_cpu_count) /* Decrement boot_cpu_count */
+ lwarx r4,0,r3
+ subi r4,r4,1
+ stwcx. r4,0,r3
+ bne 3b
+ isync
+
+4: HMT_LOW
lbz r23,PACAPROCSTART(r13) /* Test if this processor should */
/* start. */
#ifndef CONFIG_SMP
- b 3b /* Never go on non-SMP */
+ b 4b /* Never go on non-SMP */
#else
cmpwi 0,r23,0
- beq 3b /* Loop until told to go */
+ beq 4b /* Loop until told to go */
sync /* order paca.run and cur_cpu_spec */
+ isync /* In case code patching happened */
-4: /* Create a temp kernel stack for use before relocation is on. */
+ /* Create a temp kernel stack for use before relocation is on. */
ld r1,PACAEMERGSP(r13)
subi r1,r1,STACK_FRAME_OVERHEAD
index e74fa12afc82b6c35da819f2b4a5f1e02ec42580..c391dc4c8bad8ffa9e028e5d6bfb546c18509de7 100644 (file)
const char *uname, int depth,
void *data)
{
- static int logical_cpuid = 0;
char *type = of_get_flat_dt_prop(node, "device_type", NULL);
const u32 *prop;
const u32 *intserv;
int i, nthreads;
unsigned long len;
- int found = 0;
+ int found = -1;
/* We are scanning "cpu" nodes only */
if (type == NULL || strcmp(type, "cpu") != 0)
* booted proc.
*/
if (initial_boot_params && initial_boot_params->version >= 2) {
- if (intserv[i] ==
- initial_boot_params->boot_cpuid_phys) {
- found = 1;
- break;
- }
+ if (intserv[i] == initial_boot_params->boot_cpuid_phys)
+ found = boot_cpu_count;
} else {
/*
* Check if it's the boot-cpu, set it's hw index now,
* off secondary threads.
*/
if (of_get_flat_dt_prop(node,
- "linux,boot-cpu", NULL) != NULL) {
- found = 1;
- break;
- }
+ "linux,boot-cpu", NULL) != NULL)
+ found = boot_cpu_count;
}
-
#ifdef CONFIG_SMP
/* logical cpu id is always 0 on UP kernels */
- logical_cpuid++;
+ boot_cpu_count++;
#endif
}
- if (found) {
- DBG("boot cpu: logical %d physical %d\n", logical_cpuid,
+ if (found >= 0) {
+ DBG("boot cpu: logical %d physical %d\n", found,
intserv[i]);
- boot_cpuid = logical_cpuid;
- set_hard_smp_processor_id(boot_cpuid, intserv[i]);
+ boot_cpuid = found;
+ set_hard_smp_processor_id(found, intserv[i]);
/*
* PAPR defines "logical" PVR values for cpus that
index 1d2fbc905303401c50bbd410da0118338cb05eb7..620d792b52e471cbd6658dba347f10e95660bf36 100644 (file)
int boot_cpuid = -1;
EXPORT_SYMBOL_GPL(boot_cpuid);
+int __initdata boot_cpu_count;
int boot_cpuid_phys;
int smp_hw_index[NR_CPUS];
index 5a0401fcaebd2b078994d156253de9d2467c6ea7..91a5cc5f0d022237cef58a20317442993d428c8e 100644 (file)
#endif
int boot_cpuid = 0;
+int __initdata boot_cpu_count;
u64 ppc64_pft_size;
/* Pick defaults since we might want to patch instructions
void smp_release_cpus(void)
{
unsigned long *ptr;
+ int i;
DBG(" -> smp_release_cpus()\n");
ptr = (unsigned long *)((unsigned long)&__secondary_hold_spinloop
- PHYSICAL_START);
*ptr = __pa(generic_secondary_smp_init);
- mb();
+
+ /* And wait a bit for them to catch up */
+ for (i = 0; i < 100000; i++) {
+ mb();
+ HMT_low();
+ if (boot_cpu_count == 0)
+ break;
+ udelay(1);
+ }
+ DBG("boot_cpu_count = %d\n", boot_cpu_count);
DBG(" <- smp_release_cpus()\n");
}