]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: arm64: Introduce set_direct_injection irq_op
authorSascha Bischoff <Sascha.Bischoff@arm.com>
Thu, 19 Mar 2026 15:56:12 +0000 (15:56 +0000)
committerMarc Zyngier <maz@kernel.org>
Thu, 19 Mar 2026 18:21:28 +0000 (18:21 +0000)
GICv5 adds support for directly injected PPIs. The mechanism for
setting this up is GICv5 specific, so rather than adding
GICv5-specific code to the common vgic code, we introduce a new
irq_op.

This new irq_op is intended to be used to enable or disable direct
injection for interrupts that support it. As it is an irq_op, it has
no effect unless explicitly populated in the irq_ops structure for a
particular interrupt.  The usage is demonstracted in the subsequent
change.

Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Link: https://patch.msgid.link/20260319154937.3619520-26-sascha.bischoff@arm.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/vgic/vgic.c
include/kvm/arm_vgic.h

index d9ca5509147a9c2632b8de56cc21340a46b93f66..9ac0ff60aa8a5d8f4431529b8c6ce5c3722bf8ec 100644 (file)
@@ -608,12 +608,19 @@ static int kvm_vgic_map_irq(struct kvm_vcpu *vcpu, struct vgic_irq *irq,
        irq->hw = true;
        irq->host_irq = host_irq;
        irq->hwintid = data->hwirq;
+
+       if (irq->ops && irq->ops->set_direct_injection)
+               irq->ops->set_direct_injection(vcpu, irq, true);
+
        return 0;
 }
 
 /* @irq->irq_lock must be held */
 static inline void kvm_vgic_unmap_irq(struct vgic_irq *irq)
 {
+       if (irq->ops && irq->ops->set_direct_injection)
+               irq->ops->set_direct_injection(irq->target_vcpu, irq, false);
+
        irq->hw = false;
        irq->hwintid = 0;
 }
index e9797c5dbbf0ccf19c7cd938f20394b3ceede195..a28cf765f3eb5a454d88fe5ae629747d26613888 100644 (file)
@@ -215,6 +215,13 @@ struct irq_ops {
         */
        bool (*queue_irq_unlock)(struct kvm *kvm, struct vgic_irq *irq,
                                unsigned long flags) __releases(&irq->irq_lock);
+
+       /*
+        * Callback function pointer to either enable or disable direct
+        * injection for a mapped interrupt.
+        */
+       void (*set_direct_injection)(struct kvm_vcpu *vcpu,
+                                    struct vgic_irq *irq, bool direct);
 };
 
 struct vgic_irq {