Commit 83fa381f authored by Marc Zyngier's avatar Marc Zyngier

KVM: arm64: Avoid repetitive stack access on host EL1 to EL2 exception

Registers x0/x1 get repeateadly pushed and poped during a host
HVC call. Instead, leave the registers on the stack, trading
a store instruction on the fast path for an add on the slow path.
Reviewed-by: default avatarAlexandru Elisei <alexandru.elisei@arm.com>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
parent 29052f1b
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
.text .text
SYM_FUNC_START(__host_exit) SYM_FUNC_START(__host_exit)
stp x0, x1, [sp, #-16]!
get_host_ctxt x0, x1 get_host_ctxt x0, x1
/* Store the host regs x2 and x3 */ /* Store the host regs x2 and x3 */
...@@ -99,13 +97,15 @@ SYM_FUNC_END(__hyp_do_panic) ...@@ -99,13 +97,15 @@ SYM_FUNC_END(__hyp_do_panic)
mrs x0, esr_el2 mrs x0, esr_el2
lsr x0, x0, #ESR_ELx_EC_SHIFT lsr x0, x0, #ESR_ELx_EC_SHIFT
cmp x0, #ESR_ELx_EC_HVC64 cmp x0, #ESR_ELx_EC_HVC64
ldp x0, x1, [sp], #16
b.ne __host_exit b.ne __host_exit
ldp x0, x1, [sp] // Don't fixup the stack yet
/* Check for a stub HVC call */ /* Check for a stub HVC call */
cmp x0, #HVC_STUB_HCALL_NR cmp x0, #HVC_STUB_HCALL_NR
b.hs __host_exit b.hs __host_exit
add sp, sp, #16
/* /*
* Compute the idmap address of __kvm_handle_stub_hvc and * Compute the idmap address of __kvm_handle_stub_hvc and
* jump there. Since we use kimage_voffset, do not use the * jump there. Since we use kimage_voffset, do not use the
......
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