Commit 6c9ae25d authored by Marc Zyngier's avatar Marc Zyngier Committed by Christoffer Dall

arm64: KVM: Move lr save/restore to do_el2_call

At the moment, we only save/restore lr if on VHE, as we rely only
the EL1 code to have preserved it in the non-VHE case.

As we're about to get rid of the latter, let's move the save/restore
code to the do_el2_call macro, unifying both code paths.
Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Signed-off-by: default avatarChristoffer Dall <cdall@linaro.org>
parent 50d912cc
...@@ -38,13 +38,10 @@ ...@@ -38,13 +38,10 @@
* A function pointer with a value less than 0xfff has a special meaning, * A function pointer with a value less than 0xfff has a special meaning,
* and is used to implement __hyp_get_vectors in the same way as in * and is used to implement __hyp_get_vectors in the same way as in
* arch/arm64/kernel/hyp_stub.S. * arch/arm64/kernel/hyp_stub.S.
* HVC behaves as a 'bl' call and will clobber lr.
*/ */
ENTRY(__kvm_call_hyp) 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 hvc #0
ldr lr, [sp], #16
ret ret
alternative_else_nop_endif alternative_else_nop_endif
b __vhe_hyp_call b __vhe_hyp_call
......
...@@ -32,17 +32,17 @@ ...@@ -32,17 +32,17 @@
* Shuffle the parameters before calling the function * Shuffle the parameters before calling the function
* pointed to in x0. Assumes parameters in x[1,2,3]. * pointed to in x0. Assumes parameters in x[1,2,3].
*/ */
str lr, [sp, #-16]!
mov lr, x0 mov lr, x0
mov x0, x1 mov x0, x1
mov x1, x2 mov x1, x2
mov x2, x3 mov x2, x3
blr lr blr lr
ldr lr, [sp], #16
.endm .endm
ENTRY(__vhe_hyp_call) ENTRY(__vhe_hyp_call)
str lr, [sp, #-16]!
do_el2_call do_el2_call
ldr lr, [sp], #16
/* /*
* We used to rely on having an exception return to get * We used to rely on having an exception return to get
* an implicit isb. In the E2H case, we don't have it anymore. * an implicit isb. In the E2H case, we don't have it anymore.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment