[PATCH v2 0/7] Add trap-based ISA extension emulation

Benedikt Freisen b.freisen at gmx.net
Fri Nov 14 12:38:35 PST 2025


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.

This follow-up version incorporates the following changes:

Patch 1 is the unmodified, reviewed patch v1 3.
Patches 4 and 5 (previously patch v1 2) now include instruction mask generalizations and conditional compilation suggested by Radim Krčmář.
Patches 6 and 7 (split from patch v1 5) add fine-grained Kconfig options per ISA extension for conditional compilation, as suggested by Inochi Amaoto.
The CMO functionality in patch 6 now uses the new cache management library rather than separate ad-hoc code.
The Supm implementation in patch 6 received bug fixes, but continues to feel somewhat untidy. Feel free to suggest better places for its functionality.
Patch 7 (the Zvbb part of patch v1 5) adds the OPENSBI_CC_SUPPORT_VECTOR check requested by Xiang W, necessitating the Makefile bug fix in patch 2 in my cross-compilation environment.

Greetings,
Benedikt Freisen

Benedikt Freisen (7):
  include: sbi: Make "s8" actually signed.
  Makefile: sensible default value for OPENSBI_CC_XLEN.
  include: sbi: Fix tab alignment.
  include: sbi: Ignore rs1 and rd fields in FENCE.TSO.
  lib: sbi: Workaround for FENCE(.I) errata on C906, C910.
  lib: sbi: ISA extension emulation.
  lib: sbi: ISA extension emulation (Zvbb).

 CONTRIBUTORS.md                          |    2 +
 Makefile                                 |    6 +
 include/sbi/riscv_encoding.h             |  213 +++-
 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_scratch.h                |   12 +-
 include/sbi/sbi_trap.h                   |    2 +
 include/sbi/sbi_types.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               |  150 ++-
 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 +
 26 files changed, 3577 insertions(+), 60 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.51.1




More information about the opensbi mailing list