Skip to content

Commit c64115c

Browse files
ouptonMarc Zyngier
authored andcommitted
KVM: arm64: vgic-its: Walk LPI xarray in vgic_its_invall()
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_invall(). Signed-off-by: Oliver Upton <oliver.upton@linux.dev> Link: https://lore.kernel.org/r/20240422200158.2606761-4-oliver.upton@linux.dev Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent 720f73b commit c64115c

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,23 +1365,19 @@ static int vgic_its_cmd_handle_inv(struct kvm *kvm, struct vgic_its *its,
13651365
int vgic_its_invall(struct kvm_vcpu *vcpu)
13661366
{
13671367
struct kvm *kvm = vcpu->kvm;
1368-
int irq_count, i = 0;
1369-
u32 *intids;
1370-
1371-
irq_count = vgic_copy_lpi_list(kvm, vcpu, &intids);
1372-
if (irq_count < 0)
1373-
return irq_count;
1368+
struct vgic_dist *dist = &kvm->arch.vgic;
1369+
struct vgic_irq *irq;
1370+
unsigned long intid;
13741371

1375-
for (i = 0; i < irq_count; i++) {
1376-
struct vgic_irq *irq = vgic_get_irq(kvm, NULL, intids[i]);
1372+
xa_for_each(&dist->lpi_xa, intid, irq) {
1373+
irq = vgic_get_irq(kvm, NULL, intid);
13771374
if (!irq)
13781375
continue;
1376+
13791377
update_lpi_config(kvm, irq, vcpu, false);
13801378
vgic_put_irq(kvm, irq);
13811379
}
13821380

1383-
kfree(intids);
1384-
13851381
if (vcpu->arch.vgic_cpu.vgic_v3.its_vpe.its_vm)
13861382
its_invall_vpe(&vcpu->arch.vgic_cpu.vgic_v3.its_vpe);
13871383

0 commit comments

Comments
 (0)