[PATCH v3 0/3] Add trap-based ISA extension emulation

Benedikt Freisen b.freisen at gmx.net
Sat Dec 27 04:17:59 PST 2025


Introduction (copy-pasted from previous versions)

This patch series seeks to add trap-based emulation functionality for various ISA extensions relevant to RVA22, RVB23 and RVA23.
The emulation functionality contained herein has been demonstrated to e.g. allow the VisionFive 2's JH7110 to run software using the RVA22U64 and RVB23U64 profiles, allow the Orange Pi RV2's Ky X1 (a SpacemiT K1 derivative) to run Ubuntu 25.10 (RVA23U64) in a docker container, and allow the Tenstorrent Blackhole's SiFive X280 (Gen. 1) to boot into Ubuntu 25.10.

Changes in this version, omitting patches already applied

Patch 1 drops the CONFIG_THEAD_C9XX_ERRATA ifdef present in patch v2 5/7, as requested by Anup Patel.
Patch 2 is the unmodified patch v2 6/7.
Patch 3 adds the early-clobber annotation missing in patch v2 7/7, reported by Vivian Wang, to some inline assembly operands.

P.S.:
I am aware that the rather niche and transitionary character of ISA extension emulation's use case ultimately makes the bulk of it more suitable for a fork than for mainline OpenSBI.
Pursuing the formal review process, anyway, has however already proven to be very valuable for quality assurance and diff minimization, and can also serve archival purposes.

Benedikt Freisen (3):
  lib: sbi: Workaround for FENCE(.I) errata on C906, C910.
  lib: sbi: ISA extension emulation.
  lib: sbi: ISA extension emulation (Zvbb).

 CONTRIBUTORS.md                          |    2 +
 include/sbi/riscv_encoding.h             |  181 ++++
 include/sbi/riscv_fp.h                   |   47 +
 include/sbi/sbi_hart.h                   |    2 +
 include/sbi/sbi_illegal_insn.h           |    1 +
 include/sbi/sbi_insn_emu.h               |   65 ++
 include/sbi/sbi_insn_emu_fp.h            |   29 +
 include/sbi/sbi_insn_emu_v.h             |   21 +
 include/sbi/sbi_platform.h               |    6 +
 include/sbi/sbi_scratch.h                |   12 +-
 include/sbi/sbi_trap.h                   |    2 +
 include/sbi_utils/cache/fdt_cmo_helper.h |    7 +
 lib/sbi/Kconfig                          |    7 +
 lib/sbi/objects.mk                       |    3 +
 lib/sbi/sbi_emulate_csr.c                |   14 +
 lib/sbi/sbi_fwft.c                       |   34 +
 lib/sbi/sbi_hart.c                       |    4 +
 lib/sbi/sbi_illegal_insn.c               |  148 ++-
 lib/sbi/sbi_insn_emu.c                   |  624 ++++++++++++
 lib/sbi/sbi_insn_emu.conf                |  175 ++++
 lib/sbi/sbi_insn_emu_fp.c                |  974 ++++++++++++++++++
 lib/sbi/sbi_insn_emu_v.c                 | 1146 ++++++++++++++++++++++
 lib/sbi/sbi_trap.c                       |   72 ++
 lib/sbi/sbi_trap_ldst.c                  |   10 +-
 lib/utils/cache/fdt_cmo_helper.c         |   15 +
 25 files changed, 3558 insertions(+), 43 deletions(-)
 create mode 100644 include/sbi/sbi_insn_emu.h
 create mode 100644 include/sbi/sbi_insn_emu_fp.h
 create mode 100644 include/sbi/sbi_insn_emu_v.h
 create mode 100644 lib/sbi/sbi_insn_emu.c
 create mode 100644 lib/sbi/sbi_insn_emu.conf
 create mode 100644 lib/sbi/sbi_insn_emu_fp.c
 create mode 100644 lib/sbi/sbi_insn_emu_v.c

-- 
2.52.0




More information about the opensbi mailing list