KVM: arm/arm64: vgic: avoid map in kvm_vgic_inject_mapped_irq()
authorAndre Przywara <andre.przywara@arm.com>
Wed, 13 Apr 2016 08:48:02 +0000 (09:48 +0100)
committerChristoffer Dall <christoffer.dall@linaro.org>
Fri, 20 May 2016 13:39:37 +0000 (15:39 +0200)
When we want to inject a hardware mapped IRQ into a guest, we actually
only need the virtual IRQ number from the irq_phys_map.
So let's pass this number directly from the arch timer to the VGIC
to avoid using the map as a parameter.

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 be6037aa703dfe245199780660b007b94a9a36d5..e22f01507e2bacf965efc831c3d75f225beccd45 100644 (file)
@@ -342,7 +342,7 @@ void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu);
 int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int irq_num,
                        bool level);
 int kvm_vgic_inject_mapped_irq(struct kvm *kvm, int cpuid,
-                              struct irq_phys_map *map, bool level);
+                              unsigned int virt_irq, bool level);
 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,
index 409db3304471766fb80a5b3843d3ac2310731c8e..a9c6c1c59d38e2b367bdfcebd287ebda6a3515a2 100644 (file)
@@ -177,7 +177,7 @@ static void kvm_timer_update_irq(struct kvm_vcpu *vcpu, bool new_level)
        trace_kvm_timer_update_irq(vcpu->vcpu_id, timer->map->virt_irq,
                                   timer->irq.level);
        ret = kvm_vgic_inject_mapped_irq(vcpu->kvm, vcpu->vcpu_id,
-                                        timer->map,
+                                        timer->map->virt_irq,
                                         timer->irq.level);
        WARN_ON(ret);
 }
index f6c61720763da76b312b395f687d2c74b4da4dc9..81c557c0c3fd12ecc49b8d8abe77ba55fb5110ad 100644 (file)
@@ -1666,7 +1666,7 @@ int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int irq_num,
  * kvm_vgic_inject_mapped_irq - Inject a physically mapped IRQ to the vgic
  * @kvm:     The VM structure pointer
  * @cpuid:   The CPU for PPIs
- * @map:     Pointer to a irq_phys_map structure describing the mapping
+ * @virt_irq: The virtual IRQ to be injected
  * @level:   Edge-triggered:  true:  to trigger the interrupt
  *                           false: to ignore the call
  *          Level-sensitive  true:  raise the input signal
@@ -1677,7 +1677,7 @@ int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int irq_num,
  * being HIGH and 0 being LOW and all devices being active-HIGH.
  */
 int kvm_vgic_inject_mapped_irq(struct kvm *kvm, int cpuid,
-                              struct irq_phys_map *map, bool level)
+                              unsigned int virt_irq, bool level)
 {
        int ret;
 
@@ -1685,7 +1685,7 @@ int kvm_vgic_inject_mapped_irq(struct kvm *kvm, int cpuid,
        if (ret)
                return ret;
 
-       return vgic_update_irq_pending(kvm, cpuid, map->virt_irq, level);
+       return vgic_update_irq_pending(kvm, cpuid, virt_irq, level);
 }
 
 static irqreturn_t vgic_maintenance_handler(int irq, void *data)