Message ID | 20241009150855.804605-18-richard.henderson@linaro.org |
---|---|
State | New |
Headers | show |
Series | accel/tcg: Convert victim tlb to IntervalTree | expand |
On 10/9/24 08:08, Richard Henderson wrote: > Remove force_mmio and place the expression into the IF > expression, behind the short-circuit logic expressions > that might eliminate its computation. > > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- > accel/tcg/cputlb.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c > index 561f66c723..59ee766d51 100644 > --- a/accel/tcg/cputlb.c > +++ b/accel/tcg/cputlb.c > @@ -1403,7 +1403,6 @@ static int probe_access_internal(CPUState *cpu, vaddr addr, > uint64_t tlb_addr = tlb_read_idx(entry, access_type); > vaddr page_addr = addr & TARGET_PAGE_MASK; > int flags = TLB_FLAGS_MASK & ~TLB_FORCE_SLOW; > - bool force_mmio = check_mem_cbs && cpu_plugin_mem_cbs_enabled(cpu); > CPUTLBEntryFull *full; > > if (!tlb_hit_page(tlb_addr, page_addr)) { > @@ -1434,9 +1433,14 @@ static int probe_access_internal(CPUState *cpu, vaddr addr, > *pfull = full = &cpu->neg.tlb.d[mmu_idx].fulltlb[index]; > flags |= full->slow_flags[access_type]; > > - /* Fold all "mmio-like" bits into TLB_MMIO. This is not RAM. */ > - if (unlikely(flags & ~(TLB_WATCHPOINT | TLB_NOTDIRTY | TLB_CHECK_ALIGNED)) > - || (access_type != MMU_INST_FETCH && force_mmio)) { > + /* > + * Fold all "mmio-like" bits, and required plugin callbacks, to TLB_MMIO. > + * These cannot be treated as RAM. > + */ > + if ((flags & ~(TLB_WATCHPOINT | TLB_NOTDIRTY | TLB_CHECK_ALIGNED)) > + || (access_type != MMU_INST_FETCH > + && check_mem_cbs > + && cpu_plugin_mem_cbs_enabled(cpu))) { > *phost = NULL; > return TLB_MMIO; > } Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 561f66c723..59ee766d51 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1403,7 +1403,6 @@ static int probe_access_internal(CPUState *cpu, vaddr addr, uint64_t tlb_addr = tlb_read_idx(entry, access_type); vaddr page_addr = addr & TARGET_PAGE_MASK; int flags = TLB_FLAGS_MASK & ~TLB_FORCE_SLOW; - bool force_mmio = check_mem_cbs && cpu_plugin_mem_cbs_enabled(cpu); CPUTLBEntryFull *full; if (!tlb_hit_page(tlb_addr, page_addr)) { @@ -1434,9 +1433,14 @@ static int probe_access_internal(CPUState *cpu, vaddr addr, *pfull = full = &cpu->neg.tlb.d[mmu_idx].fulltlb[index]; flags |= full->slow_flags[access_type]; - /* Fold all "mmio-like" bits into TLB_MMIO. This is not RAM. */ - if (unlikely(flags & ~(TLB_WATCHPOINT | TLB_NOTDIRTY | TLB_CHECK_ALIGNED)) - || (access_type != MMU_INST_FETCH && force_mmio)) { + /* + * Fold all "mmio-like" bits, and required plugin callbacks, to TLB_MMIO. + * These cannot be treated as RAM. + */ + if ((flags & ~(TLB_WATCHPOINT | TLB_NOTDIRTY | TLB_CHECK_ALIGNED)) + || (access_type != MMU_INST_FETCH + && check_mem_cbs + && cpu_plugin_mem_cbs_enabled(cpu))) { *phost = NULL; return TLB_MMIO; }
Remove force_mmio and place the expression into the IF expression, behind the short-circuit logic expressions that might eliminate its computation. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- accel/tcg/cputlb.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)