arm64: add timeout waiting for CPUs to come online
The initial MP code assumed all CPUs would come online. That's not very defensive, and it is a bad assumption. Provide a timeout mechanism for bring CPUs online. BUG=chrome-os-partner:33962 BRANCH=None TEST=Multiple times with CPUs working and not working. Boot to kernel. Change-Id: Ib0aef31f5c732816d65c2e4b3c6a89e159974fdc Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 9cf5bc2844c8f4ad987cfcb69ef33c73551f0083 Original-Signed-off-by: Aaron Durbin <adurbin@chromium.org> Original-Change-Id: Ifb3b72e3f122b79e9def554c037c9b3d6049a151 Original-Reviewed-on: https://chromium-review.googlesource.com/231070 Original-Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: http://review.coreboot.org/9526 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
parent
2962d1e971
commit
995127f421
|
@ -23,6 +23,7 @@
|
|||
#include <cpu/cpu.h>
|
||||
#include <console/console.h>
|
||||
#include <gic.h>
|
||||
#include <timer.h>
|
||||
#include "cpu-internal.h"
|
||||
|
||||
static inline void cpu_disable_dev(device_t dev)
|
||||
|
@ -191,6 +192,7 @@ void arch_initialize_cpus(device_t cluster, struct cpu_control_ops *cntrl_ops)
|
|||
for (i = 0; i < max_cpus; i++) {
|
||||
device_t dev;
|
||||
struct cpu_action action;
|
||||
struct stopwatch sw;
|
||||
|
||||
ci = cpu_info_for_cpu(i);
|
||||
dev = ci->cpu;
|
||||
|
@ -211,9 +213,23 @@ void arch_initialize_cpus(device_t cluster, struct cpu_control_ops *cntrl_ops)
|
|||
"Failed to start CPU%x\n", ci->id);
|
||||
continue;
|
||||
}
|
||||
stopwatch_init_msecs_expire(&sw, 1000);
|
||||
/* Wait for CPU to come online. */
|
||||
while (!cpu_online(ci));
|
||||
printk(BIOS_DEBUG, "CPU%x online.\n", ci->id);
|
||||
while (!stopwatch_expired(&sw)) {
|
||||
if (!cpu_online(ci))
|
||||
continue;
|
||||
printk(BIOS_DEBUG,
|
||||
"CPU%x online in %ld usecs.\n",
|
||||
ci->id, stopwatch_duration_usecs(&sw));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!cpu_online(ci)) {
|
||||
printk(BIOS_DEBUG,
|
||||
"CPU%x failed to come online in %ld usecs.\n",
|
||||
ci->id, stopwatch_duration_usecs(&sw));
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Send it the init action. */
|
||||
|
|
Loading…
Reference in New Issue