summaryrefslogtreecommitdiffstats
path: root/virt/kvm/arm/vgic/vgic-v3.c
diff options
context:
space:
mode:
authorAndre Przywara2016-07-15 13:43:27 +0200
committerMarc Zyngier2016-07-18 19:10:48 +0200
commit5dd4b924e390af426e424d5e52c1b4d1566af817 (patch)
tree8ed824f7d4811703b70ff10449b11f7257f2c063 /virt/kvm/arm/vgic/vgic-v3.c
parentKVM: kvm_io_bus: Add kvm_io_bus_get_dev() call (diff)
downloadkernel-qcow2-linux-5dd4b924e390af426e424d5e52c1b4d1566af817.tar.gz
kernel-qcow2-linux-5dd4b924e390af426e424d5e52c1b4d1566af817.tar.xz
kernel-qcow2-linux-5dd4b924e390af426e424d5e52c1b4d1566af817.zip
KVM: arm/arm64: vgic: Add refcounting for IRQs
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: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Marc Zyngier <marc.zyngier@arm.com> Tested-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt/kvm/arm/vgic/vgic-v3.c')
-rw-r--r--virt/kvm/arm/vgic/vgic-v3.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c
index e48a22e9ee40..f0ac0642303c 100644
--- a/virt/kvm/arm/vgic/vgic-v3.c
+++ b/virt/kvm/arm/vgic/vgic-v3.c
@@ -113,6 +113,7 @@ void vgic_v3_fold_lr_state(struct kvm_vcpu *vcpu)
}
spin_unlock(&irq->irq_lock);
+ vgic_put_irq(vcpu->kvm, irq);
}
}