Commit 5fbe9a59 authored by Marc Zyngier's avatar Marc Zyngier Committed by Christoffer Dall
Browse files

arm64: KVM: Allow the main HYP code to use the init hyp stub implementation

We now have a full hyp-stub implementation in the KVM init code,
but the main KVM code only supports HVC_GET_VECTORS, which is not

Instead of reinventing the wheel, let's reuse the init implementation
by branching to the idmap page when called with a hyp-stub hypercall.

Acked-by: default avatarCatalin Marinas <>
Reviewed-by: default avatarJames Morse <>
Signed-off-by: default avatarMarc Zyngier <>
Signed-off-by: default avatarChristoffer Dall <>
parent 82529d9b
......@@ -87,10 +87,24 @@ alternative_endif
/* Here, we're pretty sure the host called HVC. */
ldp x0, x1, [sp], #16
cmp x0, #HVC_GET_VECTORS 1f
mrs x0, vbar_el2
b 2f
/* Check for a stub HVC call */
b.hs 1f
* Compute the idmap address of __kvm_handle_stub_hvc and
* jump there. Since we use kimage_voffset, do not use the
* HYP VA for __kvm_handle_stub_hvc, but the kernel VA instead
* (by loading it from the constant pool).
* Preserve x0-x4, which may contain stub parameters.
ldr x5, =__kvm_handle_stub_hvc
ldr_l x6, kimage_voffset
/* x5 = __pa(x5) */
sub x5, x5, x6
br x5
......@@ -99,7 +113,7 @@ alternative_endif
kern_hyp_va x0
2: eret
Supports Markdown
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