[PATCH v1] lib: sbi_illegal_insn: Fix FENCE.TSO emulation infinite trap loop

Xiang W wxjstz at 126.com
Fri Aug 12 10:04:24 PDT 2022


在 2022-08-12星期五的 19:24 +0530,Rahul Pathak写道:
> 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 at ventanamicro.com>
> Reviewed-by: Andrew Jones <ajones at ventanamicro.com>
Look good to me.

Reviewed-by: Xiang W <wxjstz at 126.com>
> ---
>  lib/sbi/sbi_illegal_insn.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/sbi/sbi_illegal_insn.c b/lib/sbi/sbi_illegal_insn.c
> index 84c04f8..53e9320 100644
> --- a/lib/sbi/sbi_illegal_insn.c
> +++ b/lib/sbi/sbi_illegal_insn.c
> @@ -39,6 +39,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;
>         }
>  
> -- 
> 2.34.1
> 
> 





More information about the opensbi mailing list