Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Take entry point and aarch32/aarch64 state from parameter registers
It turns out the HYP firmware is actually pretty simple. The entry point seems to be called by TZ on initial boot-up and whenever a CPU core is turned back on after a power collapse (e.g. because of SMP or CPU idle). The entry address for EL1 seems to be in register x0 and x1 contains value 1/2 depending on the next execution state (aarch32 or aarch64). There seems to be one more parameter (set to 0) but not sure what it does exactly. All other registers are set to some random garbage. So, take the entry point from x0, and aarch32 vs aarch64 from x1. For aarch64, just jump to the entry point directly in EL2. Note: We cannot boot LK in EL2 because the execution state switch (aarch64 -> aarch32) can only happen when changing the exception level. Unfortunately, it looks like the execution state switch from aarch32 back to aarch64 when booting arm64 Linux from LK does not involve the hypervisor, so right now only the secondary CPU cores are started in EL2: CPU: CPUs started in inconsistent modes WARNING: CPU: 0 PID: 1 at arch/arm64/kernel/smp.c:433 smp_cpus_done+0x6c/0xb8 Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT) I guess I will need to work around this somehow... :/
- Loading branch information