From patchwork Mon Oct 31 03:16:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 122713 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 415C3B6F75 for ; Mon, 31 Oct 2011 14:17:22 +1100 (EST) Received: from localhost ([::1]:34806 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKiN8-0005fh-Oc for incoming@patchwork.ozlabs.org; Sun, 30 Oct 2011 23:17:14 -0400 Received: from eggs.gnu.org ([140.186.70.92]:36450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKiMt-0005Mx-T8 for qemu-devel@nongnu.org; Sun, 30 Oct 2011 23:17:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RKiMr-0006bK-FD for qemu-devel@nongnu.org; Sun, 30 Oct 2011 23:16:59 -0400 Received: from ozlabs.org ([203.10.76.45]:48371) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKiMq-0006aq-PL; Sun, 30 Oct 2011 23:16:57 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 73E02B6F7D; Mon, 31 Oct 2011 14:16:54 +1100 (EST) From: David Gibson To: agraf@suse.de Date: Mon, 31 Oct 2011 14:16:47 +1100 Message-Id: <1320031007-25884-4-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1320031007-25884-1-git-send-email-david@gibson.dropbear.id.au> References: <1320031007-25884-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 203.10.76.45 Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 3/3] monitor: add ability to dump SLB entries X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Nishanth Aravamudan When run with a PPC Book3S (server) CPU Currently 'info tlb' in the qemu monitor reports "dump_mmu: unimplemented". However, during bringup work, it can be quite handy to have the SLB entries, which are available in the CPUPPCState. This patch adds an implementation of info tlb for book3s, which dumps the SLB. Signed-off-by: Nishanth Aravamudan Signed-off-by: David Gibson --- target-ppc/helper.c | 32 +++++++++++++++++++++++++++----- 1 files changed, 27 insertions(+), 5 deletions(-) diff --git a/target-ppc/helper.c b/target-ppc/helper.c index 137a494..29c7050 100644 --- a/target-ppc/helper.c +++ b/target-ppc/helper.c @@ -1545,14 +1545,36 @@ static void mmubooke206_dump_mmu(FILE *f, fprintf_function cpu_fprintf, } } +static void mmubooks_dump_mmu(FILE *f, fprintf_function cpu_fprintf, + CPUState *env) +{ + int i; + uint64_t slbe, slbv; + + cpu_synchronize_state(env); + + cpu_fprintf(f, "SLB\tESID\t\t\tVSID\n"); + for (i = 0; i < env->slb_nr; i++) { + slbe = env->slb[i].esid; + slbv = env->slb[i].vsid; + if (slbe == 0 && slbv == 0) { + continue; + } + cpu_fprintf(f, "%d\t0x%016" PRIx64 "\t0x%016" PRIx64 "\n", + i, slbe, slbv); + } +} + void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUState *env) { - switch (env->mmu_model) { - case POWERPC_MMU_BOOKE206: + if (env->mmu_model == POWERPC_MMU_BOOKE206) { mmubooke206_dump_mmu(f, cpu_fprintf, env); - break; - default: - cpu_fprintf(f, "%s: unimplemented\n", __func__); + } else { + if ((env->mmu_model & POWERPC_MMU_64B) != 0) { + mmubooks_dump_mmu(f, cpu_fprintf, env); + } else { + cpu_fprintf(f, "%s: unimplemented\n", __func__); + } } }