summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2017-10-27 10:28:36 -0400
committerChristoffer Dall <christoffer.dall@linaro.org>2017-11-10 02:51:58 -0500
commit08c9fd04211754a34dddbb1471d6265a717ef7fd (patch)
tree0500ad23bb38fe86db95d77a33d49ed7e818b38b /virt
parentbebfd2a203736a42510ecf48ae82c9d7e801eeb0 (diff)
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 <christoffer.dall@linaro.org> Reviewed-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/arm/vgic/vgic-its.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c
index 1de4e68ef1b6..09accdfed189 100644
--- a/virt/kvm/arm/vgic/vgic-its.c
+++ b/virt/kvm/arm/vgic/vgic-its.c
@@ -336,6 +336,15 @@ static int vgic_copy_lpi_list(struct kvm_vcpu *vcpu, u32 **intid_ptr)
336 return i; 336 return i;
337} 337}
338 338
339static 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
339/* 348/*
340 * Promotes the ITS view of affinity of an ITTE (which redistributor this LPI 349 * Promotes the ITS view of affinity of an ITTE (which redistributor this LPI
341 * is targeting) to the VGIC's view, which deals with target VCPUs. 350 * 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)
350 return; 359 return;
351 360
352 vcpu = kvm_get_vcpu(kvm, ite->collection->target_addr); 361 vcpu = kvm_get_vcpu(kvm, ite->collection->target_addr);
353 362 update_affinity(ite->irq, vcpu);
354 spin_lock(&ite->irq->irq_lock);
355 ite->irq->target_vcpu = vcpu;
356 spin_unlock(&ite->irq->irq_lock);
357} 363}
358 364
359/* 365/*
@@ -696,11 +702,7 @@ static int vgic_its_cmd_handle_movi(struct kvm *kvm, struct vgic_its *its,
696 ite->collection = collection; 702 ite->collection = collection;
697 vcpu = kvm_get_vcpu(kvm, collection->target_addr); 703 vcpu = kvm_get_vcpu(kvm, collection->target_addr);
698 704
699 spin_lock(&ite->irq->irq_lock); 705 return update_affinity(ite->irq, vcpu);
700 ite->irq->target_vcpu = vcpu;
701 spin_unlock(&ite->irq->irq_lock);
702
703 return 0;
704} 706}
705 707
706/* 708/*