From nobody Thu May 2 21:05:24 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 1553767711250627.8331846793542; Thu, 28 Mar 2019 03:08:31 -0700 (PDT) Received: from localhost ([127.0.0.1]:33792 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9RxT-0003lM-4B for importer@patchew.org; Thu, 28 Mar 2019 06:08:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9Rsj-0008Sd-KC for qemu-devel@nongnu.org; Thu, 28 Mar 2019 06:03:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h9Rn2-0001Mj-TJ for qemu-devel@nongnu.org; Thu, 28 Mar 2019 05:57:41 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:33058) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h9Rn2-0001LU-5l for qemu-devel@nongnu.org; Thu, 28 Mar 2019 05:57:40 -0400 Received: by mail-wr1-x444.google.com with SMTP id q1so22069755wrp.0 for ; Thu, 28 Mar 2019 02:57:39 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id q3sm13867319wrr.75.2019.03.28.02.57.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Mar 2019 02:57:37 -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=YeHKWyPP8B+92GniO4g/+lw4RSrgbg3qVWcU8n/OVeQ=; b=XTmTuqa8b7yFsWGyBqo5lzqGnV4mo8F6VxXcoTyrSM30BxckhoFwUjwiq4DFDTCIe9 OnlIG/jm9IYyqqDjOSPaV3ZJaCxl1d2e9njLD4R1ehnpGNir+STyg6m3wi1AJwj/d84R BfH+WnzWiciCGzjVZpDgEniOoHPdCS1oamjSKNbGUAx9yLUpMqUKOfcy/cpr61GCv9Uf Hnj0EDTzCualq1xxiT0v0UBFF64QqXES79bZHDOVZB2EmdqVNCNi68ydRF1iSs9PxGjK kyhaZf6pS4nFCVVxVQ4L4NT3BEMBrhI3PznDuGs8fvxZV2LOnZv12nQBYcSZuVFPDGcZ phjA== 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=YeHKWyPP8B+92GniO4g/+lw4RSrgbg3qVWcU8n/OVeQ=; b=nlwtSKMATF5S/aeiLsLi+waZxrN/pGNHNWG8PnzJb+KXMjQDaKmkS/TMsU4ArPijtE pP4hHGAMWrBTlHJcH9iL8cnYBYdjZUWWjRdyzdA8bSmG72yRH0V2hKz2p2+WlQ9MaDDu eJ0Bjb4YfLdi1uDPripFzgdmZHNN8yVtVvW+PDP7TjUo6I/Fpa6gqUCfaA6tLLTKcux+ FYW4SMUmWu7Ex856z+jQHTU8Is5tm1fHYr2Hiw3ondZSl2gyeg65Ce/wh8n4LvI/5H4h UUXLgYs0hH3BrAogJEXyCtj3m3LExFFjs9Ll5jN70GOyli1L9pMEPynJemQ95VlXLZqL KaSw== X-Gm-Message-State: APjAAAXweqsiBxKqf42ENth5K3h1gv4Jok3EmZBF9YlHI6p7Li7FRVuj c7qYkYDdrad21xEzL2Acyu0ViA== X-Google-Smtp-Source: APXvYqwEXi70YH4mPYyVf8kF8RN2rpqle8JAxCiR0vF5NCga2YxG7vEBCeUzEOr3AsDmTc4dyCzaNQ== X-Received: by 2002:adf:ec0a:: with SMTP id x10mr10052738wrn.193.1553767058691; Thu, 28 Mar 2019 02:57:38 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Thu, 28 Mar 2019 09:57:36 +0000 Message-Id: <20190328095736.4480-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::444 Subject: [Qemu-devel] [PATCH for-4.0] 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@microsoft.com, 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 --- hw/arm/raspi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 66899c28dc1..c7a18a319bc 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 >=3D 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