mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-07 14:32:23 +00:00
KVM: arm/arm64: vgic: Add __vgic_put_lpi_locked primitive
Our LPI translation cache needs to be able to drop the refcount on an LPI whilst already holding the lpi_list_lock. Let's add a new primitive for this. Tested-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Marc Zyngier <maz@kernel.org>
This commit is contained in:
parent
24cab82c34
commit
1bb3691d83
@ -119,6 +119,22 @@ static void vgic_irq_release(struct kref *ref)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Drop the refcount on the LPI. Must be called with lpi_list_lock held.
|
||||||
|
*/
|
||||||
|
void __vgic_put_lpi_locked(struct kvm *kvm, struct vgic_irq *irq)
|
||||||
|
{
|
||||||
|
struct vgic_dist *dist = &kvm->arch.vgic;
|
||||||
|
|
||||||
|
if (!kref_put(&irq->refcount, vgic_irq_release))
|
||||||
|
return;
|
||||||
|
|
||||||
|
list_del(&irq->lpi_list);
|
||||||
|
dist->lpi_list_count--;
|
||||||
|
|
||||||
|
kfree(irq);
|
||||||
|
}
|
||||||
|
|
||||||
void vgic_put_irq(struct kvm *kvm, struct vgic_irq *irq)
|
void vgic_put_irq(struct kvm *kvm, struct vgic_irq *irq)
|
||||||
{
|
{
|
||||||
struct vgic_dist *dist = &kvm->arch.vgic;
|
struct vgic_dist *dist = &kvm->arch.vgic;
|
||||||
@ -128,16 +144,8 @@ void vgic_put_irq(struct kvm *kvm, struct vgic_irq *irq)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
raw_spin_lock_irqsave(&dist->lpi_list_lock, flags);
|
raw_spin_lock_irqsave(&dist->lpi_list_lock, flags);
|
||||||
if (!kref_put(&irq->refcount, vgic_irq_release)) {
|
__vgic_put_lpi_locked(kvm, irq);
|
||||||
raw_spin_unlock_irqrestore(&dist->lpi_list_lock, flags);
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
list_del(&irq->lpi_list);
|
|
||||||
dist->lpi_list_count--;
|
|
||||||
raw_spin_unlock_irqrestore(&dist->lpi_list_lock, flags);
|
raw_spin_unlock_irqrestore(&dist->lpi_list_lock, flags);
|
||||||
|
|
||||||
kfree(irq);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void vgic_flush_pending_lpis(struct kvm_vcpu *vcpu)
|
void vgic_flush_pending_lpis(struct kvm_vcpu *vcpu)
|
||||||
|
@ -161,6 +161,7 @@ vgic_get_mmio_region(struct kvm_vcpu *vcpu, struct vgic_io_device *iodev,
|
|||||||
gpa_t addr, int len);
|
gpa_t addr, int len);
|
||||||
struct vgic_irq *vgic_get_irq(struct kvm *kvm, struct kvm_vcpu *vcpu,
|
struct vgic_irq *vgic_get_irq(struct kvm *kvm, struct kvm_vcpu *vcpu,
|
||||||
u32 intid);
|
u32 intid);
|
||||||
|
void __vgic_put_lpi_locked(struct kvm *kvm, struct vgic_irq *irq);
|
||||||
void vgic_put_irq(struct kvm *kvm, struct vgic_irq *irq);
|
void vgic_put_irq(struct kvm *kvm, struct vgic_irq *irq);
|
||||||
bool vgic_get_phys_line_level(struct vgic_irq *irq);
|
bool vgic_get_phys_line_level(struct vgic_irq *irq);
|
||||||
void vgic_irq_set_phys_pending(struct vgic_irq *irq, bool pending);
|
void vgic_irq_set_phys_pending(struct vgic_irq *irq, bool pending);
|
||||||
|
Loading…
Reference in New Issue
Block a user