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, philmd@linaro.org,
	peter.maydell@linaro.org
Subject: Re: [PATCH 03/11] accel/tcg: Modify tlb_*() to use CPUState
Date: Tue, 12 Sep 2023 11:42:38 -0700	[thread overview]
Message-ID: <f5bb1f4f-ccab-5245-8f99-2daefd6aecf0@linaro.org> (raw)
In-Reply-To: <20230912153428.17816-4-anjo@rev.ng>

On 9/12/23 08:34, Anton Johansson wrote:
> Changes tlb_*() functions to take CPUState instead of CPUArchState, as
> they don't require the full CPUArchState. This makes it easier to
> decouple target-(in)dependent code.
> 
> Signed-off-by: Anton Johansson <anjo@rev.ng>
> ---
>   include/exec/cpu_ldst.h |   8 +-
>   accel/tcg/cputlb.c      | 218 +++++++++++++++++++---------------------
>   2 files changed, 107 insertions(+), 119 deletions(-)
> 
> diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
> index da10ba1433..8d168f76ce 100644
> --- a/include/exec/cpu_ldst.h
> +++ b/include/exec/cpu_ldst.h
> @@ -361,19 +361,19 @@ static inline uint64_t tlb_addr_write(const CPUTLBEntry *entry)
>   }
>   
>   /* Find the TLB index corresponding to the mmu_idx + address pair.  */
> -static inline uintptr_t tlb_index(CPUArchState *env, uintptr_t mmu_idx,
> +static inline uintptr_t tlb_index(CPUState *cpu, uintptr_t mmu_idx,
>                                     vaddr addr)
>   {
> -    uintptr_t size_mask = env_tlb(env)->f[mmu_idx].mask >> CPU_TLB_ENTRY_BITS;
> +    uintptr_t size_mask = cpu_tlb(cpu)->f[mmu_idx].mask >> CPU_TLB_ENTRY_BITS;

No, I think this is a bad idea, because it bakes an extra memory indirection into very 
fundamental routines.

If we change anything here, we should pass in CPUTLB.


r~


  reply	other threads:[~2023-09-12 18:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12 15:34 [PATCH 00/11] Reduce usage of CPUArchState in cputlb.c Anton Johansson via
2023-09-12 15:34 ` [PATCH 01/11] target/arm: Replace TARGET_PAGE_ENTRY_EXTRA Anton Johansson via
2023-09-12 15:34 ` [PATCH 02/11] include: Introduce tlb_ptr field to CPUState Anton Johansson via
2023-09-12 18:43   ` Richard Henderson
2023-09-13 15:23     ` Anton Johansson via
2023-09-12 15:34 ` [PATCH 03/11] accel/tcg: Modify tlb_*() to use CPUState Anton Johansson via
2023-09-12 18:42   ` Richard Henderson [this message]
2023-09-13 19:09     ` Anton Johansson via
2023-09-12 15:34 ` [PATCH 04/11] accel/tcg: Modify probe_access_internal() " Anton Johansson via
2023-09-12 15:34 ` [PATCH 05/11] accel/tcg: Modifies memory access functions " Anton Johansson via
2023-09-12 19:34   ` Richard Henderson
2023-09-13 13:46     ` Anton Johansson via
2023-09-12 15:34 ` [PATCH 06/11] accel/tcg: Modify atomic_mmu_lookup() " Anton Johansson via
2023-09-12 15:34 ` [PATCH 07/11] accel/tcg: Use CPUState in atomicity helpers Anton Johansson via
2023-09-12 15:34 ` [PATCH 08/11] include/exec: Remove env_tlb() Anton Johansson via
2023-09-12 15:34 ` [PATCH 09/11] tcg: Update env_tlb() comments Anton Johansson via
2023-09-12 15:34 ` [PATCH 10/11] accel/tcg: Unify user and softmmu do_[st|ld]*_mmu() Anton Johansson via
2023-09-12 15:34 ` [PATCH 11/11] accel/tcg: move ld/st helpers to ldst_common.c.inc 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=f5bb1f4f-ccab-5245-8f99-2daefd6aecf0@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=ale@rev.ng \
    --cc=anjo@rev.ng \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).