Skip to content

Commit 70bde01

Browse files
committed
[ot] hw/riscv: ot_earlgrey: Set NMI mcause for Ibex to 31
This initialises Ibex within Earlgrey with the newly defined `nmi_cause` value as 31, as NMI mcause values are implementation-defined, and Ibex makes the decision to implement all NMIs with a cause of 31, leading to an offset of 0x7c from the mtvec base being loaded into mepc upon an NMI occuring. Signed-off-by: Alex Jones <[email protected]>
1 parent 3c35b08 commit 70bde01

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

hw/riscv/ot_earlgrey.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,11 @@ static void ot_eg_soc_hart_configure(DeviceState *dev, const IbexDeviceDef *def,
12141214
qdev_prop_set_array(dev, "pmp_addr", pmp_addr);
12151215

12161216
qdev_prop_set_uint64(dev, "mseccfg", (uint64_t)OT_EG_MSECCFG);
1217+
1218+
/* NMIs are defined in Ibex to all have a mcause of 31 */
1219+
RISCVCPU *cpu = RISCV_CPU(dev);
1220+
CPURISCVState *env = &cpu->env;
1221+
env->nmi_cause = 31u;
12171222
}
12181223

12191224
static void ot_eg_soc_otp_ctrl_configure(

0 commit comments

Comments
 (0)