]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64: nVHE: Handle hyp panics
authorAndrew Scull <ascull@google.com>
Tue, 15 Sep 2020 10:46:37 +0000 (11:46 +0100)
committerMarc Zyngier <maz@kernel.org>
Tue, 15 Sep 2020 17:39:03 +0000 (18:39 +0100)
commit579595682d256e9371cc8ea48a9834f0d0543f84
tree113e3f9b2f50bc15bf23856fb3414c79c54555ed
parent5d43fec826b8a22843e0e7a528e72a0f9d88bf61
KVM: arm64: nVHE: Handle hyp panics

Restore the host context when panicking from hyp to give the best chance
of the panic being clean.

The host requires that registers be preserved such as x18 for the shadow
callstack. If the panic is caused by an exception from EL1, the host
context is still valid so the panic can return straight back to the
host. If the panic comes from EL2 then it's most likely that the hyp
context is active and the host context needs to be restored.

There are windows before and after the host context is saved and
restored that restoration is attempted incorrectly and the panic won't
be clean.

Signed-off-by: Andrew Scull <ascull@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200915104643.2543892-14-ascull@google.com
arch/arm64/include/asm/kvm_hyp.h
arch/arm64/kvm/hyp/nvhe/host.S
arch/arm64/kvm/hyp/nvhe/switch.c