[PATCH-for-9.0] accel/tcg: Remove unused tb_invalidate_phys_addr()

Philippe Mathieu-Daudé posted 1 patch 12 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20231130203241.31099-1-philmd@linaro.org
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>
include/exec/exec-all.h |  5 -----
cpu-target.c            | 29 -----------------------------
2 files changed, 34 deletions(-)
[PATCH-for-9.0] accel/tcg: Remove unused tb_invalidate_phys_addr()
Posted by Philippe Mathieu-Daudé 12 months ago
Commit e3f7c801f1 introduced the TCGCPUOps::debug_check_breakpoint()
handler, and commit 10c37828b2 "moved breakpoint recognition outside
of translation", so "we no longer need to flush any TBs when changing
BPs".

The last target using tb_invalidate_phys_addr() was converted to the
debug_check_breakpoint(), so this function is now unused. Remove it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
Based-on: <20231130171920.3798954-1-jcmvbkbc@gmail.com>
---
 include/exec/exec-all.h |  5 -----
 cpu-target.c            | 29 -----------------------------
 2 files changed, 34 deletions(-)

diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index ee90ef122b..df3d93a2e2 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -518,11 +518,6 @@ static inline void tb_set_page_addr1(TranslationBlock *tb,
 uint32_t curr_cflags(CPUState *cpu);
 
 /* TranslationBlock invalidate API */
-#if defined(CONFIG_USER_ONLY)
-void tb_invalidate_phys_addr(hwaddr addr);
-#else
-void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs);
-#endif
 void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
 void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t last);
 void tb_set_jmp_target(TranslationBlock *tb, int n, uintptr_t addr);
diff --git a/cpu-target.c b/cpu-target.c
index 508013e23d..997ca2e846 100644
--- a/cpu-target.c
+++ b/cpu-target.c
@@ -276,35 +276,6 @@ void list_cpus(void)
 #endif
 }
 
-#if defined(CONFIG_USER_ONLY)
-void tb_invalidate_phys_addr(hwaddr addr)
-{
-    mmap_lock();
-    tb_invalidate_phys_page(addr);
-    mmap_unlock();
-}
-#else
-void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs)
-{
-    ram_addr_t ram_addr;
-    MemoryRegion *mr;
-    hwaddr l = 1;
-
-    if (!tcg_enabled()) {
-        return;
-    }
-
-    RCU_READ_LOCK_GUARD();
-    mr = address_space_translate(as, addr, &addr, &l, false, attrs);
-    if (!(memory_region_is_ram(mr)
-          || memory_region_is_romd(mr))) {
-        return;
-    }
-    ram_addr = memory_region_get_ram_addr(mr) + addr;
-    tb_invalidate_phys_page(ram_addr);
-}
-#endif
-
 /* enable or disable single step mode. EXCP_DEBUG is returned by the
    CPU loop after each instruction */
 void cpu_single_step(CPUState *cpu, int enabled)
-- 
2.41.0


Re: [PATCH-for-9.0] accel/tcg: Remove unused tb_invalidate_phys_addr()
Posted by Richard Henderson 12 months ago
On 11/30/23 14:32, Philippe Mathieu-Daudé wrote:
> Commit e3f7c801f1 introduced the TCGCPUOps::debug_check_breakpoint()
> handler, and commit 10c37828b2 "moved breakpoint recognition outside
> of translation", so "we no longer need to flush any TBs when changing
> BPs".
> 
> The last target using tb_invalidate_phys_addr() was converted to the
> debug_check_breakpoint(), so this function is now unused. Remove it.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> Based-on: <20231130171920.3798954-1-jcmvbkbc@gmail.com>
> ---
>   include/exec/exec-all.h |  5 -----
>   cpu-target.c            | 29 -----------------------------
>   2 files changed, 34 deletions(-)


Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~