]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
arm: Make sure to not queue interrupt that were rejected as duplicates
authorJan Kiszka <jan.kiszka@siemens.com>
Thu, 16 Jun 2016 08:33:33 +0000 (10:33 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Thu, 16 Jun 2016 16:41:13 +0000 (18:41 +0200)
If the inject_irq callback detect that an interrupt is already queued
in some list register, do not insert it into the software queue, thus
coalesce the event like real hardware does.

The change in the return code of inject_irq is more cosmetic, to reflect
the meaning better.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
hypervisor/arch/arm/gic-v2.c
hypervisor/arch/arm/gic-v3.c
hypervisor/arch/arm/irqchip.c

index e47c1424eb1cc692f43f3ad88bd0d3a12c1ed70a..6e939fa73bec3c2247184b025a2177a2a7787f1e 100644 (file)
@@ -248,7 +248,7 @@ static int gic_inject_irq(struct per_cpu *cpu_data, struct pending_irq *irq)
                /* Check that there is no overlapping */
                lr = gic_read_lr(i);
                if ((lr & GICH_LR_VIRT_ID_MASK) == irq->virt_id)
-                       return -EINVAL;
+                       return -EEXIST;
        }
 
        if (first_free == -1)
index fe9c261f227a8ba382a4cc2c1ef234ee51ac683f..40526eac7f7927b4908df3e51f6455478832d318 100644 (file)
@@ -367,7 +367,7 @@ static int gic_inject_irq(struct per_cpu *cpu_data, struct pending_irq *irq)
                 * should be sufficient.
                 */
                if ((u32)lr == irq->virt_id)
-                       return -EINVAL;
+                       return -EEXIST;
        }
 
        if (free_lr == -1)
index 518739000065a56ed4a43f813dd2f7b63e688fd3..fb257446f66074ed16cd1a91a9ad9469da3b13c5 100644 (file)
@@ -135,10 +135,8 @@ void irqchip_set_pending(struct per_cpu *cpu_data, u32 irq_id, bool try_inject)
 
        pending.virt_id = irq_id;
 
-       if (try_inject && irqchip.inject_irq(cpu_data, &pending) == 0)
-               return;
-
-       irqchip_insert_pending(cpu_data, &pending);
+       if (!try_inject || irqchip.inject_irq(cpu_data, &pending) == -EBUSY)
+               irqchip_insert_pending(cpu_data, &pending);
 }
 
 /*