Often the firmware will guard out cores after a crash. This often undesirable, and is not immediately noticeable.
This adds an informative message when a CPU device tree nodes are marked bad in the device tree. Signed-off-by: Joel Stanley <j...@jms.id.au> --- Tested on qemu 4.1 with this patch applied: https://ozlabs.org/~joel/uta2019/0001-TESTING-mark-every-second-core-as-guarded.patch This will show no cores guarded: qemu-system-ppc64 -M powernv8 -nographic -smp 1,cores=1,threads=1 -kernel zImage.epapr This will show three: qemu-system-ppc64 -M powernv8 -nographic -smp 7,cores=7,threads=1 -kernel zImage.epapr arch/powerpc/platforms/powernv/setup.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c index a5e52f9eed3c..7107583d0c6b 100644 --- a/arch/powerpc/platforms/powernv/setup.c +++ b/arch/powerpc/platforms/powernv/setup.c @@ -129,6 +129,28 @@ static void pnv_setup_rfi_flush(void) setup_count_cache_flush(); } +static void __init pnv_check_guarded_cores(void) +{ + struct device_node *dn; + int bad_count = 0; + + for_each_node_by_type(dn, "cpu") { + if (of_property_match_string(dn, "status", "bad") >= 0) + bad_count++; + }; + + if (bad_count) { + pr_cont(" __ \n"); + pr_cont(" / \\ _______________ \n"); + pr_cont(" | | / \\ \n"); + pr_cont(" @ @ | WARNING! | \n"); + pr_cont(" || || | It looks like | \n"); + pr_cont(" || || <--| you have %*d | \n", 3, bad_count); + pr_cont(" |\\_/| | guarded cores | \n"); + pr_cont(" \\___/ \\_______________/ \n\n"); + } +} + static void __init pnv_setup_arch(void) { set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT); @@ -149,6 +171,8 @@ static void __init pnv_setup_arch(void) /* Enable NAP mode */ powersave_nap = 1; + pnv_check_guarded_cores(); + /* XXX PMCS */ } -- 2.20.1