KVM: arm64: Restore mdcr_el2 from vcpu
[linux-2.6-microblaze.git] / arch / arm64 / kvm / hyp / vhe / switch.c
index b322992..ec158fa 100644 (file)
@@ -91,17 +91,13 @@ void activate_traps_vhe_load(struct kvm_vcpu *vcpu)
        __activate_traps_common(vcpu);
 }
 
-void deactivate_traps_vhe_put(void)
+void deactivate_traps_vhe_put(struct kvm_vcpu *vcpu)
 {
-       u64 mdcr_el2 = read_sysreg(mdcr_el2);
+       vcpu->arch.mdcr_el2_host &= MDCR_EL2_HPMN_MASK |
+                                   MDCR_EL2_E2PB_MASK << MDCR_EL2_E2PB_SHIFT |
+                                   MDCR_EL2_TPMS;
 
-       mdcr_el2 &= MDCR_EL2_HPMN_MASK |
-                   MDCR_EL2_E2PB_MASK << MDCR_EL2_E2PB_SHIFT |
-                   MDCR_EL2_TPMS;
-
-       write_sysreg(mdcr_el2, mdcr_el2);
-
-       __deactivate_traps_common();
+       __deactivate_traps_common(vcpu);
 }
 
 /* Switch to the guest for VHE systems running in EL2 */