struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i);
 
                raw_spin_lock_irqsave(&irq->irq_lock, flags);
-               if (test_bit(i, &val)) {
-                       /*
-                        * pending_latch is set irrespective of irq type
-                        * (level or edge) to avoid dependency that VM should
-                        * restore irq config before pending info.
-                        */
-                       irq->pending_latch = true;
-                       vgic_queue_irq_unlock(vcpu->kvm, irq, flags);
-               } else {
+
+               /*
+                * pending_latch is set irrespective of irq type
+                * (level or edge) to avoid dependency that VM should
+                * restore irq config before pending info.
+                */
+               irq->pending_latch = test_bit(i, &val);
+
+               if (irq->hw && vgic_irq_is_sgi(irq->intid)) {
+                       irq_set_irqchip_state(irq->host_irq,
+                                             IRQCHIP_STATE_PENDING,
+                                             irq->pending_latch);
                        irq->pending_latch = false;
-                       raw_spin_unlock_irqrestore(&irq->irq_lock, flags);
                }
 
+               if (irq->pending_latch)
+                       vgic_queue_irq_unlock(vcpu->kvm, irq, flags);
+               else
+                       raw_spin_unlock_irqrestore(&irq->irq_lock, flags);
+
                vgic_put_irq(vcpu->kvm, irq);
        }