Skip to content

Commit 667f3fd

Browse files
mrutland-armwildea01
authored andcommitted
arm64: log CPU boot modes
We currently don't log the boot mode for arm64 as we do for arm, and without KVM the user is provided with no indication as to which mode(s) CPUs were booted in, which can seriously hinder debugging in some cases. Add logging to the boot path once all CPUs are up. Where CPUs are mismatched in violation of the boot protocol, WARN and set a taint (as we do for CPU other CPU feature mismatches) given that the firmware/bootloader is buggy and should be fixed. Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Marc Zyngier <marc.zyngier@arm.com> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent 424a383 commit 667f3fd

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎arch/arm64/kernel/setup.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
#include <asm/memblock.h>
6363
#include <asm/psci.h>
6464
#include <asm/efi.h>
65+
#include <asm/virt.h>
6566

6667
unsigned int processor_id;
6768
EXPORT_SYMBOL(processor_id);
@@ -207,8 +208,20 @@ static void __init smp_build_mpidr_hash(void)
207208
}
208209
#endif
209210

211+
static void __init hyp_mode_check(void)
212+
{
213+
if (is_hyp_mode_available())
214+
pr_info("CPU: All CPU(s) started at EL2\n");
215+
else if (is_hyp_mode_mismatched())
216+
WARN_TAINT(1, TAINT_CPU_OUT_OF_SPEC,
217+
"CPU: CPUs started in inconsistent modes");
218+
else
219+
pr_info("CPU: All CPU(s) started at EL1\n");
220+
}
221+
210222
void __init do_post_cpus_up_work(void)
211223
{
224+
hyp_mode_check();
212225
apply_alternatives_all();
213226
}
214227

0 commit comments

Comments
 (0)