Package: opensbi Version: 1.1-1 Severity: normal Tags: patch User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu lunar ubuntu-patch
Dear Maintainer, * Fix emulation of fence.tso hanging in endless loop on Allwinner D1 d/p/lib-sbi_illegal_insn-Fix-FENCE.TSO-emulation-infinit.patch (LP: #1995860) Thanks for considering the patch. Best regards Heinrich -- System Information: Debian Release: bookworm/sid APT prefers lunar-proposed APT policy: (500, 'lunar-proposed'), (500, 'lunar') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 5.19.0-21-generic (SMP w/32 CPU threads; PREEMPT) Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled
diff -Nru opensbi-1.1/debian/patches/lib-sbi_illegal_insn-Fix-FENCE.TSO-emulation-infinit.patch opensbi-1.1/debian/patches/lib-sbi_illegal_insn-Fix-FENCE.TSO-emulation-infinit.patch --- opensbi-1.1/debian/patches/lib-sbi_illegal_insn-Fix-FENCE.TSO-emulation-infinit.patch 1970-01-01 01:00:00.000000000 +0100 +++ opensbi-1.1/debian/patches/lib-sbi_illegal_insn-Fix-FENCE.TSO-emulation-infinit.patch 2022-11-07 14:25:01.000000000 +0100 @@ -0,0 +1,36 @@ +From 111afc12306e4368fa112f97d31ea802c4561294 Mon Sep 17 00:00:00 2001 +From: Rahul Pathak <rpat...@ventanamicro.com> +Date: Fri, 12 Aug 2022 19:24:42 +0530 +Subject: [PATCH] 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 <rpat...@ventanamicro.com> +Reviewed-by: Andrew Jones <ajo...@ventanamicro.com> +Reviewed-by: Xiang W <wxj...@126.com> +Reviewed-by: Samuel Holland <sam...@sholland.org> +Origin: https://github.com/riscv-software-src/opensbi/commit/111afc12306e4368fa112f97d31ea802c4561294 +--- + 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 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; + } + +-- +2.37.2 + diff -Nru opensbi-1.1/debian/patches/series opensbi-1.1/debian/patches/series --- opensbi-1.1/debian/patches/series 1970-01-01 01:00:00.000000000 +0100 +++ opensbi-1.1/debian/patches/series 2022-11-07 13:18:42.000000000 +0100 @@ -0,0 +1 @@ +lib-sbi_illegal_insn-Fix-FENCE.TSO-emulation-infinit.patch