[PATCH v3 00/12] Start replacing target_ulong with vaddr

Anton Johansson via posted 12 patches 10 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230621135633.1649-1-anjo@rev.ng
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Riku Voipio <riku.voipio@iki.fi>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Yanan Wang <wangyanan55@huawei.com>, Peter Maydell <peter.maydell@linaro.org>, Michael Rolnik <mrolnik@gmail.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Brian Cain <bcain@quicinc.com>, Song Gao <gaosong@loongson.cn>, Xiaojuan Yang <yangxiaojuan@loongson.cn>, Laurent Vivier <laurent@vivier.eu>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Chris Wulff <crwulff@gmail.com>, Marek Vasut <marex@denx.de>, Stafford Horne <shorne@gmail.com>, Daniel Henrique Barboza <danielhb413@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, David Gibson <david@gibson.dropbear.id.au>, Greg Kurz <groug@kaod.org>, Nicholas Piggin <npiggin@gmail.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Bin Meng <bin.meng@windriver.com>, Weiwei Li <liweiwei@iscas.ac.cn>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Yoshinori Sato <ysato@users.sourceforge.jp>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Thomas Huth <thuth@redhat.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, Max Filippov <jcmvbkbc@gmail.com>
accel/stubs/tcg-stub.c       |   6 +-
accel/tcg/cpu-exec.c         |  43 ++++---
accel/tcg/cputlb.c           | 233 +++++++++++++++++------------------
accel/tcg/internal.h         |   6 +-
accel/tcg/tb-hash.h          |  12 +-
accel/tcg/tb-jmp-cache.h     |   2 +-
accel/tcg/tb-maint.c         |   2 +-
accel/tcg/translate-all.c    |  13 +-
accel/tcg/translator.c       |  10 +-
accel/tcg/user-exec.c        |  58 +++++----
cpu.c                        |   2 +-
include/exec/cpu-all.h       |  10 +-
include/exec/cpu-defs.h      |   4 +-
include/exec/cpu_ldst.h      |  10 +-
include/exec/exec-all.h      |  95 +++++++-------
include/exec/translate-all.h |   2 +-
include/exec/translator.h    |   6 +-
include/qemu/plugin-memory.h |   2 +-
target/alpha/cpu.h           |   4 +-
target/arm/cpu.h             |   4 +-
target/arm/helper.c          |   4 +-
target/avr/cpu.h             |   4 +-
target/cris/cpu.h            |   4 +-
target/hexagon/cpu.h         |   4 +-
target/hppa/cpu.h            |   5 +-
target/i386/cpu.h            |   4 +-
target/loongarch/cpu.h       |   6 +-
target/m68k/cpu.h            |   4 +-
target/microblaze/cpu.h      |   4 +-
target/mips/cpu.h            |   4 +-
target/nios2/cpu.h           |   4 +-
target/openrisc/cpu.h        |   5 +-
target/ppc/cpu.h             |   8 +-
target/ppc/helper_regs.c     |   4 +-
target/riscv/cpu.h           |   4 +-
target/riscv/cpu_helper.c    |   4 +-
target/rx/cpu.h              |   4 +-
target/s390x/cpu.h           |   4 +-
target/sh4/cpu.h             |   4 +-
target/sparc/cpu.h           |   4 +-
target/tricore/cpu.h         |   4 +-
target/xtensa/cpu.h          |   4 +-
42 files changed, 307 insertions(+), 313 deletions(-)
[PATCH v3 00/12] Start replacing target_ulong with vaddr
Posted by Anton Johansson via 10 months, 1 week ago
This is a first patchset in removing target_ulong from non-target/
directories.  As use of target_ulong is spread accross the codebase we
are attempting to target as few maintainers as possible with each
patchset in order to ease reviewing.

The following instances of target_ulong remain in accel/ and tcg/
    - atomic helpers (atomic_common.c.inc), cpu_atomic_*()
      (atomic_template.h,) and cpu_[st|ld]*()
      (cputlb.c/ldst_common.c.inc) are only used in target/ and can
      be pulled out into a separate target-specific file;

    - walk_memory_regions() is used in user-exec.c and
      linux-user/elfload.c;

    - kvm_find_sw_breakpoint() in kvm-all.c used in target/;

Changes in v2:
    - addr argument in tb_invalidate_phys_addr() changed from vaddr
      to hwaddr;

    - Removed previous patch:

        "[PATCH 4/8] accel/tcg: Replace target_ulong with vaddr in helper_unaligned_*()"

      as these functions are removed by Richard's patches;

    - First patch:

        "[PATCH 1/8] accel: Replace `target_ulong` with `vaddr` in TB/TLB"

      has been split into patches 1-7 to ease reviewing;

    - Pulled in target/ changes to cpu_get_tb_cpu_state() into this
      patchset.  This was done to avoid pointer casts to target_ulong *
      which would break for 32-bit targets on a 64-bit BE host;

      Note the small target/ changes are collected in a single
      patch to not break bisection.  If it's still desirable to split
      based on maintainer, let me know;

    - `last` argument of pageflags_[find|next] changed from target_long
       to vaddr.  This change was left out of the last patchset due to
       triggering a "Bad ram pointer" error (softmmu/physmem.c:2273)
       when running make check for a i386-softmmu target.

       I was not able to recreate this on master or post rebase on
       Richard's tcg-once branch.

Changes in v3:
    - Rebased on master

Finally, the grand goal is to allow for heterogeneous QEMU binaries
consisting of multiple frontends.

RFC: https://lists.nongnu.org/archive/html/qemu-devel/2022-12/msg04518.html

Anton Johansson (12):
  accel: Replace target_ulong in tlb_*()
  accel/tcg/translate-all.c: Widen pc and cs_base
  target: Widen pc/cs_base in cpu_get_tb_cpu_state
  accel/tcg/cputlb.c: Widen CPUTLBEntry access functions
  accel/tcg/cputlb.c: Widen addr in MMULookupPageData
  accel/tcg/cpu-exec.c: Widen pc to vaddr
  accel/tcg: Widen pc to vaddr in CPUJumpCache
  accel: Replace target_ulong with vaddr in probe_*()
  accel/tcg: Replace target_ulong with vaddr in *_mmu_lookup()
  accel/tcg: Replace target_ulong with vaddr in translator_*()
  accel/tcg: Replace target_ulong with vaddr in page_*()
  cpu: Replace target_ulong with hwaddr in tb_invalidate_phys_addr()

 accel/stubs/tcg-stub.c       |   6 +-
 accel/tcg/cpu-exec.c         |  43 ++++---
 accel/tcg/cputlb.c           | 233 +++++++++++++++++------------------
 accel/tcg/internal.h         |   6 +-
 accel/tcg/tb-hash.h          |  12 +-
 accel/tcg/tb-jmp-cache.h     |   2 +-
 accel/tcg/tb-maint.c         |   2 +-
 accel/tcg/translate-all.c    |  13 +-
 accel/tcg/translator.c       |  10 +-
 accel/tcg/user-exec.c        |  58 +++++----
 cpu.c                        |   2 +-
 include/exec/cpu-all.h       |  10 +-
 include/exec/cpu-defs.h      |   4 +-
 include/exec/cpu_ldst.h      |  10 +-
 include/exec/exec-all.h      |  95 +++++++-------
 include/exec/translate-all.h |   2 +-
 include/exec/translator.h    |   6 +-
 include/qemu/plugin-memory.h |   2 +-
 target/alpha/cpu.h           |   4 +-
 target/arm/cpu.h             |   4 +-
 target/arm/helper.c          |   4 +-
 target/avr/cpu.h             |   4 +-
 target/cris/cpu.h            |   4 +-
 target/hexagon/cpu.h         |   4 +-
 target/hppa/cpu.h            |   5 +-
 target/i386/cpu.h            |   4 +-
 target/loongarch/cpu.h       |   6 +-
 target/m68k/cpu.h            |   4 +-
 target/microblaze/cpu.h      |   4 +-
 target/mips/cpu.h            |   4 +-
 target/nios2/cpu.h           |   4 +-
 target/openrisc/cpu.h        |   5 +-
 target/ppc/cpu.h             |   8 +-
 target/ppc/helper_regs.c     |   4 +-
 target/riscv/cpu.h           |   4 +-
 target/riscv/cpu_helper.c    |   4 +-
 target/rx/cpu.h              |   4 +-
 target/s390x/cpu.h           |   4 +-
 target/sh4/cpu.h             |   4 +-
 target/sparc/cpu.h           |   4 +-
 target/tricore/cpu.h         |   4 +-
 target/xtensa/cpu.h          |   4 +-
 42 files changed, 307 insertions(+), 313 deletions(-)

--
2.41.0
Re: [PATCH v3 00/12] Start replacing target_ulong with vaddr
Posted by Richard Henderson 10 months, 1 week ago
On 6/21/23 15:56, Anton Johansson wrote:
> This is a first patchset in removing target_ulong from non-target/
> directories.  As use of target_ulong is spread accross the codebase we
> are attempting to target as few maintainers as possible with each
> patchset in order to ease reviewing.
> 
> The following instances of target_ulong remain in accel/ and tcg/
>      - atomic helpers (atomic_common.c.inc), cpu_atomic_*()
>        (atomic_template.h,) and cpu_[st|ld]*()
>        (cputlb.c/ldst_common.c.inc) are only used in target/ and can
>        be pulled out into a separate target-specific file;
> 
>      - walk_memory_regions() is used in user-exec.c and
>        linux-user/elfload.c;
> 
>      - kvm_find_sw_breakpoint() in kvm-all.c used in target/;
> 
> Changes in v2:
>      - addr argument in tb_invalidate_phys_addr() changed from vaddr
>        to hwaddr;
> 
>      - Removed previous patch:
> 
>          "[PATCH 4/8] accel/tcg: Replace target_ulong with vaddr in helper_unaligned_*()"
> 
>        as these functions are removed by Richard's patches;
> 
>      - First patch:
> 
>          "[PATCH 1/8] accel: Replace `target_ulong` with `vaddr` in TB/TLB"
> 
>        has been split into patches 1-7 to ease reviewing;
> 
>      - Pulled in target/ changes to cpu_get_tb_cpu_state() into this
>        patchset.  This was done to avoid pointer casts to target_ulong *
>        which would break for 32-bit targets on a 64-bit BE host;
> 
>        Note the small target/ changes are collected in a single
>        patch to not break bisection.  If it's still desirable to split
>        based on maintainer, let me know;
> 
>      - `last` argument of pageflags_[find|next] changed from target_long
>         to vaddr.  This change was left out of the last patchset due to
>         triggering a "Bad ram pointer" error (softmmu/physmem.c:2273)
>         when running make check for a i386-softmmu target.
> 
>         I was not able to recreate this on master or post rebase on
>         Richard's tcg-once branch.
> 
> Changes in v3:
>      - Rebased on master
> 
> Finally, the grand goal is to allow for heterogeneous QEMU binaries
> consisting of multiple frontends.
> 
> RFC: https://lists.nongnu.org/archive/html/qemu-devel/2022-12/msg04518.html
> 
> Anton Johansson (12):
>    accel: Replace target_ulong in tlb_*()
>    accel/tcg/translate-all.c: Widen pc and cs_base
>    target: Widen pc/cs_base in cpu_get_tb_cpu_state
>    accel/tcg/cputlb.c: Widen CPUTLBEntry access functions
>    accel/tcg/cputlb.c: Widen addr in MMULookupPageData
>    accel/tcg/cpu-exec.c: Widen pc to vaddr
>    accel/tcg: Widen pc to vaddr in CPUJumpCache
>    accel: Replace target_ulong with vaddr in probe_*()
>    accel/tcg: Replace target_ulong with vaddr in *_mmu_lookup()
>    accel/tcg: Replace target_ulong with vaddr in translator_*()
>    accel/tcg: Replace target_ulong with vaddr in page_*()
>    cpu: Replace target_ulong with hwaddr in tb_invalidate_phys_addr()
> 
>   accel/stubs/tcg-stub.c       |   6 +-
>   accel/tcg/cpu-exec.c         |  43 ++++---
>   accel/tcg/cputlb.c           | 233 +++++++++++++++++------------------
>   accel/tcg/internal.h         |   6 +-
>   accel/tcg/tb-hash.h          |  12 +-
>   accel/tcg/tb-jmp-cache.h     |   2 +-
>   accel/tcg/tb-maint.c         |   2 +-
>   accel/tcg/translate-all.c    |  13 +-
>   accel/tcg/translator.c       |  10 +-
>   accel/tcg/user-exec.c        |  58 +++++----
>   cpu.c                        |   2 +-
>   include/exec/cpu-all.h       |  10 +-
>   include/exec/cpu-defs.h      |   4 +-
>   include/exec/cpu_ldst.h      |  10 +-
>   include/exec/exec-all.h      |  95 +++++++-------
>   include/exec/translate-all.h |   2 +-
>   include/exec/translator.h    |   6 +-
>   include/qemu/plugin-memory.h |   2 +-
>   target/alpha/cpu.h           |   4 +-
>   target/arm/cpu.h             |   4 +-
>   target/arm/helper.c          |   4 +-
>   target/avr/cpu.h             |   4 +-
>   target/cris/cpu.h            |   4 +-
>   target/hexagon/cpu.h         |   4 +-
>   target/hppa/cpu.h            |   5 +-
>   target/i386/cpu.h            |   4 +-
>   target/loongarch/cpu.h       |   6 +-
>   target/m68k/cpu.h            |   4 +-
>   target/microblaze/cpu.h      |   4 +-
>   target/mips/cpu.h            |   4 +-
>   target/nios2/cpu.h           |   4 +-
>   target/openrisc/cpu.h        |   5 +-
>   target/ppc/cpu.h             |   8 +-
>   target/ppc/helper_regs.c     |   4 +-
>   target/riscv/cpu.h           |   4 +-
>   target/riscv/cpu_helper.c    |   4 +-
>   target/rx/cpu.h              |   4 +-
>   target/s390x/cpu.h           |   4 +-
>   target/sh4/cpu.h             |   4 +-
>   target/sparc/cpu.h           |   4 +-
>   target/tricore/cpu.h         |   4 +-
>   target/xtensa/cpu.h          |   4 +-
>   42 files changed, 307 insertions(+), 313 deletions(-)
> 
> --
> 2.41.0

Queued to tcg-next, thanks.


r~