These changes are a raw update to a vanilla kernel 4.1.10, with the
[kvmfornfv.git] / kernel / arch / arm64 / kvm / hyp.S
index 5befd01..64f9e60 100644 (file)
        mrs     x3, cntv_ctl_el0
        and     x3, x3, #3
        str     w3, [x0, #VCPU_TIMER_CNTV_CTL]
-       bic     x3, x3, #1              // Clear Enable
-       msr     cntv_ctl_el0, x3
 
        isb
 
        str     x3, [x0, #VCPU_TIMER_CNTV_CVAL]
 
 1:
+       // Disable the virtual timer
+       msr     cntv_ctl_el0, xzr
+
        // Allow physical timer/counter access for the host
        mrs     x2, cnthctl_el2
        orr     x2, x2, #3
@@ -947,13 +948,15 @@ ENTRY(__kvm_vcpu_run)
        // Guest context
        add     x2, x0, #VCPU_CONTEXT
 
+       // We must restore the 32-bit state before the sysregs, thanks
+       // to Cortex-A57 erratum #852523.
+       restore_guest_32bit_state
        bl __restore_sysregs
        bl __restore_fpsimd
 
        skip_debug_state x3, 1f
        bl      __restore_debug
 1:
-       restore_guest_32bit_state
        restore_guest_regs
 
        // That's it, no more messing around.