]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: arm64: vgic-v5: Drop defensive checks from vgic_v5_ppi_queue_irq_unlock()
authorMarc Zyngier <maz@kernel.org>
Wed, 20 May 2026 09:19:38 +0000 (10:19 +0100)
committerMarc Zyngier <maz@kernel.org>
Fri, 22 May 2026 09:04:49 +0000 (10:04 +0100)
vgic_v5_ppi_queue_irq_unlock() performs a bunch of sanity checks
that are pretty pointless as there is no code path that can
result in these invariants to be violated. And if they are, a nice
crash is just as instructive than a warning.

Drop what is evidently debug code and simplify the whole thing.

Link: https://lore.kernel.org/r/20260520091949.542365-8-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/vgic/vgic-v5.c

index 757484d2493b2176ccaa552dc4b383a655c2dee3..7916bd8d564ef62628ff2fe376fc6b8a69a0e321 100644 (file)
@@ -238,9 +238,9 @@ static u32 vgic_v5_get_effective_priority_mask(struct kvm_vcpu *vcpu)
 
 /*
  * For GICv5, the PPIs are mostly directly managed by the hardware. We (the
- * hypervisor) handle the pending, active, enable state save/restore, but don't
- * need the PPIs to be queued on a per-VCPU AP list. Therefore, sanity check the
- * state, unlock, and return.
+ * hypervisor) handle the pending, active, enable state save/restore, but
+ * don't need the PPIs to be queued on a per-VCPU AP list. Therefore,
+ * unlock, kick the vcpu and return.
  */
 bool vgic_v5_ppi_queue_irq_unlock(struct kvm *kvm, struct vgic_irq *irq,
                                  unsigned long flags)
@@ -250,12 +250,7 @@ bool vgic_v5_ppi_queue_irq_unlock(struct kvm *kvm, struct vgic_irq *irq,
 
        lockdep_assert_held(&irq->irq_lock);
 
-       if (WARN_ON_ONCE(!__irq_is_ppi(KVM_DEV_TYPE_ARM_VGIC_V5, irq->intid)))
-               goto out_unlock_fail;
-
        vcpu = irq->target_vcpu;
-       if (WARN_ON_ONCE(!vcpu))
-               goto out_unlock_fail;
 
        raw_spin_unlock_irqrestore(&irq->irq_lock, flags);
 
@@ -264,11 +259,6 @@ bool vgic_v5_ppi_queue_irq_unlock(struct kvm *kvm, struct vgic_irq *irq,
        kvm_vcpu_kick(vcpu);
 
        return true;
-
-out_unlock_fail:
-       raw_spin_unlock_irqrestore(&irq->irq_lock, flags);
-
-       return false;
 }
 
 /*