ARM: GIC: interface to send a SGI directly
authorNicolas Pitre <nicolas.pitre@linaro.org>
Wed, 28 Nov 2012 23:48:19 +0000 (18:48 -0500)
committerNicolas Pitre <nicolas.pitre@linaro.org>
Wed, 19 Jun 2013 20:54:28 +0000 (16:54 -0400)
The regular gic_raise_softirq() takes as input a CPU mask which is not
adequate when we need to send an IPI to a CPU which is not represented
in the kernel to GIC mapping.  That is the case with the b.L switcher
when GIC migration to the inbound CPU has not yet occurred.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
drivers/irqchip/irq-gic.c
include/linux/irqchip/arm-gic.h

index 8389e381f7cbeb344f67001ffe19c99ba133b7c2..6b01aa00832b02ab2426b4251b1f35b9dc29a3ac 100644 (file)
@@ -667,6 +667,20 @@ void gic_raise_softirq(const struct cpumask *mask, unsigned int irq)
 #endif
 
 #ifdef CONFIG_BL_SWITCHER
+/*
+ * gic_send_sgi - send a SGI directly to given CPU interface number
+ *
+ * cpu_id: the ID for the destination CPU interface
+ * irq: the IPI number to send a SGI for
+ */
+void gic_send_sgi(unsigned int cpu_id, unsigned int irq)
+{
+       BUG_ON(cpu_id >= NR_GIC_CPU_IF);
+       cpu_id = 1 << cpu_id;
+       /* this always happens on GIC0 */
+       writel_relaxed((cpu_id << 16) | irq, gic_data_dist_base(&gic_data[0]) + GIC_DIST_SOFTINT);
+}
+
 /*
  * gic_get_cpu_id - get the CPU interface ID for the specified CPU
  *
index 8de992f6eae2beab150f78350f7a6d12c49156f4..666afc3ca53da7ff043a2ebfdf956d009f3538f0 100644 (file)
@@ -75,6 +75,7 @@ static inline void gic_init(unsigned int nr, int start,
        gic_init_bases(nr, start, dist, cpu, 0, NULL);
 }
 
+void gic_send_sgi(unsigned int cpu_id, unsigned int irq);
 int gic_get_cpu_id(unsigned int cpu);
 void gic_migrate_target(unsigned int new_cpu_id);
 unsigned long gic_get_sgir_physaddr(void);