]> 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)
commit62b8c2df4cafb54b8e667926f58b363638f3f804
tree0ecf256edc134a02c827573c6260bf08d2595e7e
parentb247711a048466bdc98a7f50f1746dd7db107ad3
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