From patchwork Thu Mar 28 09:57:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 161295 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp494081jan; Thu, 28 Mar 2019 02:57:39 -0700 (PDT) X-Received: by 2002:a1c:a7c5:: with SMTP id q188mr16383000wme.126.1553767059009; Thu, 28 Mar 2019 02:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553767059; cv=none; d=google.com; s=arc-20160816; b=tZVRQR46zeBC+qdg0/r8jpUK4ytqP4ABCqIPklavu0IAvSFObhwYUNZPMZlLeMyrzS 66Y7pgalO+pWtR8oLbBrGo8rFKCf25RsEDAtU3eP+r0QAins/X9N9ldw7XB1fq0OJRox RmkKhCBhVt0E2z56nKhmkA/TaMkhZCBLPycUV2S84UYjgh2tYoUXsrUezaHKPf4io3NH kcut+JnIxeB+YDsGJsRcDDgnj/Z5dXf3s0Dr942dqnuWRwOZL/2XH6DYhdHAY5Axbl9M VpTnFiovNU2PDett1d9NYt7zq+eIUs17x7JmwYqLVbe1RIhBM6mmNgnyJHjX8jQr2BrY iD2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=YeHKWyPP8B+92GniO4g/+lw4RSrgbg3qVWcU8n/OVeQ=; b=z7tMQzOQqPTUN4FOlS0sHuIRcNyE/2i9K+fHfrkbZ1RTTk6SIaL668uLKqrpkHZw6E 72VTTvwNu8yKni8Uf84ewrkg1rY4094cRZ/cl49naZfztRD2sIGnMhrr3L0K/RqyZQPj F86Sy6aDb1z6+mCxbh30pjnqwPQt0hPbMrTZfDy/xmE0fIHqyeMmVkFKyYdAkSoZwOHJ 40T59HoYPvHV+MXJ7ETr1ESwftds5xDZdVxnNnUkvObo8XodmNAGEBBj8GsiT9dcWTB+ z2PWorkdgHwNf7paoM0YBYsxf8Wd+8IhiuWFzdrJofA4394y7dwZJN8gQEcr7Lo1CdRY esnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XTmTuqa8; spf=pass (google.com: domain of peter.maydell@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=peter.maydell@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id a2sor19259996wrm.50.2019.03.28.02.57.38 for (Google Transport Security); Thu, 28 Mar 2019 02:57:38 -0700 (PDT) Received-SPF: pass (google.com: domain of peter.maydell@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XTmTuqa8; spf=pass (google.com: domain of peter.maydell@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=peter.maydell@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=QiUh9fYz2RrtR9fixjZeePcHtMjTOesu5wFax4/g3pE/PJq9oN2SdST2lvS2q+QMLu UgSXRW7I0ajFZMpPK/lN+LueHyB8adXM/f2Skdi4SOF4ycs2aXhjKOUYLirKQ0dyTZRv cCLnxzr7gdBSfXueKkMSPWHM3pPlqPsKsitncv8TxGJdAgp4gNKXx0hr4rnZvVyqO14b q8sDzebYh5SupsNic4+VHRFBb+VITNFttsU0evHH+x6OjUn38pOptHqhD935oNQl5fmj xzZLmESpmJ0ni6VHv9xyP98mzcb8r9vav/ATkyJ24x40xyBeJgeEEaAcg18jTYbCiaPD HAdQ== X-Gm-Message-State: APjAAAWdeXGs2HROtN+IjQlprUvx4HNSHglENfIm0DQgYfGaTLh1MYQG ErsFjSWVtD9/1icIQpl1lB8Z5wmGcoqMsA== 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) Return-Path: 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) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: patches@linaro.org, Andrew.Baumann@microsoft.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH for-4.0] hw/arm/raspi: Diagnose requests for too much RAM 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 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: maximum is 1GB Fixes: https://bugs.launchpad.net/qemu/+bug/1794187 Signed-off-by: Peter Maydell --- hw/arm/raspi.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
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 @@ */ #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 version) BusState *bus; DeviceState *carddev; + 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 == 3 ? TYPE_BCM2837 : TYPE_BCM2836); object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),