On 17/4/25 05:51, Bibo Mao wrote:
Function loongarch_tlb_search() and loongarch_map_tlb_entry() works
only in TCG mode, move these functions to directory tcg.

Signed-off-by: Bibo Mao <maob...@loongson.cn>
---
  target/loongarch/cpu_helper.c     | 153 ------------------------------
  target/loongarch/internals.h      |  14 ++-
  target/loongarch/tcg/tlb_helper.c | 144 ++++++++++++++++++++++++++++
  3 files changed, 156 insertions(+), 155 deletions(-)


diff --git a/target/loongarch/internals.h b/target/loongarch/internals.h
index 9fdc3059d8..f85927860b 100644
--- a/target/loongarch/internals.h
+++ b/target/loongarch/internals.h
@@ -54,8 +54,6 @@ uint64_t 
cpu_loongarch_get_constant_timer_counter(LoongArchCPU *cpu);
  uint64_t cpu_loongarch_get_constant_timer_ticks(LoongArchCPU *cpu);
  void cpu_loongarch_store_constant_timer_config(LoongArchCPU *cpu,
                                                 uint64_t value);
-bool loongarch_tlb_search(CPULoongArchState *env, target_ulong vaddr,
-                          int *index);
  int get_physical_address(CPULoongArchState *env, hwaddr *physical,
                           int *prot, target_ulong address,
                           MMUAccessType access_type, int mmu_idx, int 
is_debug);
@@ -67,6 +65,18 @@ hwaddr loongarch_cpu_get_phys_page_debug(CPUState *cpu, 
vaddr addr);
  bool loongarch_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
                              MMUAccessType access_type, int mmu_idx,
                              bool probe, uintptr_t retaddr);
+int loongarch_get_addr_from_tlb(CPULoongArchState *env, hwaddr *physical,
+                                int *prot, target_ulong address,
+                                MMUAccessType access_type, int mmu_idx);
+#else
+static inline int loongarch_get_addr_from_tlb(CPULoongArchState *env,
+                                              hwaddr *physical,
+                                              int *prot, target_ulong address,
+                                              MMUAccessType access_type,
+                                              int mmu_idx)
+{
+    return TLBRET_NOMATCH;
+}
  #endif

I wonder if we shouldn't move these declarations to
target/loongarch/tcg/tcg_loongarch.h. Can be done as
future cleanup, so:

Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org>

  #endif /* !CONFIG_USER_ONLY */

Reply via email to