From patchwork Tue Jan 31 02:58:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138679 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 1AF581007D1 for ; Tue, 31 Jan 2012 13:58:41 +1100 (EST) Received: from localhost ([::1]:36583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rs3va-0006VT-Ig for incoming@patchwork.ozlabs.org; Mon, 30 Jan 2012 21:58:38 -0500 Received: from eggs.gnu.org ([140.186.70.92]:40429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rs3vS-0006Ur-Cw for qemu-devel@nongnu.org; Mon, 30 Jan 2012 21:58:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rs3vP-0001oD-S7 for qemu-devel@nongnu.org; Mon, 30 Jan 2012 21:58:30 -0500 Received: from cantor2.suse.de ([195.135.220.15]:41526 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rs3vP-0001nl-NT; Mon, 30 Jan 2012 21:58:27 -0500 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 7532E8FB75; Tue, 31 Jan 2012 03:58:26 +0100 (CET) From: Alexander Graf To: qemu-ppc@nongnu.org Date: Tue, 31 Jan 2012 03:58:26 +0100 Message-Id: <1327978706-1137-1-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.7.3.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: Shrijeet Mukherjee , qemu-devel Developers Subject: [Qemu-devel] [PATCH] PPC: E500: Populate L1CFG0 SPR 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 When running Linux on e500 with powersave-nap enabled, Linux tries to read out the L1CFG0 register and calculates some things from it. Passing 0 there ends up in a division by 0, resulting in -1, resulting in badness. So let's populate the L1CFG0 register with reasonable defaults. That way guests aren't completely confused. Reported-by: Shrijeet Mukherjee Signed-off-by: Alexander Graf --- target-ppc/translate_init.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index 7848cd7..6253076 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -4434,6 +4434,8 @@ static void init_proc_e500 (CPUPPCState *env, int version) { uint32_t tlbncfg[2]; uint64_t ivor_mask = 0x0000000F0000FFFFULL; + uint32_t l1cfg0 = 0x3800 /* 8 ways */ + | 0x0020; /* 32 kb */ #if !defined(CONFIG_USER_ONLY) int i; #endif @@ -4485,6 +4487,7 @@ static void init_proc_e500 (CPUPPCState *env, int version) tlbncfg[1] = gen_tlbncfg(64, 1, 12, TLBnCFG_AVAIL | TLBnCFG_IPROT, 64); env->dcache_line_size = 64; env->icache_line_size = 64; + l1cfg0 |= 0x1000000; /* 64 byte cache block size */ break; default: cpu_abort(env, "Unknown CPU: " TARGET_FMT_lx "\n", env->spr[SPR_PVR]); @@ -4535,7 +4538,7 @@ static void init_proc_e500 (CPUPPCState *env, int version) spr_register(env, SPR_Exxx_L1CFG0, "L1CFG0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, - 0x00000000); + l1cfg0); /* XXX : not implemented */ spr_register(env, SPR_Exxx_L1CSR0, "L1CSR0", SPR_NOACCESS, SPR_NOACCESS,