tcg: Add tlb_dyn_max_bits to TCGContext
authorRichard Henderson <richard.henderson@linaro.org>
Sun, 2 Apr 2023 17:07:57 +0000 (10:07 -0700)
committerRichard Henderson <richard.henderson@linaro.org>
Wed, 17 May 2023 03:13:51 +0000 (20:13 -0700)
Disconnect guest tlb parameters from TCG compilation.

Reviewed-by: Anton Johansson <anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
accel/tcg/translate-all.c
include/tcg/tcg.h
tcg/aarch64/tcg-target.c.inc
tcg/i386/tcg-target.c.inc

index ca306f67dafcfee06f7076bb3eaccbc08aaf74b8..353849ca6dd3f1f8a732f27ec8c7e5f3dab99b35 100644 (file)
@@ -360,6 +360,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
 #ifdef CONFIG_SOFTMMU
     tcg_ctx->page_bits = TARGET_PAGE_BITS;
     tcg_ctx->page_mask = TARGET_PAGE_MASK;
+    tcg_ctx->tlb_dyn_max_bits = CPU_TLB_DYN_MAX_BITS;
 #endif
 
  tb_overflow:
index db57c4d492ef86af93bf311944c7e2fcca50c237..cd6327b1757704da124708fae6ef92fa6c080e99 100644 (file)
@@ -563,6 +563,7 @@ struct TCGContext {
 #ifdef CONFIG_SOFTMMU
     int page_mask;
     uint8_t page_bits;
+    uint8_t tlb_dyn_max_bits;
 #endif
 
     TCGRegSet reserved_regs;
index c2a1f09f17e6a6fd9f99c054994a4082bad4f314..bc6b99a1bd3cac4a275a67c4c8e4029ab244f36b 100644 (file)
@@ -1663,7 +1663,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h,
     ldst->oi = oi;
     ldst->addrlo_reg = addr_reg;
 
-    mask_type = (s->page_bits + CPU_TLB_DYN_MAX_BITS > 32
+    mask_type = (s->page_bits + s->tlb_dyn_max_bits > 32
                  ? TCG_TYPE_I64 : TCG_TYPE_I32);
 
     /* Load env_tlb(env)->f[mmu_idx].{mask,table} into {x0,x1}.  */
index c5d4570ba2307d48d8c7123f18e52530b945f57c..8b9a5f00e54ccc1846724df0d94032f9c2234256 100644 (file)
@@ -1933,7 +1933,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h,
         trexw = (ttype == TCG_TYPE_I32 ? 0 : P_REXW);
         if (TCG_TYPE_PTR == TCG_TYPE_I64) {
             hrexw = P_REXW;
-            if (s->page_bits + CPU_TLB_DYN_MAX_BITS > 32) {
+            if (s->page_bits + s->tlb_dyn_max_bits > 32) {
                 tlbtype = TCG_TYPE_I64;
                 tlbrexw = P_REXW;
             }