Skip to content

Commit 11f4f8f

Browse files
ouptonMarc Zyngier
authored andcommitted
KVM: arm64: vgic-its: Walk LPI xarray in vgic_its_cmd_handle_movall()
The new LPI xarray makes it possible to walk the VM's LPIs without holding a lock, meaning that vgic_copy_lpi_list() is no longer necessary. Prepare for the deletion by walking the LPI xarray directly in vgic_its_cmd_handle_movall(). Signed-off-by: Oliver Upton <oliver.upton@linux.dev> Link: https://lore.kernel.org/r/20240422200158.2606761-5-oliver.upton@linux.dev Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent c64115c commit 11f4f8f

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,10 +1420,10 @@ static int vgic_its_cmd_handle_invall(struct kvm *kvm, struct vgic_its *its,
14201420
static int vgic_its_cmd_handle_movall(struct kvm *kvm, struct vgic_its *its,
14211421
u64 *its_cmd)
14221422
{
1423+
struct vgic_dist *dist = &kvm->arch.vgic;
14231424
struct kvm_vcpu *vcpu1, *vcpu2;
14241425
struct vgic_irq *irq;
1425-
u32 *intids;
1426-
int irq_count, i;
1426+
unsigned long intid;
14271427

14281428
/* We advertise GITS_TYPER.PTA==0, making the address the vcpu ID */
14291429
vcpu1 = kvm_get_vcpu_by_id(kvm, its_cmd_get_target_addr(its_cmd));
@@ -1435,12 +1435,8 @@ static int vgic_its_cmd_handle_movall(struct kvm *kvm, struct vgic_its *its,
14351435
if (vcpu1 == vcpu2)
14361436
return 0;
14371437

1438-
irq_count = vgic_copy_lpi_list(kvm, vcpu1, &intids);
1439-
if (irq_count < 0)
1440-
return irq_count;
1441-
1442-
for (i = 0; i < irq_count; i++) {
1443-
irq = vgic_get_irq(kvm, NULL, intids[i]);
1438+
xa_for_each(&dist->lpi_xa, intid, irq) {
1439+
irq = vgic_get_irq(kvm, NULL, intid);
14441440
if (!irq)
14451441
continue;
14461442

@@ -1451,7 +1447,6 @@ static int vgic_its_cmd_handle_movall(struct kvm *kvm, struct vgic_its *its,
14511447

14521448
vgic_its_invalidate_cache(kvm);
14531449

1454-
kfree(intids);
14551450
return 0;
14561451
}
14571452

0 commit comments

Comments
 (0)