On 22/4/25 04:57, Bibo Mao wrote:
> Function loongarch_cpu_tlb_fill() only works in TCG mode, move its
> definition from header file internals.h to file tcg/tcg_loongarch.h
>
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
> target/loongarch/cpu.c | 1 +
> target/loongarch/internals.h | 5 -----
> target/loongarch/tcg/tcg_loongarch.h | 4 ++++
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
> index ea1665e270..f9e35f2693 100644
> --- a/target/loongarch/cpu.c
> +++ b/target/loongarch/cpu.c
> @@ -31,6 +31,7 @@
> #ifdef CONFIG_TCG
> #include "exec/cpu_ldst.h"
> #include "tcg/tcg.h"
> +#include "tcg/tcg_loongarch.h"
> #endif
>
> const char * const regnames[32] = {
> diff --git a/target/loongarch/internals.h b/target/loongarch/internals.h
> index 3a079feb1d..a7384b0d31 100644
> --- a/target/loongarch/internals.h
> +++ b/target/loongarch/internals.h
> @@ -61,11 +61,6 @@ void get_dir_base_width(CPULoongArchState *env, uint64_t *dir_base,
> uint64_t *dir_width, target_ulong level);
> hwaddr loongarch_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
>
> -#ifdef CONFIG_TCG
> -bool loongarch_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
> - MMUAccessType access_type, int mmu_idx,
> - bool probe, uintptr_t retaddr);
> -#endif
> #endif /* !CONFIG_USER_ONLY */
>
> uint64_t read_fcc(CPULoongArchState *env);
> diff --git a/target/loongarch/tcg/tcg_loongarch.h b/target/loongarch/tcg/tcg_loongarch.h
> index 69a93bfc3e..3796c85f6e 100644
> --- a/target/loongarch/tcg/tcg_loongarch.h
> +++ b/target/loongarch/tcg/tcg_loongarch.h
> @@ -11,6 +11,10 @@
> void loongarch_csr_translate_init(void);
>
> #ifdef CONFIG_TCG
> +bool loongarch_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
> + MMUAccessType access_type, int mmu_idx,
> + bool probe, uintptr_t retaddr);
Out of the #ifdef.
> int loongarch_get_addr_from_tlb(CPULoongArchState *env, hwaddr *physical,
> int *prot, target_ulong address,
> MMUAccessType access_type, int mmu_idx);