From nobody Sat Apr 27 06:51:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553787538545823.3937697202804; Thu, 28 Mar 2019 08:38:58 -0700 (PDT) Received: from localhost ([127.0.0.1]:38087 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9X71-0000J5-Mx for importer@patchew.org; Thu, 28 Mar 2019 11:38:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9X5B-0007q5-Ks for qemu-devel@nongnu.org; Thu, 28 Mar 2019 11:36:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h9WyR-0005GI-Rv for qemu-devel@nongnu.org; Thu, 28 Mar 2019 11:29:49 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:46562) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h9WyR-0005Ft-BM for qemu-devel@nongnu.org; Thu, 28 Mar 2019 11:29:47 -0400 Received: by mail-wr1-x441.google.com with SMTP id t17so2693289wrw.13 for ; Thu, 28 Mar 2019 08:29:47 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id v1sm24076718wrd.47.2019.03.28.08.29.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Mar 2019 08:29:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nLfsATJ9/2ff5gfAGx6urQ8EsaoFWl5q3jYMqRIO+yU=; b=t6ir2ucLu9ThlgiSq9PjQ5VZz17UfvkvkPF63MK0UhtIzEIF3nl3TnOuBkHPjt4iov unvl8gL4iprKkcxaOsCfZm4N0hDzNQnokZbS34SDSyN3UzgUowDA/QvFeka6Um4LeMA4 mGv1ZtlwhPOAPP6sro2XvvfcrwVRUXoYXAhRsfrv+A7datt1IVFDE1228DTfhb5pE9IB vv0HuwZN5BisOwjb/RwdIh115rotJZ5JbxHd7E1k+jBRKjMYJblVCTq3dvg36ryxsQNM ebmyCwi1rAGfSxw1uJ25T41tnX4jzYfqynj9GlsPGD7bpgNe6RvdTkvi0zA4Rc6ZxX4K Z0ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nLfsATJ9/2ff5gfAGx6urQ8EsaoFWl5q3jYMqRIO+yU=; b=eYKyQknCzLqXr5u0mKOlBWMw7I5p33C7Ela0iAGgV5LrzV++6a86U30MM4ofbgMaUa OjGmMOqoPdOET3MNacP4P+FrR5dbtyhPELi6s0f5rlHM4+6QqCMFsD0sRQY5BzctWzf0 V8TSSQ+HerRkYd3KPuQn5FhGvccdNXygGdM9DW53YbtcoPiBz8TDR7dqXn15uoxrsz0F 3Yoo88ztLkn+Y0dZUChYlFLzUYF0MwTucb4mPdL9BfFwmA43Pf32iTryhMEcWRrxbzFq zEibJxbcRuwwW0UzIRBoclI/EWvpplH/hdmpNKgnZ4VlBpSSae3+EbXnCjCJ1Nz/SipP vw2A== X-Gm-Message-State: APjAAAV7BP7sTVTiRV97nIol61zxVL4Vl+MBPSuZ9z9C4yYO/57EHUug N62ZO3V0exKjmnCDDpwLmXAIGw== X-Google-Smtp-Source: APXvYqw4uup08STCzkRrFmcCuaC/1Lch18xvwng62XDaGhLApO2uJIp+D/3KHUpomiuEQulKTdfx+g== X-Received: by 2002:a5d:4f89:: with SMTP id d9mr27217022wru.195.1553786986511; Thu, 28 Mar 2019 08:29:46 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Thu, 28 Mar 2019 15:29:44 +0000 Message-Id: <20190328152944.3199-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 Subject: [Qemu-devel] [PATCH v2 for-4.1] hw/arm/raspi: Diagnose requests for too much RAM 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Baumann , patches@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The Raspberry Pi boards have a physical memory map which does not allow for more than 1GB of RAM. Currently if the user tries to ask for more then we fail in a confusing way: $ qemu-system-aarch64 --machine raspi3 -m 8G Unexpected error in visit_type_uintN() at qapi/qapi-visit-core.c:164: qemu-system-aarch64: Parameter 'vcram-base' expects uint32_t Aborted (core dumped) Catch this earlier and diagnose it with a more friendly message: $ qemu-system-aarch64 --machine raspi3 -m 8G qemu-system-aarch64: Requested ram size is too large for this machine: maxi= mum is 1GB Fixes: https://bugs.launchpad.net/qemu/+bug/1794187 Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Wainer dos Santos Moschetta --- Changes v1->v2: use '>', not '>=3D'... hw/arm/raspi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 66899c28dc1..fe2bb511b98 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -12,6 +12,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/units.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" @@ -175,6 +176,12 @@ static void raspi_init(MachineState *machine, int vers= ion) BusState *bus; DeviceState *carddev; =20 + if (machine->ram_size > 1 * GiB) { + error_report("Requested ram size is too large for this machine: " + "maximum is 1GB"); + exit(1); + } + object_initialize(&s->soc, sizeof(s->soc), version =3D=3D 3 ? TYPE_BCM2837 : TYPE_BCM2836); object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc), --=20 2.20.1