@samitouri / QOSamiQemu / commits / 733c2769be

target/sparc: Use cpu_translate_for_debug()

We want to remove the cpu_get_phys_addr_debug() function; update the sparc dump_mmu() function to use cpu_translate_for_debug() instead. The "mmu_probe succeeds but debug translate fails" cases are probably not possible in practice; since cpu_get_phys_addr_debug() would return -1 in that situation we make this conversion retain that behaviour. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <20260430093810.2762539-21-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Peter Maydell committed Apr 30, 2026 at 10:38 UTC 733c2769be668d475ce00c662373e12c2836a2a3
1 file changed +16 -3
target/sparc/mmu_helper.c
+16 -3
@@ -360,26 +360,39 @@ void dump_mmu(CPUSPARCState *env)
360 unsigned int n, m, o;
361 hwaddr pa;
362 uint32_t pde;
363 + TranslateForDebugResult tres;
364
365 qemu_printf("Root ptr: " HWADDR_FMT_plx ", ctx: %d\n",
366 (hwaddr)env->mmuregs[1] << 4, env->mmuregs[2]);
367 for (n = 0, va = 0; n < 256; n++, va += 16 * 1024 * 1024) {
368 pde = mmu_probe(env, va, 2);
369 if (pde) {
369 - pa = cpu_get_phys_addr_debug(cs, va);
370 + if (!cpu_translate_for_debug(cs, va, &tres)) {
371 + pa = -1;
372 + } else {
373 + pa = tres.physaddr;
374 + }
375 qemu_printf("VA: " TARGET_FMT_lx ", PA: " HWADDR_FMT_plx
376 " PDE: " TARGET_FMT_lx "\n", va, pa, pde);
377 for (m = 0, va1 = va; m < 64; m++, va1 += 256 * 1024) {
378 pde = mmu_probe(env, va1, 1);
379 if (pde) {
375 - pa = cpu_get_phys_addr_debug(cs, va1);
380 + if (!cpu_translate_for_debug(cs, va1, &tres)) {
381 + pa = -1;
382 + } else {
383 + pa = tres.physaddr;
384 + }
385 qemu_printf(" VA: " TARGET_FMT_lx ", PA: "
386 HWADDR_FMT_plx " PDE: " TARGET_FMT_lx "\n",
387 va1, pa, pde);
388 for (o = 0, va2 = va1; o < 64; o++, va2 += 4 * 1024) {
389 pde = mmu_probe(env, va2, 0);
390 if (pde) {
382 - pa = cpu_get_phys_addr_debug(cs, va2);
391 + if (!cpu_translate_for_debug(cs, va2, &tres)) {
392 + pa = -1;
393 + } else {
394 + pa = tres.physaddr;
395 + }
396 qemu_printf(" VA: " TARGET_FMT_lx ", PA: "
397 HWADDR_FMT_plx " PTE: "
398 TARGET_FMT_lx "\n",