Skip to content

Add RISC-V big-endian target support

Philippe Mathieu-Daudé qemu-devel qemu-riscv 1 version Applied

Status from this message: Applied to riscv-to-apply.next with patch 3 dropped

Get series with b4
b4 am [email protected]

Versions newest first

  1. v11 Latest12 patches 33 repliesApplied

Changes in v11 from the cover letter

- rewrite some patches while reviewing for mainstream integration

Patches in v11 Applied

#Subject and filesSizeRepliesApplied
1/12target/riscv: Initialize DisasContext::mo_endian oncetarget/riscv/insn_trans/trans_rva.c.inc target/riscv/insn_trans/trans_rvd.c.inc target/riscv/insn_trans/trans_rvf.c.inc +10 more+40 -372 replies
2/12target/riscv: Implement runtime data endianness via MSTATUS bitstarget/riscv/cpu.c target/riscv/cpu.h target/riscv/internals.h +2 more+28 -263 replies
3/12target/riscv: Assert PTE.N/PBMT bits are not expected on RV32target/riscv/cpu_helper.c+2 -03 replies
4/12target/riscv: De-indent some code in get_physical_address()target/riscv/cpu_helper.c+18 -152 replies
5/12target/riscv: Remove target_ulong use in get_physical_address()target/riscv/cpu_helper.c+8 -62 replies
6/12target/riscv: Fix page table walk endianness for big-endian hartstarget/riscv/cpu_helper.c+11 -82 replies
7/12hw/riscv/boot: Rewrite setup_rom_reset_vec() using load/store APIhw/riscv/boot.c+24 -292 replies
8/12hw/riscv/boot: Replace cpu_to_le32() -> const_le32()hw/riscv/boot.c+13 -176 replies
9/12target/riscv: Add big-endian CPU configuration field and reset logictarget/riscv/cpu.c target/riscv/cpu_cfg_fields.h.inc+8 -02 replies
10/12hw/riscv/boot: Honour data endiannesshw/riscv/boot.c+28 -122 replies
11/12target/riscv: Expose and document the CPU 'big-endian' propertydocs/system/target-riscv.rst target/riscv/cpu.c+30 -02 replies
12/12tests/functional: Add RISC-V endianness testtests/functional/riscv64/meson.build tests/functional/riscv64/test_endianness.py+58 -02 replies

Reviews trailers per patch

All 12 patches have a Reviewed-by or Acked-by.

PatchPhilippe Mathieu-DaudéThomas HuthPierrick BouvierAlistair Francis
1/12R-b R-b
2/12R-b R-b
3/12R-b
4/12R-b R-b
5/12R-b R-b
6/12R-b R-b R-b
7/12R-b R-b
8/12R-b R-b
9/12R-b R-b
10/12R-b R-b
11/12R-b R-b
12/12R-b T-b R-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v11 thread

Cover letter [PATCH v11 00/12] Add RISC-V big-endian target support

v11:
- rewrite some patches while reviewing for mainstream integration

v10 cover from Djordje:

Hi all,

This series adds big-endian data support for RISC-V system emulation.

Following the discussion on previous versions, this series models fixed-endian harts, not a mixed-endian implementation where software can toggle MBE/SBE/UBE at runtime. The reset value of MBE/SBE/UBE is selected from the CPU configuration. These bits remain outside the mstatus/mstatush/sstatus writable masks, so they are effectively hardwired to 0 for the default little-endian CPUs and to 1 when big-endian=on.

The user-visible big-endian CPU property is exposed only after the data path, boot path, and page-table walk support are in place, so the series remains bisectable.

Djordje Todorovic (6):
target/riscv: Implement runtime data endianness via MSTATUS bits target/riscv: Fix page table walk endianness for big-endian harts target/riscv: Add big-endian CPU configuration field and reset logic hw/riscv/boot: Honour data endianness
target/riscv: Expose and document the CPU 'big-endian' property tests/functional: Add RISC-V endianness test

Philippe Mathieu-Daudé (6):
target/riscv: Initialize DisasContext::mo_endian once target/riscv: Assert PTE.N/PBMT bits are not expected on RV32 target/riscv: De-indent some code in get_physical_address() target/riscv: Remove target_ulong use in get_physical_address() hw/riscv/boot: Rewrite setup_rom_reset_vec() using load/store API hw/riscv/boot: Replace cpu_to_le32() -> const_le32()

 docs/system/target-riscv.rst                  | 29 ++++++
 target/riscv/cpu.h                            |  1 +
 target/riscv/internals.h                      | 29 ++++--
 target/riscv/cpu_cfg_fields.h.inc             |  1 +
 hw/riscv/boot.c                               | 93 ++++++++++---------
 target/riscv/cpu.c                            | 15 ++-
 target/riscv/cpu_helper.c                     | 44 +++++----
 target/riscv/tcg/tcg-cpu.c                    |  2 +
 target/riscv/translate.c                      | 22 ++---
 target/riscv/insn_trans/trans_rva.c.inc       |  4 +-
 target/riscv/insn_trans/trans_rvd.c.inc       |  4 +-
 target/riscv/insn_trans/trans_rvf.c.inc       |  4 +-
 target/riscv/insn_trans/trans_rvi.c.inc       |  8 +-
 target/riscv/insn_trans/trans_rvzacas.c.inc   |  4 +-
 target/riscv/insn_trans/trans_rvzalasr.c.inc  |  4 +-
 target/riscv/insn_trans/trans_rvzce.c.inc     |  4 +-
 target/riscv/insn_trans/trans_rvzfh.c.inc     |  4 +-
 target/riscv/insn_trans/trans_rvzicfiss.c.inc |  4 +-
 target/riscv/insn_trans/trans_xmips.c.inc     |  8 +-
 target/riscv/insn_trans/trans_xthead.c.inc    | 16 ++--
 target/riscv/insn_trans/trans_zilsd.c.inc     |  4 +-
 tests/functional/riscv64/meson.build          |  1 +
 tests/functional/riscv64/test_endianness.py   | 57 ++++++++++++
 23 files changed, 240 insertions(+), 122 deletions(-)
 create mode 100644 tests/functional/riscv64/test_endianness.py
Signature · 1 line
2.53.0