Skip to content

Commit

Permalink
lib: sbi_illegal_insn: Fix FENCE.TSO emulation infinite trap loop
Browse files Browse the repository at this point in the history
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: cb8271c ("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>
  • Loading branch information
pathakraul authored and avpatel committed Aug 22, 2022
1 parent a69eb6c commit 111afc1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/sbi/sbi_illegal_insn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 111afc1

Please sign in to comment.