Skip to content

RFC Compile accel/tcg once (partially)

Anton Johansson via qemu-devel 1 version Applied

Status from this message: Queued, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest34 patches 51 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/34target: [PAGE_VARY] Use PAGE_VARY for all softmmu targetstarget/alpha/cpu-param.h target/avr/cpu-param.h target/cris/cpu-param.h +15 more+114 -132 replies
2/34target: [PAGE_VARY] Move TARGET_PAGE_BITS_MIN to TargetPageBitsaccel/tcg/cputlb.c include/exec/cpu-all.h include/exec/cpu-defs.h +24 more+37 -321 reply
3/34exec: [PAGE_VARY] Move TARGET_PAGE_BITS_VARY to common headerinclude/exec/cpu-all.h include/exec/cpu-common.h+35 -191 reply
4/34exec: [PAGE_VARY] Unpoison TARGET_PAGE_* macros for system modeinclude/exec/poison.h+2 -01 reply
5/34target/tricore: [VADDR] Use target_ulong for EAtarget/tricore/op_helper.c+4 -42 replies
6/34exec: [VADDR] Move vaddr defines to separate fileinclude/exec/cpu-common.h include/exec/vaddr.h+18 -123 replies
7/34hw/core: [VADDR] Include vaddr.h from cpu.hinclude/hw/core/cpu.h+1 -12 replies
8/34target: [VADDR] Use vaddr in gen_intermediate_codeinclude/exec/translator.h target/alpha/translate.c target/arm/tcg/translate.c +19 more+22 -222 replies
9/34exec: [VADDR] Use vaddr in DisasContextBase for virtual addressesinclude/exec/translator.h target/hexagon/translate.c target/m68k/translate.c +2 more+14 -122 replies
10/34exec: [VADDR] typedef abi_ptr to vaddrinclude/exec/cpu_ldst.h+2 -22 replies
11/34Squash of header code shufflingaccel/tcg/cpu-exec.c accel/tcg/tb-hash.h hw/s390x/s390-virtio-hcall.h +12 more+459 -3880 replies
12/34target: Uninline cpu_mmu_index()include/exec/cpu-common.h target/alpha/cpu.c target/alpha/cpu.h +40 more+222 -2172 replies
13/34target: Uninline cpu_get_tb_cpu_state()include/exec/cpu-common.h target/alpha/cpu.c target/alpha/cpu.h +38 more+350 -3492 replies
14/34exec: [CPUTLB] Move PAGE_* macros to common headerinclude/exec/cpu-all.h include/exec/cpu-common.h+30 -242 replies
15/34exec: [CPUTLB] Move TLB_*/tlb_*() to common headerinclude/exec/cpu-all.h include/exec/cpu-common.h+83 -811 reply
16/34exec: [CPUTLB] Move cpu_*()/cpu_env() to common headerinclude/exec/cpu-all.h include/exec/cpu-common.h+25 -253 replies
17/34hw/core: [CPUTLB] Move target specifics to end of TCGCPUOpsinclude/hw/core/tcg-cpu-ops.h+17 -152 replies
18/34accel/stubs: [CPUTLB] Move xen.h stubs to xen-stub.caccel/stubs/xen-stub.c include/sysemu/xen.h+12 -271 reply
19/34accel/tcg: [CPUTLB] Use TCGContext.addr_type instead of TARGET_LONG_BITSaccel/tcg/cputlb.c include/exec/cpu_ldst.h+36 -291 reply
20/34accel/tcg: [CPUTLB] Use TCGContext.guest_mo for memory orderingaccel/tcg/internal-target.h+4 -71 reply
21/34accel/tcg: [CPUTLB] Use tcg_ctx->tlb_dyn_max_bitsaccel/tcg/cputlb.c+1 -11 reply
22/34accel/tcg: [CPUTLB] Move CPU_TLB_DYN_[DEFAULT|MIN]* to cputlb.caccel/tcg/cputlb.c include/exec/cpu-defs.h+3 -31 reply
23/34tcg: [CPUTLB] Add `mo_te` field to TCGContextinclude/tcg/tcg.h+1 -01 reply
24/34accel/tcg: [CPUTLB] Set mo_te in TCGContextaccel/tcg/translate-all.c+3 -10 replies
25/34accel/tcg: [CPUTLB] Use tcg_ctx->mo_te instead of MO_TEaccel/tcg/cputlb.c+6 -30 replies
26/34Wrap target macros in functionscpu-target.c include/hw/core/cpu.h+71 -03 replies
27/34accel/tcg: Make translate-all.c target independentaccel/tcg/translate-all.c+18 -204 replies
28/34accel/tcg: Make plugin-gen.c target independentaccel/tcg/plugin-gen.c+7 -81 reply
29/34accel/tcg: Make tb-maint.c target indpendentaccel/tcg/tb-maint.c+25 -221 reply
30/34accel/tcg: Make tcg-all.c target indpendentaccel/tcg/tcg-all.c+9 -163 replies
31/34accel/tcg: Make tcg-runtime-gvec.c target independentaccel/tcg/tcg-runtime-gvec.c+1 -11 reply
32/34accel/tcg: Make tcg-runtime.c target independentaccel/tcg/tcg-runtime.c+1 -11 reply
33/34accel/tcg: Make translator.c (partially) target independentaccel/tcg/translator.c+8 -81 reply
34/34accel/tcg: Compile (a few files) once for system-modeaccel/tcg/meson.build+45 -120 replies

Reviews trailers per patch

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

PatchPhilippe Mathieu-DaudéRichard Henderson
1/34R-b
2/34
3/34
4/34R-b
5/34R-b
6/34R-b
7/34R-b
8/34R-b
9/34R-b
10/34R-b
11/34
12/34R-b
13/34R-b
14/34R-b
15/34R-b
16/34R-b
17/34
18/34R-b
19/34
20/34
21/34
22/34R-b
23/34
24/34
25/34
26/34
27/34
28/34R-b
29/34
30/34A-b
31/34R-b
32/34R-b
33/34R-b
34/34

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

Read the v1 thread

Cover letter [RFC PATCH 00/34] Compile accel/tcg once (partially)

Based on an older version of rth/tcg-next and some patches by me, Philippe, and Richard (most of which have since been merged), base branch here

https://gitlab.com/AntonJohansson/qemu/-/tree/feature/accel-tcg-once-base

Rebase is in the works, but should not affect the larger parts of this patchset that I'm looking for feedback on.

This patchset moves forward with the single binary/compile once work and tries to compile translation units in accel/tcg/ once for system mode. The following files are compiled once in this patchset

cputlb.c
tcg-all.c
tcg-runtime.c
tcg-runtime-gvec.c
tb-maint.c
plugin-gen.c
translate-all.c

and debuginfo.c is also moved to common_ss as it doesn't contain any target specifics. Work still remains for

cpu-exec.c (TARGET_I386 ifdefs)
translator.c (tswap(), ldl_p() and friends)

Brackets [...] in patch names are temporary and indicate patches that "belong" together and can be split out easier.

Major changes which I'm looking for feedback on:

- [PAGE_VARY] patches:

Switches to variable page sizes as a default for all system mode targets, meaning TARGET_PAGE_* and TLB_* become target independent.

- "Uninline cpu_mmu_index()"/"Uninline cpu_get_tb_cpu_state()":

Uninlines cpu_mmu_index() (used by cputlb.c) and cpu_get_tb_cpu_state() (used by translate-all.c) so they can be called from accel/tcg without pulling in target specifics.

- "Wrap target macros in functions":

Introduces wrapper functions in cpu-target.c around target macros that I'm not sure how to deal with.

Anton Johansson (34):
target: [PAGE_VARY] Use PAGE_VARY for all softmmu targets
target: [PAGE_VARY] Move TARGET_PAGE_BITS_MIN to TargetPageBits
exec: [PAGE_VARY] Move TARGET_PAGE_BITS_VARY to common header
exec: [PAGE_VARY] Unpoison TARGET_PAGE_* macros for system mode target/tricore: [VADDR] Use target_ulong for EA
exec: [VADDR] Move vaddr defines to separate file hw/core: [VADDR] Include vaddr.h from cpu.h
target: [VADDR] Use vaddr in gen_intermediate_code
exec: [VADDR] Use vaddr in DisasContextBase for virtual addresses
exec: [VADDR] typedef abi_ptr to vaddr
[IGNORE] Squash of header code shuffling
target: Uninline cpu_mmu_index()
target: Uninline cpu_get_tb_cpu_state()
exec: [CPUTLB] Move PAGE_* macros to common header
exec: [CPUTLB] Move TLB_*/tlb_*() to common header
exec: [CPUTLB] Move cpu_*()/cpu_env() to common header hw/core: [CPUTLB] Move target specifics to end of TCGCPUOps accel/stubs: [CPUTLB] Move xen.h stubs to xen-stub.c accel/tcg: [CPUTLB] Use TCGContext.addr_type instead of
TARGET_LONG_BITS
accel/tcg: [CPUTLB] Use TCGContext.guest_mo for memory ordering accel/tcg: [CPUTLB] Use tcg_ctx->tlb_dyn_max_bits accel/tcg: [CPUTLB] Move CPU_TLB_DYN_[DEFAULT|MIN]* to cputlb.c
tcg: [CPUTLB] Add mo_te field to TCGContext accel/tcg: [CPUTLB] Set mo_te in TCGContext
accel/tcg: [CPUTLB] Use tcg_ctx->mo_te instead of MO_TE Wrap target macros in functions
accel/tcg: Make translate-all.c target independent accel/tcg: Make plugin-gen.c target independent accel/tcg: Make tb-maint.c target indpendent accel/tcg: Make tcg-all.c target indpendent
accel/tcg: Make tcg-runtime-gvec.c target independent accel/tcg: Make tcg-runtime.c target independent accel/tcg: Make translator.c (partially) target independent accel/tcg: Compile (a few files) once for system-mode

 accel/tcg/internal-target.h    |  11 +-
 accel/tcg/tb-hash.h            |   4 +-
 hw/s390x/s390-virtio-hcall.h   |   2 +
 include/exec/cpu-all.h         | 156 +-------------
 include/exec/cpu-common.h      | 185 ++++++++++++++++-
 include/exec/cpu-defs.h        |   7 +-
 include/exec/cpu_ldst-target.h |  52 +++++
 include/exec/cpu_ldst.h        |  95 +++------
 include/exec/exec-all.h        | 347 +------------------------------
 include/exec/exec-common.h     | 367 +++++++++++++++++++++++++++++++++
 include/exec/memory-internal.h |   2 +-
 include/exec/page-vary.h       |   1 +
 include/exec/poison.h          |   2 +
 include/exec/ram_addr.h        |   3 +-
 include/exec/translator.h      |   8 +-
 include/exec/vaddr.h           |  18 ++
 include/hw/core/cpu.h          |  11 +-
 include/hw/core/tcg-cpu-ops.h  |  32 +--
 include/qemu/plugin-memory.h   |   1 -
 include/sysemu/xen.h           |  27 ---
 include/tcg/tcg.h              |   1 +
 target/alpha/cpu-param.h       |   6 +
 target/alpha/cpu.h             |  20 --
 target/arm/cpu-param.h         |   2 +-
 target/arm/cpu.h               |  16 --
 target/avr/cpu-param.h         |   6 +
 target/avr/cpu.h               |  24 ---
 target/cris/cpu-param.h        |   7 +
 target/cris/cpu.h              |  14 --
 target/hexagon/cpu.h           |  21 --
 target/hppa/cpu-param.h        |   6 +
 target/hppa/cpu.h              |  55 -----
 target/i386/cpu-param.h        |   6 +
 target/i386/cpu.h              |  16 --
 target/loongarch/cpu-param.h   |   5 +
 target/loongarch/cpu.h         |  23 ---
 target/m68k/cpu-param.h        |   6 +
 target/m68k/cpu.h              |  20 --
 target/microblaze/cpu-param.h  |   6 +-
 target/microblaze/cpu.h        |  23 ---
 target/mips/cpu-param.h        |   2 +-
 target/mips/cpu.h              |  23 +--
 target/mips/tcg/translate.h    |   3 +-
 target/nios2/cpu-param.h       |   5 +-
 target/nios2/cpu.h             |  18 --
 target/openrisc/cpu-param.h    |   8 +-
 target/openrisc/cpu.h          |  22 --
 target/ppc/cpu-param.h         |   6 +
 target/ppc/cpu.h               |  21 --
 target/riscv/cpu-param.h       |   7 +
 target/riscv/cpu.h             |   5 -
 target/rx/cpu-param.h          |   8 +-
 target/rx/cpu.h                |  14 --
 target/s390x/cpu-param.h       |   8 +-
 target/s390x/cpu.h             |  53 -----
 target/sh4/cpu-param.h         |   4 +-
 target/sh4/cpu.h               |  25 ---
 target/sparc/cpu-param.h       |  17 +-
 target/sparc/cpu.h             |  63 ------
 target/tricore/cpu-param.h     |   8 +-
 target/tricore/cpu.h           |  17 --
 target/xtensa/cpu-param.h      |   8 +-
 target/xtensa/cpu.h            |  73 -------
 accel/stubs/xen-stub.c         |  12 ++
 accel/tcg/cpu-exec.c           |   1 +
 accel/tcg/cputlb.c             |  51 +++--
 accel/tcg/plugin-gen.c         |  15 +-
 accel/tcg/tb-maint.c           |  47 +++--
 accel/tcg/tcg-all.c            |  25 +--
 accel/tcg/tcg-runtime-gvec.c   |   2 +-
 accel/tcg/tcg-runtime.c        |   2 +-
 accel/tcg/translate-all.c      |  40 ++--
 accel/tcg/translator.c         |  16 +-
 cpu-target.c                   |  62 ++++++
 page-vary-common.c             |   1 +
 page-vary-target.c             |   4 +-
 plugins/core.c                 |   1 +
 target/alpha/cpu.c             |  19 ++
 target/alpha/translate.c       |   2 +-
 target/arm/cpu.c               |   6 +
 target/arm/tcg/translate.c     |   6 +-
 target/avr/cpu.c               |  23 +++
 target/avr/translate.c         |   2 +-
 target/cris/cpu.c              |  14 ++
 target/cris/translate.c        |   2 +-
 target/hexagon/cpu.c           |  21 ++
 target/hexagon/translate.c     |   5 +-
 target/hppa/cpu.c              |  59 ++++++
 target/hppa/translate.c        |   2 +-
 target/i386/cpu.c              |  16 ++
 target/i386/tcg/translate.c    |   2 +-
 target/loongarch/cpu.c         |  23 +++
 target/loongarch/translate.c   |   2 +-
 target/m68k/cpu.c              |  21 ++
 target/m68k/translate.c        |   4 +-
 target/microblaze/cpu.c        |  23 +++
 target/microblaze/translate.c  |   2 +-
 target/mips/cpu.c              |  23 +++
 target/mips/tcg/translate.c    |  14 +-
 target/nios2/cpu.c             |  18 ++
 target/nios2/translate.c       |   2 +-
 target/openrisc/cpu.c          |  22 ++
 target/openrisc/translate.c    |   2 +-
 target/ppc/cpu.c               |  20 ++
 target/ppc/translate.c         |   2 +-
 target/riscv/cpu_helper.c      |   2 +-
 target/riscv/translate.c       |   2 +-
 target/rx/cpu.c                |  14 ++
 target/rx/translate.c          |   2 +-
 target/s390x/cpu.c             |  55 +++++
 target/s390x/tcg/translate.c   |   2 +-
 target/sh4/cpu.c               |  28 +++
 target/sh4/translate.c         |   2 +-
 target/sparc/cpu.c             |  63 ++++++
 target/sparc/gdbstub.c         |   3 +
 target/sparc/translate.c       |   2 +-
 target/tricore/cpu.c           |  17 ++
 target/tricore/op_helper.c     |   8 +-
 target/tricore/translate.c     |   2 +-
 target/xtensa/cpu.c            |  72 +++++++
 target/xtensa/translate.c      |   2 +-
 accel/tcg/meson.build          |  57 +++--
 122 files changed, 1656 insertions(+), 1345 deletions(-)
 create mode 100644 include/exec/cpu_ldst-target.h
 create mode 100644 include/exec/exec-common.h
 create mode 100644 include/exec/vaddr.h
Signature · 1 line
2.43.0