From nobody Tue Oct 7 14:46:45 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 158071851929846.49650048575461; Mon, 3 Feb 2020 00:28:39 -0800 (PST) Received: from localhost ([::1]:36038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iyX5y-0005Ob-7k for importer@patchew.org; Mon, 03 Feb 2020 03:28:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34804) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iyX41-0002F7-Em for qemu-devel@nongnu.org; Mon, 03 Feb 2020 03:26:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iyX3u-00012C-Pp for qemu-devel@nongnu.org; Mon, 03 Feb 2020 03:26:32 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:39476) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iyX3t-00011Z-3J; Mon, 03 Feb 2020 03:26:30 -0500 Received: by mail-wm1-x342.google.com with SMTP id c84so15801329wme.4; Mon, 03 Feb 2020 00:26:28 -0800 (PST) Received: from localhost.localdomain (162.red-83-52-55.dynamicip.rima-tde.net. [83.52.55.162]) by smtp.gmail.com with ESMTPSA id w20sm22396778wmk.34.2020.02.03.00.26.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2020 00:26:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XbrBImsz44K8Xswh3EJyXdM5NyfxQNqxR88yL7gBw4I=; b=eV1gR+dJUN4GCsDBV7J3bxGaEGXZetqOEKg6/n3K+6OJxd15KkmosGax+6f9u+Na0a j82/3wP43NDosSrB7RYBHIy0ncN7Hlt08QuuL51E8W2jKsQTNUGCAQHMX6Ke8frmLB6B qklFQw3GIeSNi3Pk3FYPknKc2QCFuv7bD6xgW6RQiNwZbDXhM+OO1VIf8pxjVabM5GVj ietp0Z0jlVv6AEqCzhKiJYG1+Fvrw0w8pWXG3RybYTPblA6mLNHNJmJWI5mXmWpMWi+W aG9TnFppm54SEWsJJPBBQn+gm9O8v5n/XIFGgUedroDI819/niBufp0P7TCD0iGblTEV di+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=XbrBImsz44K8Xswh3EJyXdM5NyfxQNqxR88yL7gBw4I=; b=A4SP4Zjri/tXxeDDmL+ofJ+Goot7Yrq9cATw/zzMCPJeKALAwnsRhxHtU6qk/IQqBt QCgnK6lU4BiGVW+Hc3w1JxFM97h3+BLZxrOEndabYjsgnAQTrK3dUVd/78YPzmeNKIif qfNqbVpLskIBN7yjEwjP4fHB/xeSoI+K62g/kkMdVVeVl/D4QHfBPNrU308qcrO57R+P VMa04UC1n2kThHVel1OKroPUMq6rvFbyKOKvq/V/H8EPkhAByCZAl2zaFtab6yh3gJh4 eWklQiYRd3U6M+7ITKdP4ctNbtTGk36wMCX32RIOsIIHfljuFSD2Xi++dDWP+bBhxmuq JXXQ== X-Gm-Message-State: APjAAAWjpnGfFMoSku3wJG9DjZ/trpzl3wjrq+qtt8Dqr3+Bq8N7DBPZ UJp1qaOYGmbo6zAzWv4iiJi3NLN+ X-Google-Smtp-Source: APXvYqzAeylC/Aa3zxzliGKQOvFiWGVoaxqJwM7KLUkLdbIN5rwhWtke/jl675bZ4AFzMYTb8cS9ng== X-Received: by 2002:a1c:6246:: with SMTP id w67mr26959693wmb.141.1580718387957; Mon, 03 Feb 2020 00:26:27 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 4/6] hw/arm/raspi: Get board RAM size from board revision code Date: Mon, 3 Feb 2020 09:26:17 +0100 Message-Id: <20200203082619.7426-5-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200203082619.7426-1-f4bug@amsat.org> References: <20200203082619.7426-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" 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::342 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Baumann , qemu-arm@nongnu.org, Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The amount of RAM is encoded in the board revision. Add the board_ram_size() helper, it will allow us to quickly support new boards. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Igor Mammedov --- hw/arm/raspi.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index f5e54fe876..656d834e07 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -13,6 +13,7 @@ =20 #include "qemu/osdep.h" #include "qemu/units.h" +#include "qemu/cutils.h" #include "qapi/error.h" #include "cpu.h" #include "hw/arm/bcm2836.h" @@ -71,6 +72,11 @@ static const RaspiBoardInfo raspi_boards[] =3D { #endif }; =20 +static uint64_t board_ram_size(const RaspiBoardInfo *config) +{ + return 1 * MiB << extract32(config->board_rev, 20, 4); +} + static int board_chip_id(const RaspiBoardInfo *config) { return extract32(config->board_rev, 12, 4); @@ -222,10 +228,13 @@ static void raspi_init(MachineState *machine, const R= aspiBoardInfo *config) BlockBackend *blk; BusState *bus; DeviceState *carddev; + uint64_t ram_size; =20 - if (machine->ram_size > 1 * GiB) { - error_report("Requested ram size is too large for this machine: " - "maximum is 1GB"); + ram_size =3D board_ram_size(config); + if (machine->ram_size !=3D ram_size) { + char *size_str =3D size_to_str(ram_size); + error_report("This machine can only be used with %s", size_str); + g_free(size_str); exit(1); } =20 --=20 2.21.1