KVM: arm64: Remove __activate_vm wrapper
authorAndrew Scull <ascull@google.com>
Tue, 15 Sep 2020 10:46:25 +0000 (11:46 +0100)
committerMarc Zyngier <maz@kernel.org>
Tue, 15 Sep 2020 17:39:01 +0000 (18:39 +0100)
The __activate_vm wrapper serves no useful function and has a misleading
name as it simply calls __load_guest_stage2 and does not touch
HCR_EL2.VM so remove it.

Also rename __deactivate_vm to __load_host_stage2 to match naming
pattern.

Signed-off-by: Andrew Scull <ascull@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200915104643.2543892-2-ascull@google.com
arch/arm64/kvm/hyp/include/hyp/switch.h
arch/arm64/kvm/hyp/nvhe/switch.c
arch/arm64/kvm/hyp/vhe/switch.c

index 5b6b8fa..0864f88 100644 (file)
@@ -126,11 +126,6 @@ static inline void ___deactivate_traps(struct kvm_vcpu *vcpu)
        }
 }
 
-static inline void __activate_vm(struct kvm_s2_mmu *mmu)
-{
-       __load_guest_stage2(mmu);
-}
-
 static inline bool __translate_far_to_hpfar(u64 far, u64 *hpfar)
 {
        u64 par, tmp;
index 0970442..3c9c065 100644 (file)
@@ -93,7 +93,7 @@ static void __deactivate_traps(struct kvm_vcpu *vcpu)
        write_sysreg(CPTR_EL2_DEFAULT, cptr_el2);
 }
 
-static void __deactivate_vm(struct kvm_vcpu *vcpu)
+static void __load_host_stage2(void)
 {
        write_sysreg(0, vttbr_el2);
 }
@@ -194,7 +194,7 @@ int __kvm_vcpu_run(struct kvm_vcpu *vcpu)
        __sysreg32_restore_state(vcpu);
        __sysreg_restore_state_nvhe(guest_ctxt);
 
-       __activate_vm(kern_hyp_va(vcpu->arch.hw_mmu));
+       __load_guest_stage2(kern_hyp_va(vcpu->arch.hw_mmu));
        __activate_traps(vcpu);
 
        __hyp_vgic_restore_state(vcpu);
@@ -219,7 +219,7 @@ int __kvm_vcpu_run(struct kvm_vcpu *vcpu)
        __hyp_vgic_save_state(vcpu);
 
        __deactivate_traps(vcpu);
-       __deactivate_vm(vcpu);
+       __load_host_stage2();
 
        __sysreg_restore_state_nvhe(host_ctxt);
 
@@ -253,7 +253,7 @@ void __noreturn hyp_panic(struct kvm_cpu_context *host_ctxt)
        if (read_sysreg(vttbr_el2)) {
                __timer_disable_traps(vcpu);
                __deactivate_traps(vcpu);
-               __deactivate_vm(vcpu);
+               __load_host_stage2();
                __sysreg_restore_state_nvhe(host_ctxt);
        }
 
index c1da4f8..6636522 100644 (file)
@@ -120,12 +120,12 @@ static int __kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu)
         * HCR_EL2.TGE.
         *
         * We have already configured the guest's stage 1 translation in
-        * kvm_vcpu_load_sysregs_vhe above.  We must now call __activate_vm
-        * before __activate_traps, because __activate_vm configures
-        * stage 2 translation, and __activate_traps clear HCR_EL2.TGE
-        * (among other things).
+        * kvm_vcpu_load_sysregs_vhe above.  We must now call
+        * __load_guest_stage2 before __activate_traps, because
+        * __load_guest_stage2 configures stage 2 translation, and
+        * __activate_traps clear HCR_EL2.TGE (among other things).
         */
-       __activate_vm(vcpu->arch.hw_mmu);
+       __load_guest_stage2(vcpu->arch.hw_mmu);
        __activate_traps(vcpu);
 
        sysreg_restore_guest_state_vhe(guest_ctxt);