static int __init gic_of_init(struct device_node *node,
                              struct device_node *parent)
 {
-       unsigned int cpu_vec, i, gicconfig;
+       unsigned int cpu_vec, i, gicconfig, cl, nclusters;
        unsigned long reserved;
        phys_addr_t gic_base;
        struct resource res;
 
        board_bind_eic_interrupt = &gic_bind_eic_interrupt;
 
-       /* Setup defaults */
-       for (i = 0; i < gic_shared_intrs; i++) {
-               change_gic_pol(i, GIC_POL_ACTIVE_HIGH);
-               change_gic_trig(i, GIC_TRIG_LEVEL);
-               write_gic_rmask(i);
+       /*
+        * Initialise each cluster's GIC shared registers to sane default
+        * values.
+        * Otherwise, the IPI set up will be erased if we move code
+        * to gic_cpu_startup for each cpu.
+        */
+       nclusters = mips_cps_numclusters();
+       for (cl = 0; cl < nclusters; cl++) {
+               if (cl == cpu_cluster(¤t_cpu_data)) {
+                       for (i = 0; i < gic_shared_intrs; i++) {
+                               change_gic_pol(i, GIC_POL_ACTIVE_HIGH);
+                               change_gic_trig(i, GIC_TRIG_LEVEL);
+                               write_gic_rmask(i);
+                       }
+               } else {
+                       mips_cm_lock_other(cl, 0, 0, CM_GCR_Cx_OTHER_BLOCK_GLOBAL);
+                       for (i = 0; i < gic_shared_intrs; i++) {
+                               change_gic_redir_pol(i, GIC_POL_ACTIVE_HIGH);
+                               change_gic_redir_trig(i, GIC_TRIG_LEVEL);
+                               write_gic_redir_rmask(i);
+                       }
+                       mips_cm_unlock_other();
+               }
        }
 
        return cpuhp_setup_state(CPUHP_AP_IRQ_MIPS_GIC_STARTING,