KVM: arm/arm64: vgic: avoid map in kvm_vgic_unmap_phys_irq()
authorAndre Przywara <andre.przywara@arm.com>
Wed, 13 Apr 2016 09:04:06 +0000 (10:04 +0100)
committerChristoffer Dall <christoffer.dall@linaro.org>
Fri, 20 May 2016 13:39:38 +0000 (15:39 +0200)
kvm_vgic_unmap_phys_irq() only needs the virtual IRQ number, so let's
just pass that between the arch timer and the VGIC to get rid of
the irq_phys_map pointer.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Eric Auger <eric.auger@linaro.org>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
include/kvm/arm_vgic.h
virt/kvm/arm/arch_timer.c
virt/kvm/arm/vgic.c

index 9830232c453bcb112130f2fe900e9f078f9bfd00..c7bb184c79eba50112d57e8cdd208d50605d10ee 100644 (file)
@@ -347,7 +347,7 @@ void vgic_v3_dispatch_sgi(struct kvm_vcpu *vcpu, u64 reg);
 int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu);
 struct irq_phys_map *kvm_vgic_map_phys_irq(struct kvm_vcpu *vcpu,
                                           int virt_irq, int irq);
-int kvm_vgic_unmap_phys_irq(struct kvm_vcpu *vcpu, struct irq_phys_map *map);
+int kvm_vgic_unmap_phys_irq(struct kvm_vcpu *vcpu, unsigned int virt_irq);
 bool kvm_vgic_map_is_active(struct kvm_vcpu *vcpu, unsigned int virt_irq);
 
 #define irqchip_in_kernel(k)   (!!((k)->arch.vgic.in_kernel))
index 37f82c1c6bb76b75bf2b9c905a4059caca34a6dc..962b442d0d773ec6b610f557ed52dadff39818ac 100644 (file)
@@ -486,7 +486,7 @@ void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu)
 
        timer_disarm(timer);
        if (timer->map)
-               kvm_vgic_unmap_phys_irq(vcpu, timer->map);
+               kvm_vgic_unmap_phys_irq(vcpu, timer->map->virt_irq);
 }
 
 void kvm_timer_enable(struct kvm *kvm)
index 2fd43a6146a92c654c860f051097714d6c11bac9..06abd59dcbe300d6d123c8f266895eb79698e933 100644 (file)
@@ -1812,25 +1812,22 @@ static void vgic_free_phys_irq_map_rcu(struct rcu_head *rcu)
 /**
  * kvm_vgic_unmap_phys_irq - Remove a virtual to physical IRQ mapping
  * @vcpu: The VCPU pointer
- * @map: The pointer to a mapping obtained through kvm_vgic_map_phys_irq
+ * @virt_irq: The virtual IRQ number to be unmapped
  *
  * Remove an existing mapping between virtual and physical interrupts.
  */
-int kvm_vgic_unmap_phys_irq(struct kvm_vcpu *vcpu, struct irq_phys_map *map)
+int kvm_vgic_unmap_phys_irq(struct kvm_vcpu *vcpu, unsigned int virt_irq)
 {
        struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
        struct irq_phys_map_entry *entry;
        struct list_head *root;
 
-       if (!map)
-               return -EINVAL;
-
-       root = vgic_get_irq_phys_map_list(vcpu, map->virt_irq);
+       root = vgic_get_irq_phys_map_list(vcpu, virt_irq);
 
        spin_lock(&dist->irq_phys_map_lock);
 
        list_for_each_entry(entry, root, entry) {
-               if (&entry->map == map) {
+               if (entry->map.virt_irq == virt_irq) {
                        list_del_rcu(&entry->entry);
                        call_rcu(&entry->rcu, vgic_free_phys_irq_map_rcu);
                        break;