Message ID | 20241114160131.48616-22-richard.henderson@linaro.org |
---|---|
State | New |
Headers | show |
Series | accel/tcg: Convert victim tlb to IntervalTree | expand |
On 11/14/24 08:00, 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 3e24529f4f..a4c69bcbf1 100644 > --- a/accel/tcg/cputlb.c > +++ b/accel/tcg/cputlb.c > @@ -1373,7 +1373,6 @@ static int probe_access_internal(CPUState *cpu, vaddr addr, > CPUTLBEntry *entry = tlb_entry(cpu, mmu_idx, addr); > uint64_t tlb_addr = tlb_read_idx(entry, access_type); > 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(tlb_addr, addr)) { > @@ -1404,9 +1403,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 3e24529f4f..a4c69bcbf1 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1373,7 +1373,6 @@ static int probe_access_internal(CPUState *cpu, vaddr addr, CPUTLBEntry *entry = tlb_entry(cpu, mmu_idx, addr); uint64_t tlb_addr = tlb_read_idx(entry, access_type); 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(tlb_addr, addr)) { @@ -1404,9 +1403,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(-)