KVM: arm64: gic: Introduce set_pending_state() to irq_ops

There are times, such as with GICv5 SPIs and LPIs, where the hardware
itself manages parts of the interrupt lifecycle. This means that
pending state can be directly communicated to the hardware instead of
being represented only in the VGIC shadow state.

In order to accommodate cases where the hardware handles pending state
directly, add a new set_pending_state() function pointer to
irq_ops. The intent is for this to be used after the VGIC shadow
pending state has changed, allowing the backend to mirror the updated
state into hardware.

This new function is plumbed into kvm_vgic_inject_irq(), and is only
called if irq_ops are provided and this function pointer is explicitly
set. In the general case, this has no effect.

Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Link: https://patch.msgid.link/20260904113404.4051341-27-sascha.bischoff@arm.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
This commit is contained in:
Sascha Bischoff 2026-09-04 11:47:28 +00:00 committed by Marc Zyngier
parent 32b253d304
commit 7e9e2aaca2
2 changed files with 9 additions and 0 deletions

View File

@ -565,6 +565,9 @@ int kvm_vgic_inject_irq(struct kvm *kvm, struct kvm_vcpu *vcpu,
else
irq->pending_latch = true;
if (irq->ops && irq->ops->set_pending_state)
WARN_ON_ONCE(!irq->ops->set_pending_state(vcpu, irq));
vgic_queue_irq_unlock(kvm, irq, flags);
vgic_put_irq(kvm, irq);

View File

@ -246,6 +246,12 @@ struct irq_ops {
*/
bool (*get_input_level)(int vintid);
/*
* Function pointer to directly update hardware pending state after the
* VGIC shadow pending state has changed.
*/
bool (*set_pending_state)(struct kvm_vcpu *vcpu, struct vgic_irq *irq);
/*
* Function pointer to override the queuing of an IRQ.
*/