]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64: Don't corrupt tpidr_el2 on failed HVC call
authorMarc Zyngier <maz@kernel.org>
Mon, 26 Oct 2020 09:51:09 +0000 (09:51 +0000)
committerMarc Zyngier <maz@kernel.org>
Thu, 29 Oct 2020 19:49:02 +0000 (19:49 +0000)
commit9bbed1e3abde64ce1639fd1d1009ce6d814cc7eb
tree0ecf256edc134a02c827573c6260bf08d2595e7e
parent6cac6a562d822d9bf72b34b0c16bc9d8e59b9fb6
KVM: arm64: Don't corrupt tpidr_el2 on failed HVC call

The hyp-init code starts by stashing a register in TPIDR_EL2
in in order to free a register. This happens no matter if the
HVC call is legal or not.

Although nothing wrong seems to come out of it, it feels odd
to alter the EL2 state for something that eventually returns
an error.

Instead, use the fact that we know exactly which bits of the
__kvm_hyp_init call are non-zero to perform the check with
a series of EOR/ROR instructions, combined with a build-time
check that the value is the one we expect.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20201026095116.72051-2-maz@kernel.org
arch/arm64/kvm/hyp/nvhe/hyp-init.S