qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Anton Johansson <anjo@rev.ng>, qemu-devel@nongnu.org
Cc: ale@rev.ng, pbonzini@redhat.com, eduardo@habkost.net,
	philmd@linaro.org, marcel.apfelbaum@gmail.com,
	wangyanan55@huawei.com
Subject: Re: [PATCH 1/8] accel: Replace `target_ulong` with `vaddr` in TB/TLB
Date: Sun, 23 Apr 2023 10:09:30 +0100	[thread overview]
Message-ID: <b8dd9e8a-c9c8-12a1-fcc8-026437a07fb4@linaro.org> (raw)
In-Reply-To: <20230420212850.20400-2-anjo@rev.ng>

On 4/20/23 22:28, Anton Johansson wrote:
> Changes pc and cs_base in TranslationBlock from target_ulong to vaddr.
> Auxilliary structs and tb_*()/tlb_*() functions that depend on this
> change are also updated to take a vaddr for guest virtual addresses.
> 
> Signed-off-by: Anton Johansson <anjo@rev.ng>
> ---
>   accel/stubs/tcg-stub.c       |   2 +-
>   accel/tcg/cpu-exec.c         |  49 +++++-----
>   accel/tcg/cputlb.c           | 179 +++++++++++++++++------------------
>   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    |  15 +--
>   include/exec/cpu-defs.h      |   4 +-
>   include/exec/cpu_ldst.h      |   6 +-
>   include/exec/exec-all.h      |  82 ++++++++--------
>   include/qemu/plugin-memory.h |   2 +-
>   12 files changed, 181 insertions(+), 180 deletions(-)

This is too large and must be split.  In addition, there are places where you must take 
more care with the replacement.

> @@ -412,10 +412,11 @@ const void *HELPER(lookup_tb_ptr)(CPUArchState *env)
>   {
>       CPUState *cpu = env_cpu(env);
>       TranslationBlock *tb;
> -    target_ulong cs_base, pc;
> +    vaddr cs_base = 0, pc = 0;
>       uint32_t flags, cflags;
>   
> -    cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);
> +    cpu_get_tb_cpu_state(env, (target_ulong *) &pc,
> +                         (target_ulong *) &cs_base, &flags);

This simply will not work on big-endian hosts.

> @@ -543,7 +544,8 @@ void cpu_exec_step_atomic(CPUState *cpu)
>           g_assert(!cpu->running);
>           cpu->running = true;
>   
> -        cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);
> +        cpu_get_tb_cpu_state(env, (target_ulong *) &pc,
> +                             (target_ulong *) &cs_base, &flags);

Likewise.

> @@ -946,10 +948,11 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc)
>   
>           while (!cpu_handle_interrupt(cpu, &last_tb)) {
>               TranslationBlock *tb;
> -            target_ulong cs_base, pc;
> +            vaddr cs_base = 0, pc = 0;
>               uint32_t flags, cflags;
>   
> -            cpu_get_tb_cpu_state(cpu->env_ptr, &pc, &cs_base, &flags);
> +            cpu_get_tb_cpu_state(cpu->env_ptr, (target_ulong *) &pc,
> +                                 (target_ulong *) &cs_base, &flags);

Likewise.  And one more in translate-all.c.

> @@ -560,15 +557,15 @@ static void tlb_flush_page_by_mmuidx_async_0(CPUState *cpu,
>   static void tlb_flush_page_by_mmuidx_async_1(CPUState *cpu,
>                                                run_on_cpu_data data)
>   {
> -    target_ulong addr_and_idxmap = (target_ulong) data.target_ptr;
> -    target_ulong addr = addr_and_idxmap & TARGET_PAGE_MASK;
> +    vaddr addr_and_idxmap = (vaddr) data.target_ptr;

run_on_cpu_data.target_ptr is already vaddr, no need for cast.


r~


  reply	other threads:[~2023-04-23  9:10 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 21:28 [PATCH 0/8] Start replacing target_ulong with vaddr Anton Johansson via
2023-04-20 21:28 ` [PATCH 1/8] accel: Replace `target_ulong` with `vaddr` in TB/TLB Anton Johansson via
2023-04-23  9:09   ` Richard Henderson [this message]
2023-04-24 12:47     ` Anton Johansson via
2023-04-20 21:28 ` [PATCH 2/8] accel: Replace target_ulong with vaddr in probe_*() Anton Johansson via
2023-04-23  9:09   ` Richard Henderson
2023-04-20 21:28 ` [PATCH 3/8] accel/tcg: Replace target_ulong with vaddr in *_mmu_lookup() Anton Johansson via
2023-04-23  9:10   ` Richard Henderson
2023-04-20 21:28 ` [PATCH 4/8] accel/tcg: Replace target_ulong with vaddr in helper_unaligned_*() Anton Johansson via
2023-04-23  9:10   ` Richard Henderson
2023-04-24 12:48     ` Anton Johansson via
2023-04-20 21:28 ` [PATCH 5/8] accel/tcg: Replace target_ulong with vaddr in translator_*() Anton Johansson via
2023-04-23  9:11   ` Richard Henderson
2023-04-20 21:28 ` [PATCH 6/8] accel/tcg: Replace target_ulong with vaddr in page_*() Anton Johansson via
2023-04-23  9:13   ` Richard Henderson
2023-04-24 12:51     ` Anton Johansson via
2023-04-24 13:10       ` Richard Henderson
2023-04-20 21:28 ` [PATCH 7/8] cpu: Replace target_ulong with vaddr in tb_invalidate_phys_addr() Anton Johansson via
2023-04-23  9:14   ` Richard Henderson
2023-04-23 17:29     ` Philippe Mathieu-Daudé
2023-04-23 18:46       ` Richard Henderson
2023-04-23 19:35         ` Alex Bennée
2023-04-23 19:42           ` Richard Henderson
2023-04-24 12:52             ` Anton Johansson via
2023-04-24 15:19               ` Philippe Mathieu-Daudé
2023-04-20 21:28 ` [PATCH 8/8] tcg: Replace target_ulong with vaddr in tcg_gen_code() Anton Johansson via
2023-04-23  9:15   ` Richard Henderson
2023-04-23 10:59 ` [PATCH 0/8] Start replacing target_ulong with vaddr Richard Henderson
2023-04-24 12:37   ` Anton Johansson via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b8dd9e8a-c9c8-12a1-fcc8-026437a07fb4@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=ale@rev.ng \
    --cc=anjo@rev.ng \
    --cc=eduardo@habkost.net \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wangyanan55@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).