@samitouri / QOSamiQemu / commits / b8fff4aef6

target/microblaze: Convert to translate_for_debug

The get_phys_addr_attrs_debug method of SysemuCPUOps is used only by x86 and microblaze. Convert microblaze to the newer translate_for_debug method, as a step towards being able to remove get_phys_addr_attrs_debug. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <20260528161450.3564396-2-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Peter Maydell committed May 28, 2026 at 17:14 UTC b8fff4aef6a21049a298f9abcd854300c4b69e85
3 files changed +12 -10
target/microblaze/cpu.c
+1 -1
@@ -428,7 +428,7 @@ static ObjectClass *mb_cpu_class_by_name(const char *cpu_model)
428
429 static const struct SysemuCPUOps mb_sysemu_ops = {
430 .has_work = mb_cpu_has_work,
431 - .get_phys_addr_attrs_debug = mb_cpu_get_phys_addr_attrs_debug,
431 + .translate_for_debug = mb_cpu_translate_for_debug,
432 };
433 #endif
434
target/microblaze/cpu.h
+2 -2
@@ -369,8 +369,8 @@ struct MicroBlazeCPUClass {
369 #ifndef CONFIG_USER_ONLY
370 void mb_cpu_do_interrupt(CPUState *cs);
371 bool mb_cpu_exec_interrupt(CPUState *cs, int int_req);
372 -hwaddr mb_cpu_get_phys_addr_attrs_debug(CPUState *cpu, vaddr addr,
373 - MemTxAttrs *attrs);
372 +bool mb_cpu_translate_for_debug(CPUState *cs, vaddr addr,
373 + TranslateForDebugResult *result);
374 #endif /* !CONFIG_USER_ONLY */
375 G_NORETURN void mb_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
376 MMUAccessType access_type,
target/microblaze/helper.c
+9 -7
@@ -280,8 +280,8 @@ void mb_cpu_do_interrupt(CPUState *cs)
280 }
281 }
282
283 -hwaddr mb_cpu_get_phys_addr_attrs_debug(CPUState *cs, vaddr addr,
284 - MemTxAttrs *attrs)
283 +bool mb_cpu_translate_for_debug(CPUState *cs, vaddr addr,
284 + TranslateForDebugResult *result)
285 {
286 MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs);
287 hwaddr paddr = 0;
@@ -289,10 +289,6 @@ hwaddr mb_cpu_get_phys_addr_attrs_debug(CPUState *cs, vaddr addr,
289 int mmu_idx = cpu_mmu_index(cs, false);
290 unsigned int hit;
291
292 - /* Caller doesn't initialize */
293 - *attrs = (MemTxAttrs) {};
294 - attrs->secure = mb_cpu_access_is_secure(cpu, MMU_DATA_LOAD);
295 -
292 if (mmu_idx != MMU_NOMMU_IDX) {
293 hit = mmu_translate(cpu, &lu, addr, 0, 0);
294 if (hit) {
@@ -303,7 +299,13 @@ hwaddr mb_cpu_get_phys_addr_attrs_debug(CPUState *cs, vaddr addr,
299 paddr = addr;
300 }
301
306 - return paddr;
302 + *result = (TranslateForDebugResult) {
303 + .physaddr = paddr,
304 + .lg_page_size = TARGET_PAGE_BITS,
305 + .attrs.secure = mb_cpu_access_is_secure(cpu, MMU_DATA_LOAD),
306 + .attrs.debug = 1,
307 + };
308 + return true;
309 }
310
311 bool mb_cpu_exec_interrupt(CPUState *cs, int interrupt_request)