KVM: arm/arm64: Remove kvm_vgic_inject_mapped_irq
authorChristoffer Dall <christoffer.dall@linaro.org>
Wed, 1 Feb 2017 10:03:45 +0000 (11:03 +0100)
committerChristoffer Dall <christoffer.dall@linaro.org>
Wed, 1 Feb 2017 10:56:35 +0000 (11:56 +0100)
The only benefit of having kvm_vgic_inject_mapped_irq separate from
kvm_vgic_inject_irq is that we pass a boolean that we use for error
checking on the injection path.

While this could potentially help in some aspect of robustness, it's
also a little bit of a defensive move, and arguably callers into the
vgic should have make sure they have marked their virtual IRQs as mapped
if required.

Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
virt/kvm/arm/arch_timer.c
virt/kvm/arm/vgic/vgic.c

index 6a084cd57b883e1c4bb8420bee37ed0a74321d98..91ecf48f7fe2fccf333d8286b8f46b704b3f8881 100644 (file)
@@ -175,7 +175,8 @@ static void kvm_timer_update_irq(struct kvm_vcpu *vcpu, bool new_level)
        timer->irq.level = new_level;
        trace_kvm_timer_update_irq(vcpu->vcpu_id, timer->irq.irq,
                                   timer->irq.level);
-       ret = kvm_vgic_inject_mapped_irq(vcpu->kvm, vcpu->vcpu_id,
+
+       ret = kvm_vgic_inject_irq(vcpu->kvm, vcpu->vcpu_id,
                                         timer->irq.irq,
                                         timer->irq.level);
        WARN_ON(ret);
index dea12df2b879d3002bbb9fbfe5288646c5a8e52c..654dfd40e449cb54afccdc19792b80a7cf59664a 100644 (file)
@@ -335,9 +335,22 @@ retry:
        return true;
 }
 
-static int vgic_update_irq_pending(struct kvm *kvm, int cpuid,
-                                  unsigned int intid, bool level,
-                                  bool mapped_irq)
+/**
+ * kvm_vgic_inject_irq - Inject an IRQ from a device to the vgic
+ * @kvm:     The VM structure pointer
+ * @cpuid:   The CPU for PPIs
+ * @intid:   The INTID to inject a new state to.
+ * @level:   Edge-triggered:  true:  to trigger the interrupt
+ *                           false: to ignore the call
+ *          Level-sensitive  true:  raise the input signal
+ *                           false: lower the input signal
+ *
+ * The VGIC is not concerned with devices being active-LOW or active-HIGH for
+ * level-sensitive interrupts.  You can think of the level parameter as 1
+ * being HIGH and 0 being LOW and all devices being active-HIGH.
+ */
+int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int intid,
+                       bool level)
 {
        struct kvm_vcpu *vcpu;
        struct vgic_irq *irq;
@@ -357,11 +370,6 @@ static int vgic_update_irq_pending(struct kvm *kvm, int cpuid,
        if (!irq)
                return -EINVAL;
 
-       if (irq->hw != mapped_irq) {
-               vgic_put_irq(kvm, irq);
-               return -EINVAL;
-       }
-
        spin_lock(&irq->irq_lock);
 
        if (!vgic_validate_injection(irq, level)) {
@@ -382,32 +390,6 @@ static int vgic_update_irq_pending(struct kvm *kvm, int cpuid,
        return 0;
 }
 
-/**
- * kvm_vgic_inject_irq - Inject an IRQ from a device to the vgic
- * @kvm:     The VM structure pointer
- * @cpuid:   The CPU for PPIs
- * @intid:   The INTID to inject a new state to.
- * @level:   Edge-triggered:  true:  to trigger the interrupt
- *                           false: to ignore the call
- *          Level-sensitive  true:  raise the input signal
- *                           false: lower the input signal
- *
- * The VGIC is not concerned with devices being active-LOW or active-HIGH for
- * level-sensitive interrupts.  You can think of the level parameter as 1
- * being HIGH and 0 being LOW and all devices being active-HIGH.
- */
-int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int intid,
-                       bool level)
-{
-       return vgic_update_irq_pending(kvm, cpuid, intid, level, false);
-}
-
-int kvm_vgic_inject_mapped_irq(struct kvm *kvm, int cpuid, unsigned int intid,
-                              bool level)
-{
-       return vgic_update_irq_pending(kvm, cpuid, intid, level, true);
-}
-
 int kvm_vgic_map_phys_irq(struct kvm_vcpu *vcpu, u32 virt_irq, u32 phys_irq)
 {
        struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, virt_irq);