irqchip/gic-v3: Honor forced affinity setting
authorSuzuki K Poulose <suzuki.poulose@arm.com>
Tue, 4 Jul 2017 09:56:35 +0000 (10:56 +0100)
committerMarc Zyngier <marc.zyngier@arm.com>
Tue, 4 Jul 2017 10:11:26 +0000 (11:11 +0100)
Honor the 'force' flag for set_affinity, by selecting a CPU
from the given mask (which may not be reported "online" by
the cpu_online_mask). Some drivers, like ARM PMU, rely on it.

Cc: Marc Zyngier <marc.zyngier@arm.com>
Reported-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
drivers/irqchip/irq-gic-v3.c

index 47630e9998b3df928f37abe0d19586052585308f..5ba64a7584a3eea08d6e505e6bba41f1897cc883 100644 (file)
@@ -640,11 +640,16 @@ static void gic_smp_init(void)
 static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
                            bool force)
 {
-       unsigned int cpu = cpumask_any_and(mask_val, cpu_online_mask);
+       unsigned int cpu;
        void __iomem *reg;
        int enabled;
        u64 val;
 
+       if (force)
+               cpu = cpumask_first(mask_val);
+       else
+               cpu = cpumask_any_and(mask_val, cpu_online_mask);
+
        if (cpu >= nr_cpu_ids)
                return -EINVAL;