arm64: vhe: Verify CPU Exception Levels
authorSuzuki K Poulose <suzuki.poulose@arm.com>
Wed, 13 Apr 2016 13:41:33 +0000 (14:41 +0100)
committerWill Deacon <will.deacon@arm.com>
Fri, 15 Apr 2016 17:06:07 +0000 (18:06 +0100)
commitac1ad20f9ed73a22b0a72eb83206302f5fbff55c
treea1da848aacc835ef79b7503d029c4134e1db7bfb
parent17eebd1a435c8616c47b715e3447f4a9c15b741f
arm64: vhe: Verify CPU Exception Levels

With a VHE capable CPU, kernel can run at EL2 and is a decided at early
boot. If some of the CPUs didn't start it EL2 or doesn't have VHE, we
could have CPUs running at different exception levels, all in the same
kernel! This patch adds an early check for the secondary CPUs to detect
such situations.

For each non-boot CPU add a sanity check to make sure we don't have
different run levels w.r.t the boot CPU. We save the information on
whether the boot CPU is running in hyp mode or not and ensure the
remaining CPUs match it.

Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
[will: made boot_cpu_hyp_mode static]
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/virt.h
arch/arm64/kernel/cpufeature.c
arch/arm64/kernel/smp.c