ENTRY(__guest_exit)/*
* return convention:
* guest r0, r1, r2 saved on the stack
* r0: vcpu pointer
* r1: exception code
*/
add r2, r0, #(VCPU_GUEST_CTXT + USR_REGS_OFFSET + S_R3)
stm r2!,{r3-r12}
str lr,[r2, #4]
add r2, r0, #(VCPU_GUEST_CTXT + USR_REGS_OFFSET + S_R0)
pop {r3, r4, r5} @ r0, r1, r2
stm r2,{r3-r5}
ldr r0,[r0, #VCPU_HOST_CTXT]
add r0, r0, #(USR_REGS_OFFSET + S_R4)
ldm r0!,{r4-r12}
ldr lr,[r0, #4]
mov r0, r1
mrs r1, SPSR
mrs r2, ELR_hyp
mrc p15,4, r3, c5, c2,0 @ HSR
/*
* Force loads and stores to complete before unmasking aborts
* and forcing the delivery of the exception. This gives us a
* single instruction window, which the handler will try to
* match.
*/
dsb sy
cpsie a
.global abort_guest_exit_start
abort_guest_exit_start:
isb
.global abort_guest_exit_end
abort_guest_exit_end:/*
* If we took an abort, r0[31] will be set, and cmp will set
* the N bit in PSTATE.
*/
cmp r0, #0
msrmi SPSR_cxsf, r1
msrmi ELR_hyp, r2
mcrmi p15,4, r3, c5, c2,0 @ HSR
bx lr
ENDPROC(__guest_exit)
__guest_exit 的上层函数 : hyp_hvc 和 hyp_irq
arch/arm/kvm/hyp/hyp-entry.S
guest_trap:// hyp_hvc
load_vcpu r0 @ Load VCPU pointer to r0
#ifdefCONFIG_VFPv3
@ Check for a VFP access
lsr r1, r1, #HSR_EC_SHIFT
cmp r1, #HSR_EC_CP_0_13
beq __vfp_guest_restore
#endif
mov r1, #ARM_EXCEPTION_HVC
b __guest_exit
hyp_irq:
push {r0, r1, r2}
mov r1, #ARM_EXCEPTION_IRQ
load_vcpu r0 @ Load VCPU pointer to r0
b __guest_exit
在 541ad0150ca4aa663a2dcb9c834ab493168fe494 将 arm 的kvm 代码 删除了
commit 541ad0150ca4aa663a2dcb9c834ab493168fe494
Author: Marc Zyngier <maz@kernel.org>
Date: Fri Jan 2422:42:152020+0000
arm: Remove 32bit KVM host support
That's it. Remove all references to KVM itself, and document
that although it is no more, the ABI between SVC and HYP still
exists.
具体资料可查看 Documentation/virt/kvm/arm/hyp-abi.rst
作者认为arm-kvm有几个问题
- It is incomplete(no debug support, no PMU)- It hasn't followed any of the architectural evolutions
- It has zero^W very few users(I don't count myself here)- It is more and more getting in the way of new arm64 developments
作者认为
I still don't think we should keep the 32bit port artificially alive for the sake of it, specially considering that the whole of the 32bit architecture is in best effort, maintenance mode.
I'd rather drop KVM support now,while it is still in a decent shape, rather than seeing it bit-rot like it happened for ia64.
作者决定
I also plan to keep maintaining it in the various stable kernels, up to(and including)5.6.