From nobody Sat Jul 12 15:03:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486018364419637.8231872263439; Wed, 1 Feb 2017 22:52:44 -0800 (PST) Received: from localhost ([::1]:54768 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBG6-0002y1-Ec for importer@patchew.org; Thu, 02 Feb 2017 01:52:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kD-0007si-5J for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k6-0004DR-IH for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:40 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:59211) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k5-00048h-PU; Thu, 02 Feb 2017 00:15:34 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqY0lVxz9sDG; Thu, 2 Feb 2017 16:15:03 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012505; bh=8Hts3UFwFv2aI0+G/7v2kc1R9A4vcGWtPF8HWX2Dbtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DeL27HNgZ9iV81iFCOVRhYUe1z373VwKh5L0X5Ia6ht0YADaqUY6rh0iddTmo/l/s 2LOzlcgg+NLJqzjL7xO2vpVYyuoFX+4QL/iHZ08uU1a7jZ76pzxLjULd3zzrffxzqx zbGBm97KeNSZQpt6XF0Ch5RI2Un39ojuf/GD0u4A= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:37 +1100 Message-Id: <20170202051445.5735-100-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 099/107] target-ppc: Add MMU model check for booke machines X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Valentin Plotkin , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Valentin Plotkin Machines bamboo, e500 and virtex-ml507 assume a certain MMU model, otherwise resulting in unpredictable behavior. Add apropriate checks into *_init functions. Signed-off-by: Valentin Plotkin [regarding virtex parts] Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: David Gibson --- hw/ppc/e500.c | 6 ++++++ hw/ppc/ppc440_bamboo.c | 6 ++++++ hw/ppc/virtex_ml507.c | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index 792bd79..f7df238 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -827,6 +827,12 @@ void ppce500_init(MachineState *machine, PPCE500Params= *params) env =3D &cpu->env; cs =3D CPU(cpu); =20 + if (env->mmu_model !=3D POWERPC_MMU_BOOKE206) { + fprintf(stderr, "MMU model %i not supported by this machine.\n= ", + env->mmu_model); + exit(1); + } + if (!firstenv) { firstenv =3D env; } diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c index 5c535b1..9d997bf 100644 --- a/hw/ppc/ppc440_bamboo.c +++ b/hw/ppc/ppc440_bamboo.c @@ -193,6 +193,12 @@ static void bamboo_init(MachineState *machine) } env =3D &cpu->env; =20 + if (env->mmu_model !=3D POWERPC_MMU_BOOKE) { + fprintf(stderr, "MMU model %i not supported by this machine.\n", + env->mmu_model); + exit(1); + } + qemu_register_reset(main_cpu_reset, cpu); ppc_booke_timers_init(cpu, 400000000, 0); ppc_dcr_init(env, NULL, NULL); diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index b97d966..fdbcf22 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -221,6 +221,13 @@ static void virtex_init(MachineState *machine) =20 cpu =3D ppc440_init_xilinx(&ram_size, 1, machine->cpu_model, 400000000= ); env =3D &cpu->env; + + if (env->mmu_model !=3D POWERPC_MMU_BOOKE) { + fprintf(stderr, "MMU model %i not supported by this machine.\n", + env->mmu_model); + exit(1); + } + qemu_register_reset(main_cpu_reset, cpu); =20 memory_region_allocate_system_memory(phys_ram, NULL, "ram", ram_size); --=20 2.9.3