diff options
author | Rahul Pathak <rpathak@ventanamicro.com> | 2022-08-12 16:54:42 +0300 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2022-08-22 06:27:23 +0300 |
commit | 111afc12306e4368fa112f97d31ea802c4561294 (patch) | |
tree | b0b9ea6547e3464f23724bcf00913518d4497a2e | |
parent | a69eb6cc65a16f26455bfb5b7cab768ac891bc1d (diff) | |
download | opensbi-111afc12306e4368fa112f97d31ea802c4561294.tar.xz |
lib: sbi_illegal_insn: Fix FENCE.TSO emulation infinite trap loop
In case of missing "FENCE.TSO" instruction implementation,
opensbi can emulate the "FENCE.TSO" with "FENCE RW,RW", but
mepc was not incremented to continue from the next instruction
causing infinite trap.
Fixes: cb8271c8 ("lib: sbi_illegal_insn: Add emulation for fence.tso")
Signed-off-by: Rahul Pathak <rpathak@ventanamicro.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Xiang W <wxjstz@126.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
-rw-r--r-- | lib/sbi/sbi_illegal_insn.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/sbi/sbi_illegal_insn.c b/lib/sbi/sbi_illegal_insn.c index ecd3508..9691bce 100644 --- a/lib/sbi/sbi_illegal_insn.c +++ b/lib/sbi/sbi_illegal_insn.c @@ -40,6 +40,7 @@ static int misc_mem_opcode_insn(ulong insn, struct sbi_trap_regs *regs) /* Errata workaround: emulate `fence.tso` as `fence rw, rw`. */ if ((insn & INSN_MASK_FENCE_TSO) == INSN_MATCH_FENCE_TSO) { smp_mb(); + regs->mepc += 4; return 0; } |