KVM: arm/arm64: vgic: Don't flush/sync without a working vgic
[deliverable/linux.git] / virt / kvm / arm / vgic / vgic.c
index e83b7fe4baaed1e1c5bc5f7fd520995002186b61..b465ac6d5d4885ea637fa4eb31348dc3ae59f297 100644 (file)
@@ -645,6 +645,9 @@ next:
 /* Sync back the hardware VGIC state into our emulation after a guest's run. */
 void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu)
 {
+       if (unlikely(!vgic_initialized(vcpu->kvm)))
+               return;
+
        vgic_process_maintenance_interrupt(vcpu);
        vgic_fold_lr_state(vcpu);
        vgic_prune_ap_list(vcpu);
@@ -653,6 +656,9 @@ void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu)
 /* Flush our emulation state into the GIC hardware before entering the guest. */
 void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu)
 {
+       if (unlikely(!vgic_initialized(vcpu->kvm)))
+               return;
+
        spin_lock(&vcpu->arch.vgic_cpu.ap_list_lock);
        vgic_flush_lr_state(vcpu);
        spin_unlock(&vcpu->arch.vgic_cpu.ap_list_lock);
This page took 0.0246 seconds and 5 git commands to generate.