arm64: hyp-stub: Zero x0 on successful stub handling
authorMarc Zyngier <marc.zyngier@arm.com>
Mon, 3 Apr 2017 18:38:05 +0000 (19:38 +0100)
committerChristoffer Dall <cdall@linaro.org>
Sun, 9 Apr 2017 14:49:35 +0000 (07:49 -0700)
We now return HVC_STUB_ERR when a stub hypercall fails, but we
leave whatever was in x0 on success. Zeroing it on return seems
like a good idea.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <cdall@linaro.org>
arch/arm64/kernel/hyp-stub.S
arch/arm64/kvm/hyp-init.S

index d55604d91e333eb4bfbc21ba6d21fff7376c604d..e1261fbaa374e02471214664df742cb26c4da1d7 100644 (file)
@@ -73,8 +73,10 @@ el1_sync:
 
        /* Someone called kvm_call_hyp() against the hyp-stub... */
        ldr     x0, =HVC_STUB_ERR
+       eret
 
-9:     eret
+9:     mov     x0, xzr
+       eret
 ENDPROC(el1_sync)
 
 .macro invalid_vector  label
index 3734e6315cd7aef6f135d67c7abd5586a73d683e..839425c24b1c7078c7397470aa811286eb119f49 100644 (file)
@@ -154,13 +154,13 @@ reset:
        /* Install stub vectors */
        adr_l   x5, __hyp_stub_vectors
        msr     vbar_el2, x5
-       b       exit
+       mov     x0, xzr
+       eret
 
 1:     /* Bad stub call */
        ldr     x0, =HVC_STUB_ERR
-
-exit:
        eret
+
 ENDPROC(__kvm_handle_stub_hvc)
 
        .ltorg