Skip to content

Commit c7c0d13

Browse files
icebergfuKAGA-KOKO
authored andcommitted
irqchip/mips-gic: Setup defaults in each cluster
In multi-cluster MIPS I6500 systems, there is a GIC per cluster. The default shared interrupt setup configured in gic_of_init() applies only to the GIC in the cluster containing the boot CPU, leaving the GICs of other clusters unconfigured. Configure the other clusters as well. Signed-off-by: Chao-ying Fu <[email protected]> Signed-off-by: Dragan Mladjenovic <[email protected]> Signed-off-by: Aleksandar Rikalo <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Serge Semin <[email protected]> Tested-by: Gregory CLEMENT <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent d9e2ed6 commit c7c0d13

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

drivers/irqchip/irq-mips-gic.c

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ static int gic_cpu_startup(unsigned int cpu)
764764
static int __init gic_of_init(struct device_node *node,
765765
struct device_node *parent)
766766
{
767-
unsigned int cpu_vec, i, gicconfig;
767+
unsigned int cpu_vec, i, gicconfig, cl, nclusters;
768768
unsigned long reserved;
769769
phys_addr_t gic_base;
770770
struct resource res;
@@ -845,11 +845,29 @@ static int __init gic_of_init(struct device_node *node,
845845

846846
board_bind_eic_interrupt = &gic_bind_eic_interrupt;
847847

848-
/* Setup defaults */
849-
for (i = 0; i < gic_shared_intrs; i++) {
850-
change_gic_pol(i, GIC_POL_ACTIVE_HIGH);
851-
change_gic_trig(i, GIC_TRIG_LEVEL);
852-
write_gic_rmask(i);
848+
/*
849+
* Initialise each cluster's GIC shared registers to sane default
850+
* values.
851+
* Otherwise, the IPI set up will be erased if we move code
852+
* to gic_cpu_startup for each cpu.
853+
*/
854+
nclusters = mips_cps_numclusters();
855+
for (cl = 0; cl < nclusters; cl++) {
856+
if (cl == cpu_cluster(&current_cpu_data)) {
857+
for (i = 0; i < gic_shared_intrs; i++) {
858+
change_gic_pol(i, GIC_POL_ACTIVE_HIGH);
859+
change_gic_trig(i, GIC_TRIG_LEVEL);
860+
write_gic_rmask(i);
861+
}
862+
} else {
863+
mips_cm_lock_other(cl, 0, 0, CM_GCR_Cx_OTHER_BLOCK_GLOBAL);
864+
for (i = 0; i < gic_shared_intrs; i++) {
865+
change_gic_redir_pol(i, GIC_POL_ACTIVE_HIGH);
866+
change_gic_redir_trig(i, GIC_TRIG_LEVEL);
867+
write_gic_redir_rmask(i);
868+
}
869+
mips_cm_unlock_other();
870+
}
853871
}
854872

855873
return cpuhp_setup_state(CPUHP_AP_IRQ_MIPS_GIC_STARTING,

0 commit comments

Comments
 (0)