Skip to content

target/riscv: Fix no-TCG build

Zephyr Li qemu-devel qemu-riscv 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest6 patches 1 replyIn review
  2. v25 patches 6 repliesSuperseded
  3. v11 patch 1 replySuperseded

Changes in v3 from the cover letter

- Replace the no-TCG stub with a new cpu-validate.c common source file.
- Move common RISC-V extension validation and user-option tracking out of target/riscv/tcg/tcg-cpu.c.
- Move fflags and exception helpers out of TCG-only helper files.
- Reject x-misa-w outside TCG.
- Build RISC-V TCG-only sources only when CONFIG_TCG is enabled.
- Add GitLab CI coverage for riscv64 KVM-only --disable-tcg builds.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6target/riscv: move extension validation out of TCG-only codetarget/riscv/cpu-validate.c target/riscv/csr.c target/riscv/internals.h +3 more+672 -6170 replies
2/6target/riscv: move fflags helpers to common codetarget/riscv/cpu.h target/riscv/cpu_helper.c target/riscv/fpu_helper.c +1 more+31 -300 replies
3/6target/riscv: move riscv_raise_exception() out of op_helper.ctarget/riscv/cpu.h target/riscv/cpu_helper.c target/riscv/debug.c +3 more+25 -190 replies
4/6target/riscv: reject x-misa-w outside TCGtarget/riscv/cpu.c+12 -00 replies
5/6target/riscv: build TCG-only sources only with TCGtarget/riscv/cpu.c target/riscv/cpu_helper.c target/riscv/csr.c +1 more+21 -60 replies
6/6gitlab-ci.d/crossbuilds: add riscv64 KVM-only build job.gitlab-ci.d/crossbuilds.yml+8 -00 replies

Reviews trailers per patch

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

Read the v3 thread

Cover letter [PATCH v3 0/6] target/riscv: Fix no-TCG build

This series fixes the riscv64-softmmu --disable-tcg build by keeping TCG-only code out of no-TCG builds while preserving common RISC-V CPU helpers for non-TCG configurations.

Compared with v2, this version replaces the no-TCG stub for riscv_cpu_validate_set_extensions() with a common cpu-validate.c split. The validator is used by common CSR code and should not live in TCG-only code.

Changes in v3:
- Replace the no-TCG stub with a new cpu-validate.c common source file.
- Move common RISC-V extension validation and user-option tracking out of target/riscv/tcg/tcg-cpu.c.
- Move fflags and exception helpers out of TCG-only helper files.
- Reject x-misa-w outside TCG.
- Build RISC-V TCG-only sources only when CONFIG_TCG is enabled.
- Add GitLab CI coverage for riscv64 KVM-only --disable-tcg builds.

Testing:
- ../configure --target-list=riscv64-softmmu --enable-kvm --disable-tcg \
--enable-debug
ninja

- ../configure --target-list=riscv64-softmmu,riscv64-linux-user \
--enable-debug
ninja

- In the no-TCG build:
qemu-system-riscv64 -M virt,accel=qtest -cpu rv64,x-misa-w=true \
-nographic -S
reports "x-misa-w requires TCG".

- In the TCG build:
qemu-system-riscv64 -M virt -accel tcg -cpu rv64,x-misa-w=true \
-nographic -S
starts without reporting "x-misa-w requires TCG".

Zephyr Li (6):
target/riscv: move extension validation out of TCG-only code target/riscv: move fflags helpers to common code target/riscv: move riscv_raise_exception() out of op_helper.c target/riscv: reject x-misa-w outside TCG target/riscv: build TCG-only sources only with TCG gitlab-ci.d/crossbuilds: add riscv64 KVM-only build job

 .gitlab-ci.d/crossbuilds.yml |   8 +
 target/riscv/cpu-validate.c  | 630 ++++++++++++++++++++++++++++++++++
 target/riscv/cpu.c           |  13 +-
 target/riscv/cpu.h           |   7 -
 target/riscv/cpu_helper.c    |  53 +++
 target/riscv/csr.c           |  12 +-
 target/riscv/debug.c         |   1 +
 target/riscv/fpu_helper.c    |  27 --
 target/riscv/internals.h     |  26 ++
 target/riscv/meson.build     |  10 +-
 target/riscv/op_helper.c     |  15 -
 target/riscv/tcg/tcg-cpu.c   | 637 ++---------------------------------
 target/riscv/tcg/tcg-cpu.h   |   1 -
 target/riscv/zce_helper.c    |   1 +
 14 files changed, 769 insertions(+), 672 deletions(-)
 create mode 100644 target/riscv/cpu-validate.c

base-commit: 5611a9268dae7b7ff99d478ed134052a9fc7e9f7

Signature · 1 line
2.43.0