On Fri, 20 Mar 2026 at 13:51, Philippe Mathieu-Daudé <[email protected]> wrote:
>
> Currently 'info tlb' dumps the MMU information on stdout.
> Propagate the @Monitor argument and replace qemu_printf()
> by monitor_printf() to dump information over the monitor
> (which is not always stdout).
>
> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
> ---
> target/xtensa/cpu.h | 2 +-
> target/xtensa/mmu_helper.c | 44 ++++++++++++++++++--------------------
> target/xtensa/monitor.c | 2 +-
> 3 files changed, 23 insertions(+), 25 deletions(-)
>
> diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h
> index 22192924841..2e56e337022 100644
> --- a/target/xtensa/cpu.h
> +++ b/target/xtensa/cpu.h
> @@ -694,7 +694,7 @@ int xtensa_get_physical_addr(CPUXtensaState *env, bool
> update_tlb,
> uint32_t vaddr, int is_write, int mmu_idx,
> uint32_t *paddr, uint32_t *page_size, unsigned *access);
> void reset_mmu(CPUXtensaState *env);
> -void dump_mmu(CPUXtensaState *env);
> +void xtensa_monitor_dump_mmu(Monitor *mon, CPUXtensaState *env);
>
> static inline MemoryRegion *xtensa_get_er_region(CPUXtensaState *env)
> {
> diff --git a/target/xtensa/mmu_helper.c b/target/xtensa/mmu_helper.c
> index 71330fc84b9..766fe60e2eb 100644
> --- a/target/xtensa/mmu_helper.c
> +++ b/target/xtensa/mmu_helper.c
> @@ -27,7 +27,6 @@
>
> #include "qemu/osdep.h"
> #include "qemu/log.h"
> -#include "qemu/qemu-print.h"
> #include "qemu/units.h"
> #include "cpu.h"
> #include "exec/helper-proto.h"
> @@ -38,6 +37,7 @@
> #include "exec/page-protection.h"
> #include "exec/target_page.h"
> #include "system/memory.h"
> +#include "monitor/monitor.h"
>
> #define XTENSA_MPU_SEGMENT_MASK 0x0000001f
> #define XTENSA_MPU_ACC_RIGHTS_MASK 0x00000f00
> @@ -1082,7 +1082,7 @@ int xtensa_get_physical_addr(CPUXtensaState *env, bool
> update_tlb,
> }
> }
>
> -static void dump_tlb(CPUXtensaState *env, bool dtlb)
> +static void dump_tlb(Monitor *mon, CPUXtensaState *env, bool dtlb)
> {
> unsigned wi, ei;
> const xtensa_tlb *conf =
> @@ -1091,6 +1091,7 @@ static void dump_tlb(CPUXtensaState *env, bool dtlb)
> xtensa_option_enabled(env->config, XTENSA_OPTION_MMU) ?
> mmu_attr_to_access : region_attr_to_access;
>
> + monitor_printf(mon, "\n%cTLB:\n", dtlb ? 'D' : 'I');
Shouldn't the change to this function be purely
s/qemu_printf/monitor_printf(mon, / ?
> for (wi = 0; wi < conf->nways; ++wi) {
> uint32_t sz = ~xtensa_tlb_get_addr_mask(env, dtlb, wi) + 1;
> const char *sz_text;
thanks
-- PMM