qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] PPC: Add dump_mmu() for 6xx
@ 2013-06-18 14:53 Fabien Chouteau
  2013-06-18 14:53 ` [Qemu-devel] [PATCH 2/2] PPC: Fix GDB read on code area for PPC6xx Fabien Chouteau
  2013-06-18 15:31 ` [Qemu-devel] [PATCH 1/2] PPC: Add dump_mmu() for 6xx Alexander Graf
  0 siblings, 2 replies; 10+ messages in thread
From: Fabien Chouteau @ 2013-06-18 14:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, agraf

"(qemu) info tlb" is a very useful tool for debugging, so I implemented
the missing 6xx version.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
---
 target-ppc/mmu_helper.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c
index 68d5415..910e022 100644
--- a/target-ppc/mmu_helper.c
+++ b/target-ppc/mmu_helper.c
@@ -1176,6 +1176,41 @@ static void mmubooke206_dump_mmu(FILE *f, fprintf_function cpu_fprintf,
     }
 }
 
+static void mmu6xx_dump_mmu(FILE *f, fprintf_function cpu_fprintf,
+                            CPUPPCState *env)
+{
+    ppc6xx_tlb_t *tlb;
+
+    int type, way, entry;
+
+    if (kvm_enabled() && !env->kvm_sw_tlb) {
+        cpu_fprintf(f, "Cannot access KVM TLB\n");
+        return;
+    }
+
+    if (env->id_tlbs != 1) {
+        cpu_fprintf(f, "ERROR: 6xx MMU should have separated TLB"
+                    " for code and data\n");
+    }
+
+    cpu_fprintf(f, "                           [EPN    EPN + SIZE]\n");
+
+    for (type = 0; type < 2; type++)
+        for (way = 0; way < env->nb_ways; way++)
+            for (entry = env->nb_tlb * type + env->tlb_per_way * way;
+                 entry < (env->nb_tlb * type + env->tlb_per_way * (way + 1));
+                 entry++) {
+
+                tlb = &env->tlb.tlb6[entry];
+                cpu_fprintf(f, "TLB %02d/%02d %s way:%d %s ["
+                            TARGET_FMT_lx " " TARGET_FMT_lx "]\n",
+                            entry % env->nb_tlb, env->nb_tlb,
+                            type ? "code" : "data", way,
+                            pte_is_valid(tlb->pte0) ? "valid" : "inval",
+                            tlb->EPN, tlb->EPN + TARGET_PAGE_SIZE);
+            }
+}
+
 void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUPPCState *env)
 {
     switch (env->mmu_model) {
@@ -1185,6 +1220,10 @@ void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUPPCState *env)
     case POWERPC_MMU_BOOKE206:
         mmubooke206_dump_mmu(f, cpu_fprintf, env);
         break;
+    case POWERPC_MMU_SOFT_6xx:
+    case POWERPC_MMU_SOFT_74xx:
+        mmu6xx_dump_mmu(f, cpu_fprintf, env);
+        break;
 #if defined(TARGET_PPC64)
     case POWERPC_MMU_64B:
     case POWERPC_MMU_2_06:
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-06-24  8:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-18 14:53 [Qemu-devel] [PATCH 1/2] PPC: Add dump_mmu() for 6xx Fabien Chouteau
2013-06-18 14:53 ` [Qemu-devel] [PATCH 2/2] PPC: Fix GDB read on code area for PPC6xx Fabien Chouteau
2013-06-18 15:34   ` Alexander Graf
2013-06-21 18:10     ` Jan Kiszka
2013-06-22  0:26       ` Alexander Graf
2013-06-24  8:40         ` Fabien Chouteau
2013-06-18 15:31 ` [Qemu-devel] [PATCH 1/2] PPC: Add dump_mmu() for 6xx Alexander Graf
2013-06-18 16:04   ` Fabien Chouteau
2013-06-20 11:16     ` Alexander Graf
2013-06-20 13:06       ` Fabien Chouteau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).