Merge tag 'v4.4.12' into linux-linaro-lsk-v4.4
[firefly-linux-kernel-4.4.55.git] / drivers / irqchip / irq-gic-v3.c
index d7be6ddc34f685a47dad313274f209b59dff6bf5..2fc499a2207e39573aa13f49c5e9a5abec569ebc 100644 (file)
@@ -361,6 +361,13 @@ static asmlinkage void __exception_irq_entry gic_handle_irq(struct pt_regs *regs
                        if (static_key_true(&supports_deactivate))
                                gic_write_dir(irqnr);
 #ifdef CONFIG_SMP
+                       /*
+                        * Unlike GICv2, we don't need an smp_rmb() here.
+                        * The control dependency from gic_read_iar to
+                        * the ISB in gic_write_eoir is enough to ensure
+                        * that any shared data read by handle_IPI will
+                        * be read after the ACK.
+                        */
                        handle_IPI(irqnr, regs);
 #else
                        WARN_ONCE(true, "Unexpected SGI received!\n");
@@ -380,6 +387,15 @@ static void __init gic_dist_init(void)
        writel_relaxed(0, base + GICD_CTLR);
        gic_dist_wait_for_rwp();
 
+       /*
+        * Configure SPIs as non-secure Group-1. This will only matter
+        * if the GIC only has a single security state. This will not
+        * do the right thing if the kernel is running in secure mode,
+        * but that's not the intended use case anyway.
+        */
+       for (i = 32; i < gic_data.irq_nr; i += 32)
+               writel_relaxed(~0, base + GICD_IGROUPR + i / 8);
+
        gic_dist_config(base, gic_data.irq_nr, gic_dist_wait_for_rwp);
 
        /* Enable distributor with ARE, Group1 */
@@ -494,6 +510,9 @@ static void gic_cpu_init(void)
 
        rbase = gic_data_rdist_sgi_base();
 
+       /* Configure SGIs/PPIs as non-secure Group-1 */
+       writel_relaxed(~0, rbase + GICR_IGROUPR0);
+
        gic_cpu_config(rbase, gic_redist_wait_for_rwp);
 
        /* Give LPIs a spin */