Skip to content

Commit 08c9fd0

Browse files
Marc Zyngierchazy
authored andcommitted
KVM: arm/arm64: vITS: Add a helper to update the affinity of an LPI
In order to help integrating the vITS code with GICv4, let's add a new helper that deals with updating the affinity of an LPI, which will later be augmented with super duper extra GICv4 goodness. Reviewed-by: Christoffer Dall <[email protected]> Reviewed-by: Eric Auger <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Signed-off-by: Christoffer Dall <[email protected]>
1 parent bebfd2a commit 08c9fd0

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

virt/kvm/arm/vgic/vgic-its.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,15 @@ static int vgic_copy_lpi_list(struct kvm_vcpu *vcpu, u32 **intid_ptr)
336336
return i;
337337
}
338338

339+
static int update_affinity(struct vgic_irq *irq, struct kvm_vcpu *vcpu)
340+
{
341+
spin_lock(&irq->irq_lock);
342+
irq->target_vcpu = vcpu;
343+
spin_unlock(&irq->irq_lock);
344+
345+
return 0;
346+
}
347+
339348
/*
340349
* Promotes the ITS view of affinity of an ITTE (which redistributor this LPI
341350
* is targeting) to the VGIC's view, which deals with target VCPUs.
@@ -350,10 +359,7 @@ static void update_affinity_ite(struct kvm *kvm, struct its_ite *ite)
350359
return;
351360

352361
vcpu = kvm_get_vcpu(kvm, ite->collection->target_addr);
353-
354-
spin_lock(&ite->irq->irq_lock);
355-
ite->irq->target_vcpu = vcpu;
356-
spin_unlock(&ite->irq->irq_lock);
362+
update_affinity(ite->irq, vcpu);
357363
}
358364

359365
/*
@@ -696,11 +702,7 @@ static int vgic_its_cmd_handle_movi(struct kvm *kvm, struct vgic_its *its,
696702
ite->collection = collection;
697703
vcpu = kvm_get_vcpu(kvm, collection->target_addr);
698704

699-
spin_lock(&ite->irq->irq_lock);
700-
ite->irq->target_vcpu = vcpu;
701-
spin_unlock(&ite->irq->irq_lock);
702-
703-
return 0;
705+
return update_affinity(ite->irq, vcpu);
704706
}
705707

706708
/*

0 commit comments

Comments
 (0)