for risc-v, assume all cores boot at same time
authorAndrew Waterman <waterman@eecs.berkeley.edu>
Sat, 15 Dec 2012 00:08:55 +0000 (16:08 -0800)
committerAndrew Waterman <waterman@eecs.berkeley.edu>
Sat, 15 Dec 2012 03:36:37 +0000 (19:36 -0800)
kern/arch/riscv/boot.S
kern/arch/riscv/smp.c

index c7c265a..42b6425 100644 (file)
@@ -16,7 +16,7 @@
 // entry point
 ///////////////////////////////////////////////////////////////////
 
-#define PCR0 (SR_S | SR_ET | SR_S64 | (1 << (IRQ_IPI + SR_IM_SHIFT)))
+#define PCR0 (SR_S | SR_S64 | (1 << (IRQ_IPI + SR_IM_SHIFT)))
 .text
 
 .global _start
@@ -69,6 +69,11 @@ _start:
   jr     t0
 
 notcore0:
+  // wait for core 0 to boot
+  la     t2, num_cpus_booted - KERN_LOAD_ADDR
+1:lw     t3, 0(t2)
+  beqz   t3, 1b
+
   // set up stack: sp = percoore_stacks+(core_id()+1)*KSTKSIZE
   la     sp, percore_stacks
   add    t0, t0, 1
index 0a0445f..5f57ff2 100644 (file)
@@ -8,20 +8,14 @@
 #include <atomic.h>
 #include <pmap.h>
 
-static volatile uint32_t num_cpus_booted = 1;
+volatile uint32_t num_cpus_booted = 0;
 
 void
 smp_boot(void)
 {
        smp_percpu_init();
-
-       printd("Cores, report in!\n");
-
-       for(uint32_t i = 1; i < num_cpus; i++)
-               send_ipi(i, 0); /* meaningless IRQ vector */
-       
+       num_cpus_booted = 1;
        while(num_cpus_booted < num_cpus);
-
        printd("%d cores reporting!\n", num_cpus);
 }