mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-28 21:45:01 +08:00
0a216625c3
The kernel has an awfully complicated boot sequence in order to cope
with the various EL2 configurations, including those that "enhanced"
the architecture. We go from EL2 to EL1, then back to EL2, staying
at EL2 if VHE capable and otherwise go back to EL1.
Here's a paracetamol tablet for you.
The cpu_resume path follows the same logic, because coming up with
two versions of a square wheel is hard.
However, things aren't this straightforward with pKVM, as the host
resume path is always proxied by the hypervisor, which means that
the kernel is always entered at EL1. Which contradicts what the
__boot_cpu_mode[] array contains (it obviously says EL2).
This thus triggers a HVC call from EL1 to EL2 in a vain attempt
to upgrade from EL1 to EL2 VHE, which we are, funnily enough,
reluctant to grant to the host kernel. This is also completely
unexpected, and puzzles your average EL2 hacker.
Address it by fixing up the boot mode at the point the host gets
deprivileged. is_hyp_mode_available() and co already have a static
branch to deal with this, making it pretty safe.
This stable fix doesn't have an upstream version. The entire bootflow
has been reworked from 6.0 and that fixed the boot mode at the same
time, from commit
|
||
---|---|---|
.. | ||
hyp | ||
vgic | ||
arch_timer.c | ||
arm.c | ||
debug.c | ||
fpsimd.c | ||
guest.c | ||
handle_exit.c | ||
hypercalls.c | ||
inject_fault.c | ||
irq.h | ||
Kconfig | ||
Makefile | ||
mmio.c | ||
mmu.c | ||
perf.c | ||
pmu-emul.c | ||
pmu.c | ||
psci.c | ||
pvtime.c | ||
reset.c | ||
sys_regs.c | ||
sys_regs.h | ||
trace_arm.h | ||
trace_handle_exit.h | ||
trace.h | ||
trng.c | ||
va_layout.c | ||
vgic-sys-reg-v3.c |