irqchip/gicv3-its: Skip irq affinity setting when target cpu is the same as current...
authorMaJun <majun258@huawei.com>
Thu, 18 May 2017 08:19:13 +0000 (16:19 +0800)
committerMarc Zyngier <marc.zyngier@arm.com>
Thu, 22 Jun 2017 13:13:27 +0000 (14:13 +0100)
Just skip the irq affinity setting when the target cpu is the same as
current setting.
This is a small optimization for irq affinity setting logic.

Signed-off-by: MaJun <majun258@huawei.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
drivers/irqchip/irq-gic-v3-its.c

index 45ea193325d22a63266f8f43cc7ff3a555e7da27..b33528026c5c3d839f4864d38e660ef13771a8f3 100644 (file)
@@ -644,9 +644,12 @@ static int its_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
        if (cpu >= nr_cpu_ids)
                return -EINVAL;
 
-       target_col = &its_dev->its->collections[cpu];
-       its_send_movi(its_dev, target_col, id);
-       its_dev->event_map.col_map[id] = cpu;
+       /* don't set the affinity when the target cpu is same as current one */
+       if (cpu != its_dev->event_map.col_map[id]) {
+               target_col = &its_dev->its->collections[cpu];
+               its_send_movi(its_dev, target_col, id);
+               its_dev->event_map.col_map[id] = cpu;
+       }
 
        return IRQ_SET_MASK_OK_DONE;
 }