Skip to content

target: Implement CPUClass::datapath_is_big_endian() handlers

Philippe Mathieu-Daudé qemu-arm qemu-devel qemu-riscv 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest20 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/20exec/tswap: Rename target_words_bigendian -> qemu_binary_is_bigendiancpu-target.c disas/disas-common.c hw/core/cpu-sysemu.c +5 more+17 -171 reply
2/20hw/core/cpu: Introduce CPUClass::datapath_is_big_endian() handlerinclude/hw/core/cpu.h+4 -10 replies
3/20target/arm: Implement CPUClass::datapath_is_big_endiantarget/arm/cpu.c+3 -21 reply
4/20target/ppc: Register CPUClass::datapath_is_big_endiantarget/ppc/cpu_init.c+5 -40 replies
5/20target/rx: Implement CPUClass::datapath_is_big_endiantarget/rx/cpu.c+10 -00 replies
6/20target/sparc: Implement CPUClass::datapath_is_big_endiantarget/sparc/cpu.c+15 -00 replies
7/20target/riscv: Implement CPUClass::datapath_is_big_endiantarget/riscv/cpu.c+17 -00 replies
8/20target/sh4: Expose CPUSH4State::little_endian propertytarget/sh4/cpu.c target/sh4/cpu.h+14 -00 replies
9/20target/sh4: Implement CPUClass::datapath_is_big_endiantarget/sh4/cpu.c+8 -00 replies
10/20target/microblaze: Implement CPUClass::datapath_is_big_endiantarget/microblaze/cpu.c target/microblaze/cpu.h+13 -00 replies
11/20target/mips: Implement CPUClass::datapath_is_big_endiantarget/mips/cpu.c+9 -00 replies
12/20target/xtensa: Implement xtensa_isa_is_big_endian()include/hw/xtensa/xtensa-isa.h target/xtensa/xtensa-isa.c+8 -00 replies
13/20target/xtensa: Implement CPUClass::datapath_is_big_endiantarget/xtensa/cpu.c+8 -00 replies
14/20target: Implement CPUClass::datapath_is_big_endian (little-endian)target/alpha/cpu.c target/avr/cpu.c target/i386/cpu.c +2 more+30 -10 replies
15/20target: Implement CPUClass::datapath_is_big_endian (big-endian)target/hexagon/cpu.c target/hppa/cpu.c target/m68k/cpu.c +2 more+30 -01 reply
16/20hw/core/cpu: Expose cpu_datapath_is_big_endian() methodhw/core/cpu-common.c include/hw/core/cpu.h+15 -00 replies
17/20disas: Use cpu_datapath_is_big_endian()disas/disas-common.c+1 -22 replies
18/20hw/core/generic-loader: Use cpu_datapath_is_big_endian()hw/core/generic-loader.c+2 -51 reply
19/20hw/virtio: Use cpu_datapath_is_big_endian()hw/virtio/virtio.c+1 -10 replies
20/20hw/core/cpu: Remove cpu_virtio_is_big_endian()hw/core/cpu-sysemu.c include/hw/core/cpu.h include/hw/core/sysemu-cpu-ops.h +2 more+0 -300 replies

Reviews trailers per patch

2 of 20 patches have a Reviewed-by or Acked-by.

PatchRichard HendersonBrian Cain
1/20R-b
2/20
3/20
4/20
5/20
6/20
7/20
8/20
9/20
10/20
11/20
12/20
13/20
14/20
15/20R-b
16/20
17/20
18/20
19/20
20/20

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/20] target: Implement CPUClass::datapath_is_big_endian() handlers

The long term goal is to remove endianness knowledge from QEMU system binaries, allowing them to run vCPU in any endianness. For that target_words_bigendian(), TARGET_BIG_ENDIAN and few other things (like MO_TE) must be removed.

Have each target implement a datapath_is_big_endian() handler to express whether the CPU data is expected to be accessed in big endian or not.

Few targets already provide a such functionality (ARM, PPC); for some the data endianness is exposed via a CPU bit; and for many the data endianness is fixed.

Use this handler in 3 places: disas/, the generic-loader device and the VirtIO core layer.

Note, a similar CPUClass::codepath_is_big_endian() helper could be useful for translator_ld/st_swap() API.

Philippe Mathieu-Daudé (20):
exec/tswap: Rename target_words_bigendian -> qemu_binary_is_bigendian hw/core/cpu: Introduce CPUClass::datapath_is_big_endian() handler target/arm: Implement CPUClass::datapath_is_big_endian target/ppc: Register CPUClass::datapath_is_big_endian target/rx: Implement CPUClass::datapath_is_big_endian target/sparc: Implement CPUClass::datapath_is_big_endian target/riscv: Implement CPUClass::datapath_is_big_endian target/sh4: Expose CPUSH4State::little_endian property target/sh4: Implement CPUClass::datapath_is_big_endian target/microblaze: Implement CPUClass::datapath_is_big_endian target/mips: Implement CPUClass::datapath_is_big_endian target/xtensa: Implement xtensa_isa_is_big_endian() target/xtensa: Implement CPUClass::datapath_is_big_endian
target: Implement CPUClass::datapath_is_big_endian (little-endian)
target: Implement CPUClass::datapath_is_big_endian (big-endian) hw/core/cpu: Expose cpu_datapath_is_big_endian() method
disas: Use cpu_datapath_is_big_endian() hw/core/generic-loader: Use cpu_datapath_is_big_endian() hw/virtio: Use cpu_datapath_is_big_endian()
hw/core/cpu: Remove cpu_virtio_is_big_endian()

 include/exec/tswap.h             | 18 +++++++++---------
 include/hw/core/cpu.h            | 22 ++++++++++++----------
 include/hw/core/sysemu-cpu-ops.h |  8 --------
 include/hw/xtensa/xtensa-isa.h   |  1 +
 target/microblaze/cpu.h          |  2 ++
 target/sh4/cpu.h                 |  6 ++++++
 cpu-target.c                     |  2 +-
 disas/disas-common.c             |  3 +--
 hw/core/cpu-common.c             |  7 +++++++
 hw/core/cpu-sysemu.c             | 11 -----------
 hw/core/generic-loader.c         |  7 ++-----
 hw/display/vga.c                 |  4 ++--
 hw/virtio/virtio.c               |  4 ++--
 system/qtest.c                   |  2 +-
 target/alpha/cpu.c               |  6 ++++++
 target/arm/cpu.c                 |  4 ++--
 target/avr/cpu.c                 |  7 ++++++-
 target/hexagon/cpu.c             |  6 ++++++
 target/hppa/cpu.c                |  6 ++++++
 target/i386/cpu.c                |  6 ++++++
 target/loongarch/cpu.c           |  6 ++++++
 target/m68k/cpu.c                |  6 ++++++
 target/microblaze/cpu.c          | 11 +++++++++++
 target/mips/cpu.c                |  9 +++++++++
 target/openrisc/cpu.c            |  6 ++++++
 target/ppc/cpu_init.c            |  8 ++++----
 target/riscv/cpu.c               | 17 +++++++++++++++++
 target/rx/cpu.c                  | 10 ++++++++++
 target/s390x/cpu.c               |  6 ++++++
 target/sh4/cpu.c                 | 16 ++++++++++++++++
 target/sparc/cpu.c               | 15 +++++++++++++++
 target/tricore/cpu.c             |  6 ++++++
 target/xtensa/cpu.c              |  8 ++++++++
 target/xtensa/xtensa-isa.c       |  7 +++++++
 34 files changed, 205 insertions(+), 58 deletions(-)
Signature · 1 line
2.45.2