riscv: Remove smp boot code

The SMP code is incomplete and is confusing to have broken code around.
This commit is contained in:
Adrian Danis
2018-04-09 16:05:30 +10:00
committed by Anna Lyons
parent 2b101e0f9c
commit f37b8a5c87

View File

@@ -36,12 +36,6 @@ extern char ki_boot_end[1];
/* pointer to end of kernel image */
extern char ki_end[1];
#if CONFIG_MAX_NUM_NODES > 1
/* sync variable to prevent other nodes from booting
* until kernel data structures initialized */
BOOT_DATA static volatile int node_boot_lock = 0;
#endif /* CONFIG_MAX_NUM_NODES > 1 */
// RVTODO: this is an exact copy of the ARM code
BOOT_CODE static bool_t
create_untypeds(cap_t root_cnode_cap, region_t boot_mem_reuse_reg)
@@ -199,11 +193,6 @@ init_irqs(cap_t root_cnode_cap)
}
setIRQState(IRQTimer, KERNEL_TIMER_IRQ);
#if CONFIG_MAX_NUM_NODES > 1
setIRQState(IRQIPI, irq_remote_call_ipi);
setIRQState(IRQIPI, irq_reschedule_ipi);
#endif /* CONFIG_MAX_NUM_NODES > 1 */
/* provide the IRQ control cap */
write_slot(SLOT_PTR(pptr_of_cap(root_cnode_cap), seL4_CapIRQControl), cap_irq_control_cap_new());
}
@@ -230,43 +219,6 @@ init_plat(void)
initTimer();
}
#if CONFIG_MAX_NUM_NODES > 1
BOOT_CODE static bool_t
try_init_kernel_secondary_core(void)
{
/* need to first wait until some kernel init has been done */
while (!node_boot_lock);
init_core_state(SchedulerAction_ResumeCurrentThread);
/* Perform cpu init */
init_cpu();
/* Enable per-CPU timer interrupts */
maskInterrupt(false, KERNEL_TIMER_IRQ);
NODE_LOCK_SYS;
ksNumCPUs++;
init_core_state(SchedulerAction_ResumeCurrentThread);
return true;
}
BOOT_CODE static void
release_secondary_cpus(void)
{
/* release the cpus at the same time */
node_boot_lock = 1;
// RVTODO: there is no memory barrer in below loop and ksNumCPUs is not
// volatile. how does this work?
/* Wait until all the secondary cores are done initialising */
while (ksNumCPUs != CONFIG_MAX_NUM_NODES);
}
#endif /* CONFIG_MAX_NUM_NODES > 1 */
/* Main kernel initialisation function. */
static BOOT_CODE bool_t
@@ -421,14 +373,6 @@ try_init_kernel(
ksNumCPUs = 1;
printf("Releasing CPUs\n");
/* initialize BKL before booting up other cores */
SMP_COND_STATEMENT(clh_lock_init());
SMP_COND_STATEMENT(release_secondary_cpus());
/* grab BKL before leaving the kernel */
NODE_LOCK_SYS;
printf("Booting all finished, dropped to user space\n");
return true;
}
@@ -449,32 +393,14 @@ init_kernel(
// dtb_output. Until this is fixed we must therefore just throw this away and not use it
(void)dtb_output;
// RVTODO: is it safe to initialize the platform before the cpu?
bool_t result;
init_plat();
#if CONFIG_MAX_NUM_NODES > 1
if (hartid == 0) {
printf( "********* seL4 microkernel on RISC-V %d-bit platform *********\n", CONFIG_WORD_SIZE);
// RVTODO: why are we initializing the platform again?
init_plat();
result = try_init_kernel(ui_p_reg_start,
ui_p_reg_end,
pv_offset,
v_entry,
0
);
bool_t result = try_init_kernel(ui_p_reg_start,
ui_p_reg_end,
pv_offset,
v_entry
);
} else {
result = try_init_kernel_secondary_core();
}
#else
result = try_init_kernel(ui_p_reg_start,
ui_p_reg_end,
pv_offset,
v_entry
);
#endif
if (!result) {
fail ("Kernel init failed for some reason :(");
}