diff options
author | Christoffer Dall <christoffer.dall@linaro.org> | 2016-09-27 12:53:35 -0400 |
---|---|---|
committer | Christoffer Dall <christoffer.dall@linaro.org> | 2016-09-27 12:57:35 -0400 |
commit | 0099b7701f5296a758d9e6b945ec96f96847cc2f (patch) | |
tree | b476db568803208d16c52d23ce90022b9863c743 /virt | |
parent | 6fe407f2d18a4f94216263f91cb7d1f08fa5887c (diff) |
KVM: arm/arm64: vgic: Don't flush/sync without a working vgic
If the vgic hasn't been created and initialized, we shouldn't attempt to
look at its data structures or flush/sync anything to the GIC hardware.
This fixes an issue reported by Alexander Graf when using a userspace
irqchip.
Fixes: 0919e84c0fc1 ("KVM: arm/arm64: vgic-new: Add IRQ sync/flush framework")
Cc: stable@vger.kernel.org
Reported-by: Alexander Graf <agraf@suse.de>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/arm/vgic/vgic.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c index 8a529a732941..2893d5ba523a 100644 --- a/virt/kvm/arm/vgic/vgic.c +++ b/virt/kvm/arm/vgic/vgic.c | |||
@@ -645,6 +645,9 @@ next: | |||
645 | /* Sync back the hardware VGIC state into our emulation after a guest's run. */ | 645 | /* Sync back the hardware VGIC state into our emulation after a guest's run. */ |
646 | void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) | 646 | void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) |
647 | { | 647 | { |
648 | if (unlikely(!vgic_initialized(vcpu->kvm))) | ||
649 | return; | ||
650 | |||
648 | vgic_process_maintenance_interrupt(vcpu); | 651 | vgic_process_maintenance_interrupt(vcpu); |
649 | vgic_fold_lr_state(vcpu); | 652 | vgic_fold_lr_state(vcpu); |
650 | vgic_prune_ap_list(vcpu); | 653 | vgic_prune_ap_list(vcpu); |
@@ -653,6 +656,9 @@ void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) | |||
653 | /* Flush our emulation state into the GIC hardware before entering the guest. */ | 656 | /* Flush our emulation state into the GIC hardware before entering the guest. */ |
654 | void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu) | 657 | void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu) |
655 | { | 658 | { |
659 | if (unlikely(!vgic_initialized(vcpu->kvm))) | ||
660 | return; | ||
661 | |||
656 | spin_lock(&vcpu->arch.vgic_cpu.ap_list_lock); | 662 | spin_lock(&vcpu->arch.vgic_cpu.ap_list_lock); |
657 | vgic_flush_lr_state(vcpu); | 663 | vgic_flush_lr_state(vcpu); |
658 | spin_unlock(&vcpu->arch.vgic_cpu.ap_list_lock); | 664 | spin_unlock(&vcpu->arch.vgic_cpu.ap_list_lock); |