summaryrefslogtreecommitdiffstats
path: root/arch/arm64/kvm/hyp.S
diff options
context:
space:
mode:
authorJames Morse <james.morse@arm.com>2016-04-27 17:47:02 +0100
committerWill Deacon <will.deacon@arm.com>2016-04-28 12:05:46 +0100
commit00a44cdaba0900c63a003e0c431f506f49376a90 (patch)
tree98dbb48f951a2ecab7a0ee09e89bf09a4d754a36 /arch/arm64/kvm/hyp.S
parente7227d0e528f9a96d4a866f43e20dd9b33f0e782 (diff)
downloadlinux-00a44cdaba0900c63a003e0c431f506f49376a90.tar.bz2
arm64: kvm: Move lr save/restore from do_el2_call into EL1
Today the 'hvc' calling KVM or the hyp-stub is expected to preserve all registers. KVM saves/restores the registers it needs on the EL2 stack using do_el2_call(). The hyp-stub has no stack, later patches need to be able to be able to clobber the link register. Move the link register save/restore to the the call sites. Signed-off-by: James Morse <james.morse@arm.com> Acked-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/kvm/hyp.S')
-rw-r--r--arch/arm64/kvm/hyp.S7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S
index 48f19a37b3df..4ee5612f43ea 100644
--- a/arch/arm64/kvm/hyp.S
+++ b/arch/arm64/kvm/hyp.S
@@ -38,13 +38,18 @@
* A function pointer with a value of 0 has a special meaning, and is
* used to implement __hyp_get_vectors in the same way as in
* arch/arm64/kernel/hyp_stub.S.
+ * HVC behaves as a 'bl' call and will clobber lr.
*/
ENTRY(__kvm_call_hyp)
-alternative_if_not ARM64_HAS_VIRT_HOST_EXTN
+alternative_if_not ARM64_HAS_VIRT_HOST_EXTN
+ str lr, [sp, #-16]!
hvc #0
+ ldr lr, [sp], #16
ret
alternative_else
b __vhe_hyp_call
nop
+ nop
+ nop
alternative_endif
ENDPROC(__kvm_call_hyp)