Skip to contentSkip to conversation

monitor: Have 'info tlb' dump MMU information on monitor

PATCH In review Philippe Mathieu-Daudé 2 participants 12 messages Mar 20 – Mar 21

lore
Share & tools
lore
#0 lore raw

v2 cover monitor: Have 'info tlb' dump MMU information on monitor

Currently 'info tlb' dumps the MMU information on stdout, fix by using the monitor console instead. Rename the dump_mmu() functions to avoid name clash on single binary.

Since v1:
- Split Xtensa patch (pm215)
- Update m68k / ppc targets

Philippe Mathieu-Daudé (7):
target/m68k: Have 'info tlb' dump MMU information on monitor target/ppc: Have 'info tlb' dump MMU information on monitor target/xtensa: Have 'info tlb' dump MMU information on monitor target/xtensa: Display [ID]TLB header within dump_tlb() target/m68k: Rename dump_mmu() -> m68k_monitor_dump_mmu() target/ppc: Rename dump_mmu() -> ppc_monitor_dump_mmu() target/xtensa: Rename dump_mmu() -> xtensa_monitor_dump_mmu()

 target/m68k/cpu.h          |   2 +-
 target/ppc/cpu.h           |   2 +-
 target/ppc/mmu-hash64.h    |   2 +-
 target/xtensa/cpu.h        |   2 +-
 target/m68k/helper.c       | 116 +++++++++++++++++++------------------
 target/m68k/monitor.c      |   2 +-
 target/ppc/mmu-hash64.c    |  10 ++--
 target/ppc/mmu_common.c    |  66 ++++++++++-----------
 target/ppc/monitor.c       |   2 +-
 target/xtensa/mmu_helper.c |  44 +++++++-------
 target/xtensa/monitor.c    |   2 +-
 11 files changed, 125 insertions(+), 125 deletions(-)
Signature · 1 line
2.53.0
#1 lore raw

PATCH v2 1/7 target/m68k: Have 'info tlb' dump MMU information on monitor

Currently 'info tlb' dumps the MMU information on stdout. Propagate the @Monitor argument and replace qemu_printf() by monitor_printf() -- or monitor_puts when no formatting -- to dump information over the monitor (which is not always stdout).

Fixes 2097dca6d3a ("target/m68k: add HMP command "info tlb"")
---
 target/m68k/cpu.h     |   2 +-
 target/m68k/helper.c  | 116 +++++++++++++++++++++---------------------
 target/m68k/monitor.c |   2 +-
 3 files changed, 61 insertions(+), 59 deletions(-)
target/m68k/cpu.h +1 -1
index d7f508a9e80..84ffebe3890 100644
@@ -606,6 +606,6 @@ void m68k_cpu_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr,
 #define TB_FLAGS_TRACE          16
 #define TB_FLAGS_TRACE_BIT      (1 << TB_FLAGS_TRACE)
 
-void dump_mmu(CPUM68KState *env);
+void dump_mmu(Monitor *mon, CPUM68KState *env);
 
 #endif
target/m68k/helper.c +59 -57

226 lines not on this page · raw message

target/m68k/monitor.c +1 -1
index be7411edca6..38f925e5b16 100644
@@ -19,7 +19,7 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
         return;
     }
 
-    dump_mmu(env1);
+    dump_mmu(mon, env1);
 }
 
 static const MonitorDef monitor_defs[] = {
Signature · 1 line
2.53.0
#2 lore raw

PATCH v2 2/7 target/ppc: Have 'info tlb' dump MMU information on monitor

In reply to Philippe Mathieu-Daudé

Currently 'info tlb' dumps the MMU information on stdout. Propagate the @Monitor argument and replace qemu_printf() by monitor_printf() -- or monitor_puts when no formatting -- to dump information over the monitor (which is not always stdout).

Fixes bebabbc7aa7 ("ppc: booke206: add "info tlb" support")
---
 target/ppc/cpu.h        |  2 +-
 target/ppc/mmu-hash64.h |  2 +-
 target/ppc/mmu-hash64.c | 10 +++----
 target/ppc/mmu_common.c | 66 ++++++++++++++++++++---------------------
 target/ppc/monitor.c    |  2 +-
 5 files changed, 41 insertions(+), 41 deletions(-)
target/ppc/cpu.h +1 -1
index 296e7604077..ba17ea83fa2 100644
@@ -3082,7 +3082,7 @@ static inline bool ppc_interrupts_little_endian(PowerPCCPU *cpu, bool hv)
 }
 #endif
 
-void dump_mmu(CPUPPCState *env);
+void dump_mmu(Monitor *mon, CPUPPCState *env);
 
 void ppc_maybe_bswap_register(CPUPPCState *env, uint8_t *mem_buf, int len);
 void ppc_store_vscr(CPUPPCState *env, uint32_t vscr);
target/ppc/mmu-hash64.h +1 -1
index ae8d4b37aed..9ce6939191a 100644
@@ -4,7 +4,7 @@
 #ifndef CONFIG_USER_ONLY
 
 #ifdef TARGET_PPC64
-void dump_slb(PowerPCCPU *cpu);
+void dump_slb(Monitor *mon, PowerPCCPU *cpu);
 int ppc_store_slb(PowerPCCPU *cpu, target_ulong slot,
                   target_ulong esid, target_ulong vsid);
 bool ppc_hash64_xlate(PowerPCCPU *cpu, vaddr eaddr, MMUAccessType access_type,
target/ppc/mmu-hash64.c +5 -5
index 2c33d98001d..356aee0c92c 100644
@@ -23,7 +23,6 @@
 #include "exec/page-protection.h"
 #include "exec/target_page.h"
 #include "qemu/error-report.h"
-#include "qemu/qemu-print.h"
 #include "system/hw_accel.h"
 #include "system/memory.h"
 #include "kvm_ppc.h"
@@ -34,6 +33,7 @@
 #include "mmu-book3s-v3.h"
 #include "mmu-books.h"
 #include "helper_regs.h"
+#include "monitor/monitor.h"
 
 #ifdef CONFIG_TCG
 #include "exec/helper-proto.h"
@@ -83,7 +83,7 @@ static ppc_slb_t *slb_lookup(PowerPCCPU *cpu, target_ulong eaddr)
     return NULL;
 }
 
-void dump_slb(PowerPCCPU *cpu)
+void dump_slb(Monitor *mon, PowerPCCPU *cpu)
 {
     CPUPPCState *env = &cpu->env;
     int i;
@@ -91,15 +91,15 @@ void dump_slb(PowerPCCPU *cpu)
 
     cpu_synchronize_state(CPU(cpu));
 
-    qemu_printf("SLB\tESID\t\t\tVSID\n");
+    monitor_puts(mon, "SLB\tESID\t\t\tVSID\n");
     for (i = 0; i < cpu->hash64_opts->slb_size; i++) {
         slbe = env->slb[i].esid;
         slbv = env->slb[i].vsid;
         if (slbe == 0 && slbv == 0) {
             continue;
         }
-        qemu_printf("%d\t0x%016" PRIx64 "\t0x%016" PRIx64 "\n",
-                    i, slbe, slbv);
+        monitor_printf(mon, "%d\t0x%016" PRIx64 "\t0x%016" PRIx64 "\n",
+                       i, slbe, slbv);
     }
 }
 
target/ppc/mmu_common.c +33 -33

201 lines not on this page · raw message

target/ppc/monitor.c +1 -1
index 7c88e0e2bda..41337d77a89 100644
@@ -19,5 +19,5 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, "No CPU available\n");
         return;
     }
-    dump_mmu(env1);
+    dump_mmu(mon, env1);
 }
Signature · 1 line
2.53.0
#3 lore raw

PATCH v2 3/7 target/xtensa: Have 'info tlb' dump MMU information on monitor

In reply to Philippe Mathieu-Daudé

Currently 'info tlb' dumps the MMU information on stdout. Propagate the @Monitor argument and replace qemu_printf() by monitor_printf() -- or monitor_puts when no formatting -- to dump information over the monitor (which is not always stdout).

Fixes d41160a3e64 ("Sparc: implement monitor command 'info tlb'")
---
 target/xtensa/cpu.h        |  2 +-
 target/xtensa/mmu_helper.c | 44 +++++++++++++++++++-------------------
 target/xtensa/monitor.c    |  2 +-
 3 files changed, 24 insertions(+), 24 deletions(-)
target/xtensa/cpu.h +1 -1
index dfd2ceab7cf..caec22bb742 100644
@@ -693,7 +693,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 dump_mmu(Monitor *mon, CPUXtensaState *env);
 
 static inline MemoryRegion *xtensa_get_er_region(CPUXtensaState *env)
 {
target/xtensa/mmu_helper.c +22 -22

120 lines not on this page · raw message

target/xtensa/monitor.c +1 -1
index 2af84934f83..2761735f112 100644
@@ -34,5 +34,5 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, "No CPU available\n");
         return;
     }
-    dump_mmu(env1);
+    dump_mmu(mon, env1);
 }
Signature · 1 line
2.53.0
#4 lore raw

Re: [PATCH-for-11.1 v2 3/7] target/xtensa: Have 'info tlb' dump MMU information on monitor

Quoted 7 lines · Philippe Mathieu-Daudé

Currently 'info tlb' dumps the MMU information on stdout. Propagate the @Monitor argument and replace qemu_printf() by monitor_printf() -- or monitor_puts when no formatting -- to dump information over the monitor (which is not always stdout).

Fixes d41160a3e64 ("Sparc: implement monitor command 'info tlb'")

This commit reference doesn't look right, as none of the changed code was introduced in that commit.

Quoted 50 lines
---
 target/xtensa/cpu.h        |  2 +-
 target/xtensa/mmu_helper.c | 44 +++++++++++++++++++-------------------
 target/xtensa/monitor.c    |  2 +-
 3 files changed, 24 insertions(+), 24 deletions(-)
target/xtensa/cpu.h +1 -1
index dfd2ceab7cf..caec22bb742 100644
@@ -693,7 +693,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 dump_mmu(Monitor *mon, CPUXtensaState *env);
 
 static inline MemoryRegion *xtensa_get_er_region(CPUXtensaState *env)
 {
target/xtensa/mmu_helper.c +2 -2
index 71330fc84b9..9dbf671228b 100644
@@ -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 =

target/xtensa/mmu_helper.c static void dump_tlb(CPUXtensaState *env, bool dtlb) · line 1126

Quoted 8 lines
target/xtensa/mmu_helper.c +2 -2
@@ -1121,11 +1121,11 @@ static void dump_tlb(CPUXtensaState *env, bool dtlb)
 
                 if (print_header) {
                     print_header = false;
-                    qemu_printf("Way %u (%d %s)\n", wi, sz, sz_text);
-                    qemu_printf("\tVaddr       Paddr       ASID  Attr RWX Cache\n"
+                    monitor_printf(mon, "Way %u (%d %s)\n", wi, sz, sz_text);
+                    monitor_puts(mon, "\tVaddr       Paddr       ASID  Attr RWX Cache\n"
                                 "\t----------  ----------  ----  ---- --- -------\n");

These lines are aligned in the code same way as they are aligned in the output. It'd be nice if this alignment could be preserved.

Quoted 9 lines
target/xtensa/mmu_helper.c +1 -1
                 }
-                qemu_printf("\t0x%08x  0x%08x  0x%02x  0x%02x %c%c%c %s\n",
+                monitor_printf(mon, "\t0x%08x  0x%08x  0x%02x  0x%02x %c%c%c %s\n",
                             entry->vaddr,
                             entry->paddr,
                             entry->asid,
@@ -1140,12 +1140,12 @@ static void dump_tlb(CPUXtensaState *env, bool dtlb)
     }
 }

target/xtensa/mmu_helper.c static void dump_tlb(CPUXtensaState *env, bool dtlb) · line 1149

Quoted 10 lines
target/xtensa/mmu_helper.c +2 -2
 
-static void dump_mpu(CPUXtensaState *env,
+static void dump_mpu(Monitor *mon, CPUXtensaState *env,
                      const xtensa_mpu_entry *entry, unsigned n)
 {
     unsigned i;
 
-    qemu_printf("\t%s  Vaddr       Attr        Ring0  Ring1  System Type    CPU cache\n"
+    monitor_printf(mon, "\t%s  Vaddr       Attr        Ring0  Ring1  System Type    CPU cache\n"
                 "\t%s  ----------  ----------  -----  -----  -------------  ---------\n",

Same here.

Quoted 89 lines
target/xtensa/mmu_helper.c +15 -15
                 env ? "En" : "  ",
                 env ? "--" : "  ");
@@ -1157,7 +1157,7 @@ static void dump_mpu(CPUXtensaState *env,
         unsigned type = mpu_attr_to_type(attr);
         char cpu_cache = (type & XTENSA_MPU_TYPE_CPU_CACHE) ? '-' : ' ';
 
-        qemu_printf("\t %c  0x%08x  0x%08x   %c%c%c    %c%c%c   ",
+        monitor_printf(mon, "\t %c  0x%08x  0x%08x   %c%c%c    %c%c%c   ",
                     env ?
                     ((env->sregs[MPUENB] & (1u << i)) ? '+' : '-') : ' ',
                     entry[i].vaddr, attr,
@@ -1170,19 +1170,19 @@ static void dump_mpu(CPUXtensaState *env,
 
         switch (type & XTENSA_MPU_SYSTEM_TYPE_MASK) {
         case XTENSA_MPU_SYSTEM_TYPE_DEVICE:
-            qemu_printf("Device %cB %3s\n",
+            monitor_printf(mon, "Device %cB %3s\n",
                         (type & XTENSA_MPU_TYPE_B) ? ' ' : 'n',
                         (type & XTENSA_MPU_TYPE_INT) ? "int" : "");
             break;
         case XTENSA_MPU_SYSTEM_TYPE_NC:
-            qemu_printf("Sys NC %cB      %c%c%c\n",
+            monitor_printf(mon, "Sys NC %cB      %c%c%c\n",
                         (type & XTENSA_MPU_TYPE_B) ? ' ' : 'n',
                         (type & XTENSA_MPU_TYPE_CPU_R) ? 'r' : cpu_cache,
                         (type & XTENSA_MPU_TYPE_CPU_W) ? 'w' : cpu_cache,
                         (type & XTENSA_MPU_TYPE_CPU_C) ? 'c' : cpu_cache);
             break;
         case XTENSA_MPU_SYSTEM_TYPE_C:
-            qemu_printf("Sys  C %c%c%c     %c%c%c\n",
+            monitor_printf(mon, "Sys  C %c%c%c     %c%c%c\n",
                         (type & XTENSA_MPU_TYPE_SYS_R) ? 'R' : '-',
                         (type & XTENSA_MPU_TYPE_SYS_W) ? 'W' : '-',
                         (type & XTENSA_MPU_TYPE_SYS_C) ? 'C' : '-',
@@ -1191,29 +1191,29 @@ static void dump_mpu(CPUXtensaState *env,
                         (type & XTENSA_MPU_TYPE_CPU_C) ? 'c' : cpu_cache);
             break;
         default:
-            qemu_printf("Unknown\n");
+            monitor_puts(mon, "Unknown\n");
             break;
         }
     }
 }
 
-void dump_mmu(CPUXtensaState *env)
+void dump_mmu(Monitor *mon, CPUXtensaState *env)
 {
     if (xtensa_option_bits_enabled(env->config,
                 XTENSA_OPTION_BIT(XTENSA_OPTION_REGION_PROTECTION) |
                 XTENSA_OPTION_BIT(XTENSA_OPTION_REGION_TRANSLATION) |
                 XTENSA_OPTION_BIT(XTENSA_OPTION_MMU))) {
 
-        qemu_printf("ITLB:\n");
-        dump_tlb(env, false);
-        qemu_printf("\nDTLB:\n");
-        dump_tlb(env, true);
+        monitor_puts(mon, "ITLB:\n");
+        dump_tlb(mon, env, false);
+        monitor_puts(mon, "\nDTLB:\n");
+        dump_tlb(mon, env, true);
     } else if (xtensa_option_enabled(env->config, XTENSA_OPTION_MPU)) {
-        qemu_printf("Foreground map:\n");
-        dump_mpu(env, env->mpu_fg, env->config->n_mpu_fg_segments);
-        qemu_printf("\nBackground map:\n");
-        dump_mpu(NULL, env->config->mpu_bg, env->config->n_mpu_bg_segments);
+        monitor_puts(mon, "Foreground map:\n");
+        dump_mpu(mon, env, env->mpu_fg, env->config->n_mpu_fg_segments);
+        monitor_puts(mon, "\nBackground map:\n");
+        dump_mpu(mon, NULL, env->config->mpu_bg, env->config->n_mpu_bg_segments);
     } else {
-        qemu_printf("No TLB for this CPU core\n");
+        monitor_puts(mon, "No TLB for this CPU core\n");
     }
 }
target/xtensa/monitor.c +1 -2
index 2af84934f83..2761735f112 100644
@@ -34,5 +34,5 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, "No CPU available\n");
         return;
     }
-    dump_mmu(env1);
+    dump_mmu(mon, env1);
 }
--

2.53.0

Signature · 2 lines
Thanks.
-- Max
#5 lore raw

PATCH v2 4/7 target/xtensa: Display [ID]TLB header within dump_tlb()

In reply to Philippe Mathieu-Daudé

Move common code from caller to callee.

---
 target/xtensa/mmu_helper.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
target/xtensa/mmu_helper.c +1 -3
index 9dbf671228b..48e1d64a3d7 100644
@@ -1091,6 +1091,7 @@ static void dump_tlb(Monitor *mon, 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');
     for (wi = 0; wi < conf->nways; ++wi) {
         uint32_t sz = ~xtensa_tlb_get_addr_mask(env, dtlb, wi) + 1;
         const char *sz_text;
@@ -1203,10 +1204,7 @@ void dump_mmu(Monitor *mon, CPUXtensaState *env)
                 XTENSA_OPTION_BIT(XTENSA_OPTION_REGION_PROTECTION) |
                 XTENSA_OPTION_BIT(XTENSA_OPTION_REGION_TRANSLATION) |
                 XTENSA_OPTION_BIT(XTENSA_OPTION_MMU))) {
-
-        monitor_puts(mon, "ITLB:\n");
         dump_tlb(mon, env, false);
-        monitor_puts(mon, "\nDTLB:\n");
         dump_tlb(mon, env, true);
     } else if (xtensa_option_enabled(env->config, XTENSA_OPTION_MPU)) {
         monitor_puts(mon, "Foreground map:\n");
Signature · 1 line
2.53.0
#7 lore raw

PATCH v2 5/7 target/m68k: Rename dump_mmu() -> m68k_monitor_dump_mmu()

In reply to Philippe Mathieu-Daudé

Rename dump_mmu() to avoid a name clash with other targets:

  $ git grep -w dump_mmu master | fgrep .h
  target/m68k/cpu.h:610:void dump_mmu(CPUM68KState *env);
  target/ppc/cpu.h:3083:void dump_mmu(CPUPPCState *env);
  target/sparc/cpu.h:603:void dump_mmu(CPUSPARCState *env);
  target/xtensa/cpu.h:697:void dump_mmu(CPUXtensaState *env);
---
 target/m68k/cpu.h     | 2 +-
 target/m68k/helper.c  | 2 +-
 target/m68k/monitor.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
target/m68k/cpu.h +1 -1
index 84ffebe3890..5c45597375c 100644
@@ -606,6 +606,6 @@ void m68k_cpu_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr,
 #define TB_FLAGS_TRACE          16
 #define TB_FLAGS_TRACE_BIT      (1 << TB_FLAGS_TRACE)
 
-void dump_mmu(Monitor *mon, CPUM68KState *env);
+void m68k_monitor_dump_mmu(Monitor *mon, CPUM68KState *env);
 
 #endif
target/m68k/helper.c +1 -1
index 2208b9a2ab9..7cdea555061 100644
@@ -611,7 +611,7 @@ static void dump_ttr(Monitor *mon, uint32_t ttr)
                                M68K_DESC_USERATTR_SHIFT);
 }
 
-void dump_mmu(Monitor *mon, CPUM68KState *env)
+void m68k_monitor_dump_mmu(Monitor *mon, CPUM68KState *env)
 {
     if ((env->mmu.tcr & M68K_TCR_ENABLED) == 0) {
         monitor_puts(mon, "Translation disabled\n");
target/m68k/monitor.c +1 -1
index 38f925e5b16..eea5ae16a90 100644
@@ -19,7 +19,7 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
         return;
     }
 
-    dump_mmu(mon, env1);
+    m68k_monitor_dump_mmu(mon, env1);
 }
 
 static const MonitorDef monitor_defs[] = {
Signature · 1 line
2.53.0
#8 lore raw

PATCH v2 6/7 target/ppc: Rename dump_mmu() -> ppc_monitor_dump_mmu()

In reply to Philippe Mathieu-Daudé

Rename dump_mmu() to avoid a name clash with other targets:

  $ git grep -w dump_mmu master | fgrep .h
  target/m68k/cpu.h:610:void dump_mmu(CPUM68KState *env);
  target/ppc/cpu.h:3083:void dump_mmu(CPUPPCState *env);
  target/sparc/cpu.h:603:void dump_mmu(CPUSPARCState *env);
  target/xtensa/cpu.h:697:void dump_mmu(CPUXtensaState *env);
---
 target/ppc/cpu.h        | 2 +-
 target/ppc/mmu_common.c | 2 +-
 target/ppc/monitor.c    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
target/ppc/cpu.h +1 -1
index ba17ea83fa2..7fcafd590d4 100644
@@ -3082,7 +3082,7 @@ static inline bool ppc_interrupts_little_endian(PowerPCCPU *cpu, bool hv)
 }
 #endif
 
-void dump_mmu(Monitor *mon, CPUPPCState *env);
+void ppc_monitor_dump_mmu(Monitor *mon, CPUPPCState *env);
 
 void ppc_maybe_bswap_register(CPUPPCState *env, uint8_t *mem_buf, int len);
 void ppc_store_vscr(CPUPPCState *env, uint32_t vscr);
target/ppc/mmu_common.c +1 -1
index 5ea9b6d6773..00923c0b96e 100644
@@ -547,7 +547,7 @@ static void mmu6xx_dump_mmu(Monitor *mon, CPUPPCState *env)
     }
 }
 
-void dump_mmu(Monitor *mon, CPUPPCState *env)
+void ppc_monitor_dump_mmu(Monitor *mon, CPUPPCState *env)
 {
     switch (env->mmu_model) {
     case POWERPC_MMU_BOOKE:
target/ppc/monitor.c +1 -1
index 41337d77a89..f95b1b44c2c 100644
@@ -19,5 +19,5 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, "No CPU available\n");
         return;
     }
-    dump_mmu(mon, env1);
+    ppc_monitor_dump_mmu(mon, env1);
 }
Signature · 1 line
2.53.0
#9 lore raw

PATCH v2 7/7 target/xtensa: Rename dump_mmu() -> xtensa_monitor_dump_mmu()

In reply to Philippe Mathieu-Daudé

Rename dump_mmu() to avoid a name clash with other targets:

  $ git grep -w dump_mmu master | fgrep .h
  target/m68k/cpu.h:610:void dump_mmu(CPUM68KState *env);
  target/ppc/cpu.h:3083:void dump_mmu(CPUPPCState *env);
  target/sparc/cpu.h:603:void dump_mmu(CPUSPARCState *env);
  target/xtensa/cpu.h:697:void dump_mmu(CPUXtensaState *env);
---
 target/xtensa/cpu.h        | 2 +-
 target/xtensa/mmu_helper.c | 2 +-
 target/xtensa/monitor.c    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
target/xtensa/cpu.h +1 -1
index caec22bb742..095b4ced45f 100644
@@ -693,7 +693,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(Monitor *mon, CPUXtensaState *env);
+void xtensa_monitor_dump_mmu(Monitor *mon, CPUXtensaState *env);
 
 static inline MemoryRegion *xtensa_get_er_region(CPUXtensaState *env)
 {
target/xtensa/mmu_helper.c +1 -1
index 48e1d64a3d7..766fe60e2eb 100644
@@ -1198,7 +1198,7 @@ static void dump_mpu(Monitor *mon, CPUXtensaState *env,
     }
 }
 
-void dump_mmu(Monitor *mon, CPUXtensaState *env)
+void xtensa_monitor_dump_mmu(Monitor *mon, CPUXtensaState *env)
 {
     if (xtensa_option_bits_enabled(env->config,
                 XTENSA_OPTION_BIT(XTENSA_OPTION_REGION_PROTECTION) |
target/xtensa/monitor.c +1 -1
index 2761735f112..80ebba5acbd 100644
@@ -34,5 +34,5 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, "No CPU available\n");
         return;
     }
-    dump_mmu(mon, env1);
+    xtensa_monitor_dump_mmu(mon, env1);
 }
Signature · 1 line
2.53.0
Reviewed-by on v2 7/7
#10 lore raw

Re: [PATCH-for-11.1 v2 7/7] target/xtensa: Rename dump_mmu() -> xtensa_monitor_dump_mmu()

Quoted 9 lines · Philippe Mathieu-Daudé

Rename dump_mmu() to avoid a name clash with other targets:

  $ git grep -w dump_mmu master | fgrep .h
  target/m68k/cpu.h:610:void dump_mmu(CPUM68KState *env);
  target/ppc/cpu.h:3083:void dump_mmu(CPUPPCState *env);
  target/sparc/cpu.h:603:void dump_mmu(CPUSPARCState *env);
  target/xtensa/cpu.h:697:void dump_mmu(CPUXtensaState *env);
Quoted 6 lines
---
 target/xtensa/cpu.h        | 2 +-
 target/xtensa/mmu_helper.c | 2 +-
 target/xtensa/monitor.c    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
Signature · 2 lines
Thanks.
-- Max
#11 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 2 lines · Philippe Mathieu-Daudé

Currently 'info tlb' dumps the MMU information on stdout, fix

That's not what I observe: I build QEMU from today's master and run

qemu-system-xtensa -M kc705 -s -S -nographic \
        -chardev socket,id=mon,host=0.0.0.0,port=7777,server=on,wait=off \
        -mon chardev=mon

and info tlb in that monitor works as expected:

$ nc 127.0.0.1 7777
QEMU 10.2.90 monitor - type 'help' for more information
(qemu) info tlb
info tlb
ITLB:
Way 5 (128 MB)
       Vaddr       Paddr       ASID  Attr RWX Cache
       ----------  ----------  ----  ---- --- -------
       0xd0000000  0x00000000  0x01  0x07 RWX WB
       0xd8000000  0x00000000  0x01  0x03 RWX Bypass
Way 6 (256 MB)
       Vaddr       Paddr       ASID  Attr RWX Cache
       ----------  ----------  ----  ---- --- -------
       0xe0000000  0xf0000000  0x01  0x07 RWX WB
       0xf0000000  0xf0000000  0x01  0x03 RWX Bypass

DTLB:
Way 5 (128 MB)

       Vaddr       Paddr       ASID  Attr RWX Cache
       ----------  ----------  ----  ---- --- -------
       0xd0000000  0x00000000  0x01  0x07 RWX WB
       0xd8000000  0x00000000  0x01  0x03 RWX Bypass
Way 6 (256 MB)
       Vaddr       Paddr       ASID  Attr RWX Cache
       ----------  ----------  ----  ---- --- -------
       0xe0000000  0xf0000000  0x01  0x07 RWX WB
       0xf0000000  0xf0000000  0x01  0x03 RWX Bypass
Quoted 2 lines

by using the monitor console instead. Rename the dump_mmu() functions to avoid name clash on single binary.

Signature · 2 lines
Thanks.
-- Max