aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/arm/vgic.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
index d862ea502167..e373b76c5420 100644
--- a/virt/kvm/arm/vgic.c
+++ b/virt/kvm/arm/vgic.c
@@ -1694,16 +1694,26 @@ out:
1694int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int irq_num, 1694int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int irq_num,
1695 bool level) 1695 bool level)
1696{ 1696{
1697 int ret = 0;
1697 int vcpu_id; 1698 int vcpu_id;
1698 1699
1699 if (likely(vgic_ready(kvm))) { 1700 if (unlikely(!vgic_initialized(kvm))) {
1700 vcpu_id = vgic_update_irq_pending(kvm, cpuid, irq_num, level); 1701 mutex_lock(&kvm->lock);
1701 if (vcpu_id >= 0) 1702 ret = vgic_init(kvm);
1702 /* kick the specified vcpu */ 1703 mutex_unlock(&kvm->lock);
1703 kvm_vcpu_kick(kvm_get_vcpu(kvm, vcpu_id)); 1704
1705 if (ret)
1706 goto out;
1704 } 1707 }
1705 1708
1706 return 0; 1709 vcpu_id = vgic_update_irq_pending(kvm, cpuid, irq_num, level);
1710 if (vcpu_id >= 0) {
1711 /* kick the specified vcpu */
1712 kvm_vcpu_kick(kvm_get_vcpu(kvm, vcpu_id));
1713 }
1714
1715out:
1716 return ret;
1707} 1717}
1708 1718
1709static irqreturn_t vgic_maintenance_handler(int irq, void *data) 1719static irqreturn_t vgic_maintenance_handler(int irq, void *data)