summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorChristoffer Dall <cdall@linaro.org>2016-10-19 12:40:17 +0200
committerChristoffer Dall <christoffer.dall@linaro.org>2017-11-06 16:23:09 +0100
commitf39d16cbabf9f939745a3850a33760910d22ef35 (patch)
tree816939a7baa570c234d5c89757ee9364bb00cf8a /virt
parente6d68b00e989f27116fd8575f1f9c217873e9b0e (diff)
downloadop-kernel-dev-f39d16cbabf9f939745a3850a33760910d22ef35.zip
op-kernel-dev-f39d16cbabf9f939745a3850a33760910d22ef35.tar.gz
KVM: arm/arm64: Guard kvm_vgic_map_is_active against !vgic_initialized
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 <cdall@linaro.org> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/arm/vgic/vgic.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c
index fed717e..e1f7dbc 100644
--- a/virt/kvm/arm/vgic/vgic.c
+++ b/virt/kvm/arm/vgic/vgic.c
@@ -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);
OpenPOWER on IntegriCloud