Skip to content

Commit

Permalink
tcg: Remove TCGContext.tlb_fast_offset
Browse files Browse the repository at this point in the history
Now that there is no padding between CPUNegativeOffsetState
and CPUArchState, this value is constant across all targets.

Reviewed-by: Anton Johansson <anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed Oct 3, 2023
1 parent 2709e69 commit 59e9243
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 0 additions & 2 deletions accel/tcg/translate-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
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;
tcg_ctx->tlb_fast_offset = (int)offsetof(ArchCPU, parent_obj.neg.tlb.f)
- (int)offsetof(ArchCPU, env);
#endif
tcg_ctx->insn_start_words = TARGET_INSN_START_WORDS;
#ifdef TCG_GUEST_DEFAULT_MO
Expand Down
1 change: 0 additions & 1 deletion include/tcg/tcg.h
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,6 @@ struct TCGContext {
TCGType addr_type; /* TCG_TYPE_I32 or TCG_TYPE_I64 */

#ifdef CONFIG_SOFTMMU
int tlb_fast_offset;
int page_mask;
uint8_t page_bits;
uint8_t tlb_dyn_max_bits;
Expand Down
15 changes: 9 additions & 6 deletions tcg/tcg.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@ static uintptr_t G_GNUC_UNUSED get_jmp_target_addr(TCGContext *s, int which)
#if defined(CONFIG_SOFTMMU) && !defined(CONFIG_TCG_INTERPRETER)
static int tlb_mask_table_ofs(TCGContext *s, int which)
{
return s->tlb_fast_offset + which * sizeof(CPUTLBDescFast);
return (offsetof(CPUNegativeOffsetState, tlb.f[which]) -
sizeof(CPUNegativeOffsetState));
}
#endif

Expand Down Expand Up @@ -734,6 +735,13 @@ static const TCGTargetOpDef constraint_sets[] = {

#include "tcg-target.c.inc"

#ifndef CONFIG_TCG_INTERPRETER
/* Validate CPUTLBDescFast placement. */
QEMU_BUILD_BUG_ON((int)(offsetof(CPUNegativeOffsetState, tlb.f[0]) -
sizeof(CPUNegativeOffsetState))
< MIN_TLB_MASK_TABLE_OFS);
#endif

static void alloc_tcg_plugin_context(TCGContext *s)
{
#ifdef CONFIG_PLUGIN
Expand Down Expand Up @@ -1497,11 +1505,6 @@ void tcg_func_start(TCGContext *s)
tcg_debug_assert(s->addr_type == TCG_TYPE_I32 ||
s->addr_type == TCG_TYPE_I64);

#if defined(CONFIG_SOFTMMU) && !defined(CONFIG_TCG_INTERPRETER)
tcg_debug_assert(s->tlb_fast_offset < 0);
tcg_debug_assert(s->tlb_fast_offset >= MIN_TLB_MASK_TABLE_OFS);
#endif

tcg_debug_assert(s->insn_start_words > 0);
}

Expand Down

0 comments on commit 59e9243

Please sign in to comment.