• Andre Przywara's avatar
    KVM: arm/arm64: vgic: Add refcounting for IRQs · 5dd4b924
    Andre Przywara authored
    In the moment our struct vgic_irq's are statically allocated at guest
    creation time. So getting a pointer to an IRQ structure is trivial and
    safe. LPIs are more dynamic, they can be mapped and unmapped at any time
    during the guest's _runtime_.
    In preparation for supporting LPIs we introduce reference counting for
    those structures using the kernel's kref infrastructure.
    Since private IRQs and SPIs are statically allocated, we avoid actually
    refcounting them, since they would never be released anyway.
    But we take provisions to increase the refcount when an IRQ gets onto a
    VCPU list and decrease it when it gets removed. Also this introduces
    vgic_put_irq(), which wraps kref_put and hides the release function from
    the callers.
    Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
    Reviewed-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
    Tested-by: default avatarEric Auger <eric.auger@redhat.com>
    Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
    5dd4b924
vgic-v2.c 9.47 KB