Skip to content

Commit

Permalink
KVM: arm/arm64: Guard kvm_vgic_map_is_active against !vgic_initialized
Browse files Browse the repository at this point in the history
If the vgic is not initialized, don't try to grab its spinlocks or
traverse its data structures.

This is important because we soon have to start considering the active
state of a virtual interrupts when doing vcpu_load, which may happen
early on before the vgic is initialized.

Signed-off-by: Christoffer Dall <[email protected]>
Acked-by: Marc Zyngier <[email protected]>
  • Loading branch information
Christoffer Dall authored and chazy committed Nov 6, 2017
1 parent e6d68b0 commit f39d16c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions virt/kvm/arm/vgic/vgic.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,9 @@ bool kvm_vgic_map_is_active(struct kvm_vcpu *vcpu, unsigned int virt_irq)
struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, virt_irq);
bool map_is_active;

if (!vgic_initialized(vcpu->kvm))
return false;

spin_lock(&irq->irq_lock);
map_is_active = irq->hw && irq->active;
spin_unlock(&irq->irq_lock);
Expand Down

0 comments on commit f39d16c

Please sign in to comment.