From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 055CFC531D0 for ; Mon, 27 Jul 2026 13:54:17 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1woLm7-0001pL-6H; Mon, 27 Jul 2026 09:53:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1woLm0-0001f4-Vm for qemu-arm@nongnu.org; Mon, 27 Jul 2026 09:53:43 -0400 Received: from mail-ua1-x92f.google.com ([2607:f8b0:4864:20::92f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1woLlu-0005pB-U5 for qemu-arm@nongnu.org; Mon, 27 Jul 2026 09:53:38 -0400 Received: by mail-ua1-x92f.google.com with SMTP id a1e0cc1a2514c-977258a75d9so1410170241.3 for ; Mon, 27 Jul 2026 06:53:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785160412; x=1785765212; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=nUDoFYam/Cs4djr+4VD+W1090TdsQ0zW6Cv5SU9lt7c=; b=PT9IDqqI9HA04Ng73/fZINk8rPMab1Pa7PKGFtbWkHHON1aSagI3tNI9Tdw7NBkyOn 9GS3vFmU3zSIDNWprw4DAU1eCG2FwsU43/nySu/Slur4CxbDQ0It7MEfbCgwcAYfHvHx ng9DQjPWmj2oa4cbH63yJOd9htAfgzOjqPYvP9AwDPI0CXDA1IyiO+HzgA8+4NtHeFJh GB3dBGLDZsGzsuaSeMoFD4pPYuc8wnHOJn3U6/Ql/aNJiHkMhS0taMFL+IS6az8Ff/DO fdvBBq6cRCpyaStSUVCPcPfttUy8938FBj10uPWhOrYD4i7PRDUYsKHDopHoC/v1QWZf EQFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785160412; x=1785765212; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=nUDoFYam/Cs4djr+4VD+W1090TdsQ0zW6Cv5SU9lt7c=; b=Ia7N585wdVpOHXUOYZO2BkQP9iCiAtbyclEGTRYh3UeGGQEiyVgbRiF+9ySG0JJeXD Wc5FghQFq+Go2QhOT5CKVlBFKzGUrpD9qL7GTzQwn/zGrrSLkeNpIH0/VulqHRYKXtiY UrG8JiR+8/KcHscGTCGsi5/gDK2YSWupvl48uwj0GJTrUeQ+pdr6fXrW0GCV9bTN7qkL I2/dba0m2pzH4v+YGCwzlVFxJGZRLtiAInrF8BouMmmpyv1tIrnQDDLegIB4aaDOCA7C V1vIQyA6D8NWCp9arDSD7HxRr+TdyxnHerCCWGIoZTFRQmFqE4nfft66GEFCXLmcLHM1 7rZA== X-Forwarded-Encrypted: i=1; AHgh+RoUSjJnGJ21EnbmJtwF/GtI7clL3dvp2gHi869VxCgp0Wzf0Zckkxh3QpuxhOtXOPVzmIXkErYceQ==@nongnu.org X-Gm-Message-State: AOJu0YzUBXS7yfDhCMOWQ49tvcII2dopsxcsyxyWKkVG48r9Pmud965U mX78SQG3MEzo9VJYMBUlqZ0nU/gXNEdsz+Pn1K/VkYUPUmh91/skHdz0 X-Gm-Gg: AR+sD13BeDwEpHPvT5Lr1ffoQYSGFhRoKZjRpR2inG9ICzdvV3NPvhbU/dHF7mJvPt+ 6BpNdSrTd91D6tg6QqKI28KwTm1EM54fuFg2CKPRXggbvLiGeB8DPutL+BPbKqBv5wnj20eqqSv DEPkAXRseKzKwsG7ZqXYD7zZdpASLzREaF8bBRDOEcEnZ4WFjObzUkKX4xwjucjzyrch2aCSZFT mlOyg4YVoT3r5O92+iqtJUrHnhCFFldvYcT+wtSaQ951TyrO5b+ngAU478gNkWSYMomVLcfDAgN vp0adD19gz+01z2ySINSd/q96Xclttf/c4/raqXU6gdn/aVyU86laQT6MtFEoCLyO4+UR7K5uqO RSsxYv3Pk72cFrXbqC/OPrZ9TudUxWNHiA3yEKtc+5nB2MHGkeJYtqtGEz9Uo6FmpZdZvvr2VwW jMbbEo6EhmqnVy6pQ66ruwdGrHJoX3CED/ X-Received: by 2002:a05:6102:508c:b0:738:1ef6:51b9 with SMTP id ada2fe7eead31-7503dd5664emr4844947137.5.1785160411860; Mon, 27 Jul 2026 06:53:31 -0700 (PDT) Received: from localhost.localdomain ([146.71.8.128]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-97774ce146csm5199734241.7.2026.07.27.06.53.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 27 Jul 2026 06:53:31 -0700 (PDT) From: Marcelo Manzo To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcelo Manzo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 1/2] hw/arm/raspi4b: fix guest never seeing more than ~1 GiB of RAM Date: Mon, 27 Jul 2026 09:53:28 -0400 Message-ID: <20260727135329.97190-2-marcelomanzo@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20260727135329.97190-1-marcelomanzo@gmail.com> References: <20260727135329.97190-1-marcelomanzo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::92f; envelope-from=marcelomanzo@gmail.com; helo=mail-ua1-x92f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Sender: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org raspi4_modify_dtb() decides whether to add a second memory node above the 1 GiB peripheral hole by checking info->ram_size -- but that field is the boot loader's RAM budget for loading the kernel/initrd/dtb image, itself always capped to at most UPPER_RAM_BASE - vcram_size by raspi_base_machine_init(). Since that capped value can never exceed UPPER_RAM_BASE by construction, the condition was never true for any raspi4b configuration, and the second node was never added: the guest never saw more than ~1 GiB of its nominal RAM, regardless of the machine's actual size. board_ram_size(info->board_id), computed one line above in the same function, is the value that was actually needed -- the board's real total RAM, not the boot loader's own budget for where it's allowed to place the kernel image. Confirmed via direct measurement inside the guest ("free -h" / /proc/meminfo) on raspi4b's default 2 GiB configuration, before and after: before: MemTotal: 943524 kB (~921 MiB) after: MemTotal: 1905824 kB (~1861 MiB) Also verified against two real, unmodified Raspberry Pi OS releases (Debian 11/Bullseye and Debian 13/Trixie): both now report ~1.8 GiB of usable RAM instead of ~900 MiB, with clean boots, working SSH, and no kernel errors on either. Signed-off-by: Marcelo Manzo Reviewed-by: Philippe Mathieu-Daudé --- hw/arm/raspi4b.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/arm/raspi4b.c b/hw/arm/raspi4b.c index b92840e1b6..821ddb42ed 100644 --- a/hw/arm/raspi4b.c +++ b/hw/arm/raspi4b.c @@ -64,7 +64,7 @@ static void raspi4_modify_dtb(const struct arm_boot_info *info, void *fdt) ram_size = board_ram_size(info->board_id); - if (info->ram_size > UPPER_RAM_BASE) { + if (ram_size > UPPER_RAM_BASE) { raspi_add_memory_node(fdt, UPPER_RAM_BASE, ram_size - UPPER_RAM_BASE); } } -- 2.47.1