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: Anton Johansson
Subject: Re: [PATCH 03/11] accel/tcg: Modify tlb_*() to use CPUState
Date: Wed, 13 Sep 2023 21:09:49 +0200
User-agent: Mozilla Thunderbird


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.
Yeah, you're right. I'll pass CPUTLB instead, or do you have another idea?

Thanks a lot for the input!

--
Anton Johansson,
rev.ng Labs Srl.




reply via email to

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