KVM: arm64: Intercept host's CPU_ON SMCs
authorDavid Brazdil <dbrazdil@google.com>
Wed, 2 Dec 2020 18:41:17 +0000 (18:41 +0000)
committerMarc Zyngier <maz@kernel.org>
Fri, 4 Dec 2020 10:08:35 +0000 (10:08 +0000)
commitcdf367192766ad11a03e8d5098556be43b8eb6b0
treeee070bb486a5f4afeeb21838655bfc1e298bd84a
parent04e05f057a04275cb68c8053b29c5642ae0bad4f
KVM: arm64: Intercept host's CPU_ON SMCs

Add a handler of the CPU_ON PSCI call from host. When invoked, it looks
up the logical CPU ID corresponding to the provided MPIDR and populates
the state struct of the target CPU with the provided x0, pc. It then
calls CPU_ON itself, with an entry point in hyp that initializes EL2
state before returning ERET to the provided PC in EL1.

There is a simple atomic lock around the boot args struct. If it is
already locked, CPU_ON will return PENDING_ON error code.

Signed-off-by: David Brazdil <dbrazdil@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20201202184122.26046-22-dbrazdil@google.com
arch/arm64/kvm/hyp/nvhe/hyp-init.S
arch/arm64/kvm/hyp/nvhe/psci-relay.c