irqchip/gic-v3: Reset APgRn registers at boot time
Booting a crash kernel while in an interrupt handler is likely to leave the Active Priority Registers with some state that is not relevant to the new kernel, and is likely to lead to erratic behaviours such as interrupts not firing as their priority is already active. As a sanity measure, wipe the APRs clean on startup. We make sure to wipe both group 0 and 1 registers in order to avoid any surprise. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
This commit is contained in:
@@ -532,6 +532,7 @@ static void gic_cpu_sys_reg_init(void)
|
||||
int i, cpu = smp_processor_id();
|
||||
u64 mpidr = cpu_logical_map(cpu);
|
||||
u64 need_rss = MPIDR_RS(mpidr);
|
||||
u32 val;
|
||||
|
||||
/*
|
||||
* Need to check that the SRE bit has actually been set. If
|
||||
@@ -562,6 +563,28 @@ static void gic_cpu_sys_reg_init(void)
|
||||
gic_write_ctlr(ICC_CTLR_EL1_EOImode_drop_dir);
|
||||
}
|
||||
|
||||
val = gic_read_ctlr();
|
||||
val &= ICC_CTLR_EL1_PRI_BITS_MASK;
|
||||
val >>= ICC_CTLR_EL1_PRI_BITS_SHIFT;
|
||||
|
||||
switch(val + 1) {
|
||||
case 8:
|
||||
case 7:
|
||||
write_gicreg(0, ICC_AP0R3_EL1);
|
||||
write_gicreg(0, ICC_AP1R3_EL1);
|
||||
write_gicreg(0, ICC_AP0R2_EL1);
|
||||
write_gicreg(0, ICC_AP1R2_EL1);
|
||||
case 6:
|
||||
write_gicreg(0, ICC_AP0R1_EL1);
|
||||
write_gicreg(0, ICC_AP1R1_EL1);
|
||||
case 5:
|
||||
case 4:
|
||||
write_gicreg(0, ICC_AP0R0_EL1);
|
||||
write_gicreg(0, ICC_AP1R0_EL1);
|
||||
}
|
||||
|
||||
isb();
|
||||
|
||||
/* ... and let's hit the road... */
|
||||
gic_write_grpen1(1);
|
||||
|
||||
|
Reference in New Issue
Block a user