Commit 079d8046a0 for qemu.org
commit 079d8046a0dae7edd375291aeeaf11af3ecac5e2
Author: Peter Maydell <peter.maydell@linaro.org>
Date: Thu Oct 22 13:58:56 2026 +0100
target/loongarch: Convert to translate_for_debug
Convert loongarch to providing the translate_for_debug method rather
than the deprecated get_phys_addr_debug method.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20261022125858.310252-4-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
diff --git a/target/loongarch/cpu-mmu.h b/target/loongarch/cpu-mmu.h
index 54fb732d62..491eb514d9 100644
--- a/target/loongarch/cpu-mmu.h
+++ b/target/loongarch/cpu-mmu.h
@@ -99,7 +99,8 @@ TLBRet loongarch_ptw(CPULoongArchState *env, MMUContext *context,
int access_type, int mmu_idx, int debug);
void get_dir_base_width(CPULoongArchState *env, uint64_t *dir_base,
uint64_t *dir_width, unsigned int level);
-hwaddr loongarch_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr);
+bool loongarch_cpu_translate_for_debug(CPUState *cpu, vaddr addr,
+ TranslateForDebugResult *result);
uint64_t loongarch_palen_mask(CPULoongArchState *env);
#endif /* LOONGARCH_CPU_MMU_H */
diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index c2635b5655..dd70beca18 100644
--- a/target/loongarch/cpu.c
+++ b/target/loongarch/cpu.c
@@ -882,7 +882,7 @@ static const struct SysemuCPUOps loongarch_sysemu_ops = {
.write_elf64_note = loongarch_cpu_write_elf64_note,
.get_dump_info = loongarch_get_dump_info,
.get_note_size = loongarch_get_note_size,
- .get_phys_addr_debug = loongarch_cpu_get_phys_addr_debug,
+ .translate_for_debug = loongarch_cpu_translate_for_debug,
};
static int64_t loongarch_cpu_get_arch_id(CPUState *cs)
diff --git a/target/loongarch/cpu_helper.c b/target/loongarch/cpu_helper.c
index d1d66742d8..271b4adc17 100644
--- a/target/loongarch/cpu_helper.c
+++ b/target/loongarch/cpu_helper.c
@@ -327,7 +327,8 @@ TLBRet get_physical_address(CPULoongArchState *env, MMUContext *context,
return loongarch_map_address(env, context, access_type, mmu_idx, is_debug);
}
-hwaddr loongarch_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr)
+bool loongarch_cpu_translate_for_debug(CPUState *cs, vaddr addr,
+ TranslateForDebugResult *result)
{
CPULoongArchState *env = cpu_env(cs);
MMUContext context;
@@ -335,9 +336,14 @@ hwaddr loongarch_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr)
context.addr = addr;
if (get_physical_address(env, &context, MMU_DATA_LOAD,
cpu_mmu_index(cs, false), 1) != TLBRET_MATCH) {
- return -1;
+ return false;
}
- return context.physical;
+ *result = (TranslateForDebugResult) {
+ .physaddr = context.physical,
+ .attrs.debug = 1,
+ .lg_page_size = TARGET_PAGE_BITS,
+ };
+ return true;
}
uint64_t loongarch_palen_mask(CPULoongArchState *env)