qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 03/11] accel/tcg: Modify tlb_*() to use CPUState


From: Richard Henderson
Subject: Re: [PATCH 03/11] accel/tcg: Modify tlb_*() to use CPUState
Date: Tue, 12 Sep 2023 11:42:38 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0

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 via email to

[Prev in Thread] Current Thread [Next in Thread]