Skip to content

Commit 9880835

Browse files
committed
KVM: arm64: vgic: Get rid of the LPI linked-list
All readers of LPI configuration have been transitioned to use the LPI xarray. Get rid of the linked-list altogether. Reviewed-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent 2798683 commit 9880835

File tree

4 files changed

+2
-10
lines changed

4 files changed

+2
-10
lines changed

arch/arm64/kvm/vgic/vgic-init.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ void kvm_vgic_early_init(struct kvm *kvm)
5353
{
5454
struct vgic_dist *dist = &kvm->arch.vgic;
5555

56-
INIT_LIST_HEAD(&dist->lpi_list_head);
5756
INIT_LIST_HEAD(&dist->lpi_translation_cache);
5857
raw_spin_lock_init(&dist->lpi_list_lock);
5958
xa_init_flags(&dist->lpi_xa, XA_FLAGS_LOCK_IRQ);

arch/arm64/kvm/vgic/vgic-its.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ static struct vgic_irq *vgic_add_lpi(struct kvm *kvm, u32 intid,
5858
return ERR_PTR(ret);
5959
}
6060

61-
INIT_LIST_HEAD(&irq->lpi_list);
6261
INIT_LIST_HEAD(&irq->ap_list);
6362
raw_spin_lock_init(&irq->irq_lock);
6463

@@ -74,10 +73,8 @@ static struct vgic_irq *vgic_add_lpi(struct kvm *kvm, u32 intid,
7473
* There could be a race with another vgic_add_lpi(), so we need to
7574
* check that we don't add a second list entry with the same LPI.
7675
*/
77-
list_for_each_entry(oldirq, &dist->lpi_list_head, lpi_list) {
78-
if (oldirq->intid != intid)
79-
continue;
80-
76+
oldirq = xa_load(&dist->lpi_xa, intid);
77+
if (oldirq) {
8178
/* Someone was faster with adding this LPI, lets use that. */
8279
kfree(irq);
8380
irq = oldirq;
@@ -99,7 +96,6 @@ static struct vgic_irq *vgic_add_lpi(struct kvm *kvm, u32 intid,
9996
goto out_unlock;
10097
}
10198

102-
list_add_tail(&irq->lpi_list, &dist->lpi_list_head);
10399
dist->lpi_list_count++;
104100

105101
out_unlock:

arch/arm64/kvm/vgic/vgic.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ void __vgic_put_lpi_locked(struct kvm *kvm, struct vgic_irq *irq)
122122
if (!kref_put(&irq->refcount, vgic_irq_release))
123123
return;
124124

125-
list_del(&irq->lpi_list);
126125
xa_erase(&dist->lpi_xa, irq->intid);
127126
dist->lpi_list_count--;
128127

include/kvm/arm_vgic.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ struct irq_ops {
117117

118118
struct vgic_irq {
119119
raw_spinlock_t irq_lock; /* Protects the content of the struct */
120-
struct list_head lpi_list; /* Used to link all LPIs together */
121120
struct list_head ap_list;
122121

123122
struct kvm_vcpu *vcpu; /* SGIs and PPIs: The VCPU
@@ -277,7 +276,6 @@ struct vgic_dist {
277276
/* Protects the lpi_list and the count value below. */
278277
raw_spinlock_t lpi_list_lock;
279278
struct xarray lpi_xa;
280-
struct list_head lpi_list_head;
281279
int lpi_list_count;
282280

283281
/* LPI translation cache */

0 commit comments

Comments
 (0)