Skip to content

target-riscv: Add full-system emulation support for the RISC-V Instruction Set Architecture (RV64G, RV32G)

Sagar Karandikar qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest18 patches 26 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/18target-riscv: Add RISC-V target stubs and MaintainerMAINTAINERS arch_init.c cpus.c +3 more+31 -11 reply
2/18target-riscv: Add RISC-V Target stubs inside target-riscv/target-riscv/Makefile.objs target-riscv/cpu.c target-riscv/cpu.h +4 more+886 -02 replies
3/18target-riscv: Add initialization for translationtarget-riscv/helper.h target-riscv/op_helper.c target-riscv/translate.c+273 -11 reply
4/18target-riscv: Add framework for instruction decodetarget-riscv/instmap.h target-riscv/translate.c+392 -01 reply
5/18target-riscv: Add Arithmetic instructionstarget-riscv/helper.h target-riscv/op_helper.c target-riscv/translate.c+352 -01 reply
6/18target-riscv: Add JALR, Branch Instructionstarget-riscv/translate.c+107 -01 reply
7/18target-riscv: Add Loads/Stores, FP Loads/Storestarget-riscv/translate.c+117 -01 reply
8/18target-riscv: Add Atomic Instructionstarget-riscv/translate.c+154 -01 reply
9/18target-riscv: Add FMADD, FMSUB, FNMADD, FNMSUB Instructions,fpu/softfloat-specialize.h target-riscv/Makefile.objs target-riscv/fpu_helper.c +2 more+271 -42 replies
10/18target-riscv: Add Single Precision Floating-Point Instructionstarget-riscv/fpu_helper.c target-riscv/helper.h target-riscv/translate.c+380 -01 reply
11/18target-riscv: Add Double Precision Floating-Point Instructionstarget-riscv/fpu_helper.c target-riscv/helper.h target-riscv/translate.c+390 -01 reply
12/18target-riscv: Add system instructionstarget-riscv/helper.h target-riscv/op_helper.c target-riscv/translate.c+274 -05 replies
13/18target-riscv: Add CSR read/write helperstarget-riscv/op_helper.c+324 -00 replies
14/18target-riscv: softmmu/address translation supporttarget-riscv/helper.c target-riscv/op_helper.c+238 -21 reply
15/18target-riscv: Interrupt Handlingtarget-riscv/helper.c+154 -01 reply
16/18target-riscv: Timer Supporthw/riscv/Makefile.objs hw/riscv/cpudevs.h hw/riscv/riscv_rtc.c +3 more+278 -20 replies
17/18target-riscv: Add support for Host-Target Interface (HTIF) Deviceshw/riscv/Makefile.objs hw/riscv/htif/elf_symb.c hw/riscv/htif/elf_symb.h +2 more+852 -00 replies
18/18target-riscv: Add generic test board, activate targetconfigure default-configs/riscv32-softmmu.mak default-configs/riscv64-softmmu.mak +3 more+415 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 00/18] target-riscv: Add full-system emulation support for the RISC-V Instruction Set Architecture (RV64G, RV32G)

This patch set adds support for the RISC-V ISA [1] as a system-mode target. It has been tested booting Linux and FreeBSD, passes the RISC-V assembly test suite, and has had the riscv-torture [2] tester running on it for a while now without any issues arising. This patch set supports RV64G and RV32G.

Potentially useful references:
-RISC-V User Spec: See [3]. This spec is frozen.
-RISC-V Privileged Spec: See [4]. This spec is a draft, we implement v1.9. -Spike, the reference simulator for the ISA: See [5].

The comments from an earlier RFC were addressed:
-We use QEMU's built-in softfloat
-cpu-qom.h merged into cpu.h
-remove active_tc/riscv-defs.h that were mirrored from MIPS
-Use DEF_HELPER_FLAGS_* where necessary
-DIV/REM now use movcond instead of branches
-handlers for arithmetic instructions and their "W" counterparts were merged to reduce code duplication
-Updated to use tcg_gen_qemu_ld_tl(..., MO_SB) etc.

[1] https://riscv.org
[2] https://github.com/ucb-bar/riscv-torture
[3] https://content.riscv.org/wp-content/uploads/2016/06/riscv-spec-v2.1.pdf
[4] https://content.riscv.org/wp-content/uploads/2016/07/riscv-privileged-v1.9-1.pdf
[5] https://github.com/riscv/riscv-isa-sim

Sagar Karandikar (18):
target-riscv: Add RISC-V target stubs and Maintainer
target-riscv: Add RISC-V Target stubs inside target-riscv/
target-riscv: Add initialization for translation
target-riscv: Add framework for instruction decode
target-riscv: Add Arithmetic instructions
target-riscv: Add JALR, Branch Instructions
target-riscv: Add Loads/Stores, FP Loads/Stores
target-riscv: Add Atomic Instructions
target-riscv: Add FMADD, FMSUB, FNMADD, FNMSUB Instructions,
target-riscv: Add Single Precision Floating-Point Instructions
target-riscv: Add Double Precision Floating-Point Instructions
target-riscv: Add system instructions
target-riscv: Add CSR read/write helpers
target-riscv: softmmu/address translation support
target-riscv: Interrupt Handling
target-riscv: Timer Support
target-riscv: Add support for Host-Target Interface (HTIF) Devices
target-riscv: Add generic test board, activate target

 MAINTAINERS                           |    7 +
 arch_init.c                           |    2 +
 configure                             |    6 +
 cpus.c                                |    6 +
 default-configs/riscv32-softmmu.mak   |   38 +
 default-configs/riscv64-softmmu.mak   |   38 +
 fpu/softfloat-specialize.h            |    7 +-
 hw/riscv/Makefile.objs                |    5 +
 hw/riscv/cpudevs.h                    |   17 +
 hw/riscv/htif/elf_symb.c              |  286 ++++++
 hw/riscv/htif/elf_symb.h              |   80 ++
 hw/riscv/htif/htif.c                  |  423 +++++++++
 hw/riscv/riscv_board.c                |  264 ++++++
 hw/riscv/riscv_int.c                  |   67 ++
 hw/riscv/riscv_rtc.c                  |  230 +++++
 include/elf.h                         |    2 +
 include/hw/riscv/htif/htif.h          |   61 ++
 include/hw/riscv/riscv_rtc.h          |   25 +
 include/hw/riscv/riscv_rtc_internal.h |    3 +
 include/sysemu/arch_init.h            |    1 +
 qapi-schema.json                      |   14 +-
 target-riscv/Makefile.objs            |    1 +
 target-riscv/cpu.c                    |  154 +++
 target-riscv/cpu.h                    |  497 ++++++++++
 target-riscv/fpu_helper.c             |  582 ++++++++++++
 target-riscv/helper.c                 |  420 +++++++++
 target-riscv/helper.h                 |   87 ++
 target-riscv/instmap.h                |  328 +++++++
 target-riscv/op_helper.c              |  577 ++++++++++++
 target-riscv/translate.c              | 1658 +++++++++++++++++++++++++++++++++
 30 files changed, 5882 insertions(+), 4 deletions(-)
 create mode 100644 default-configs/riscv32-softmmu.mak
 create mode 100644 default-configs/riscv64-softmmu.mak
 create mode 100644 hw/riscv/Makefile.objs
 create mode 100644 hw/riscv/cpudevs.h
 create mode 100644 hw/riscv/htif/elf_symb.c
 create mode 100644 hw/riscv/htif/elf_symb.h
 create mode 100644 hw/riscv/htif/htif.c
 create mode 100644 hw/riscv/riscv_board.c
 create mode 100644 hw/riscv/riscv_int.c
 create mode 100644 hw/riscv/riscv_rtc.c
 create mode 100644 include/hw/riscv/htif/htif.h
 create mode 100644 include/hw/riscv/riscv_rtc.h
 create mode 100644 include/hw/riscv/riscv_rtc_internal.h
 create mode 100644 target-riscv/Makefile.objs
 create mode 100644 target-riscv/cpu.c
 create mode 100644 target-riscv/cpu.h
 create mode 100644 target-riscv/fpu_helper.c
 create mode 100644 target-riscv/helper.c
 create mode 100644 target-riscv/helper.h
 create mode 100644 target-riscv/instmap.h
 create mode 100644 target-riscv/op_helper.c
 create mode 100644 target-riscv/translate.c
Signature · 1 line
2.9.3