From patchwork Wed Sep 10 19:06:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 285 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757531200; bh=uIQJqh5MgeicwC2Lc7MS8lwD7VxrgsHLU0BTY1Sw+AQ=; h=From:To:Date:CC:Subject:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=wSIwmxf950exc71JsGP2Jl/NRADFNvmemGyzDC5kjdvvyEMqQIPHEZhXs4COCggtA 3vVhUzmRCZytroqm3p9A1yNBeQRraKJsC3KNIEfrC3wgIiXd3N/Tp4NIQdfXLVeMzk JDdVv1uviIMEvNFALOMQKlkCeZNv/zm0Zecu7NwC9WVTh9OBKqdsHNBQ+XybVxmmEd PJuDCg9/yIDneriWAwsuRIzuNqRBwc7AtXoMpvmWnHl1tQGhqr1QUeT+jQlO6+rBB2 mXmdb2pv+YnXtu7YRB5VEAeJBYMy8uLZatsE6G+drOtU9XhFDJQrSFbedGfQo1fDeY 3PuwUnRwG98BA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 514C867ABE for ; Wed, 10 Sep 2025 13:06:40 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id LH5xafKj7R0O for ; Wed, 10 Sep 2025 13:06:40 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757531200; bh=uIQJqh5MgeicwC2Lc7MS8lwD7VxrgsHLU0BTY1Sw+AQ=; h=From:To:Date:CC:Subject:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=wSIwmxf950exc71JsGP2Jl/NRADFNvmemGyzDC5kjdvvyEMqQIPHEZhXs4COCggtA 3vVhUzmRCZytroqm3p9A1yNBeQRraKJsC3KNIEfrC3wgIiXd3N/Tp4NIQdfXLVeMzk JDdVv1uviIMEvNFALOMQKlkCeZNv/zm0Zecu7NwC9WVTh9OBKqdsHNBQ+XybVxmmEd PJuDCg9/yIDneriWAwsuRIzuNqRBwc7AtXoMpvmWnHl1tQGhqr1QUeT+jQlO6+rBB2 mXmdb2pv+YnXtu7YRB5VEAeJBYMy8uLZatsE6G+drOtU9XhFDJQrSFbedGfQo1fDeY 3PuwUnRwG98BA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 392E267ABD for ; Wed, 10 Sep 2025 13:06:40 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757531198; bh=xqIM3AwHnO20cyhFmonWeW7SP/rV3LcGlRfxO/fMXP0=; h=From:To:Cc:Subject:Date:From; b=F394r9GHhfb6VQagaquvKwbrPwrmYWJhLimv+oj2Kcof4G2A/HSZ6To6Kh7CWjGmM c2bt/k3YlNYDK1PETCbtfN+wCcAJJFcPBLQvPet51wfSfdf4rUr5IUPuHGLfZKKDId M6Z5KzkGSD8iYS4K3E34B93orvuAnqJ4/JYB8DYi3Bi4LOTBF/tdTwSa4j2NdCbuyY P63uecLjBFqrwiaap22/KJEODXYJt2O42IVnpy4yIOX2BzmojAYNwR2+kgGSptN+b+ BY8acVt8vZhqpcSdfqSnBXxITMK6H6jzu8MlTWtIuaPxuISrsMqM0HwEXgGBqbuKs8 Fgi/iJS9l7mRg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1D27667A2E; Wed, 10 Sep 2025 13:06:38 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 25qCtO9igdWA; Wed, 10 Sep 2025 13:06:38 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757531194; bh=1JMeEU1he9/dKg7sJjMD+ufOwNwwKRy1OQVgWraLY2E=; h=From:To:Cc:Subject:Date:From; b=flU/YD6UKohJQRPIHaV/NBgV0iodKJUk2Cue1kXDuwxZ4i6qSR5RBFj4Ioup8keFP YdFSpGTr4xADuk88sO1xkVndpBYslYy41Zo1YVkOdxyN3tRir8sjXVwneSaScIMErr m5CdfkXdB/vWqMJhVyeWDLHDGlkOUlVmcDUSClW/fACfQnvhz0cth+61mcMQscodb5 UAHy6RxwEKcX6IKP39bL3YepQdIyCMdB55/mE/QXKAxhPbYChUfP+timjpKmAgLCZI eUw/eQQ86jdZZ1JD6E/T0OReKws0t8UsxFdRHNxEyOvUvd1jslGc8D3ablD0C+fcyA 3neDMwrHHDhJA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C6AE36789C; Wed, 10 Sep 2025 13:06:33 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Wed, 10 Sep 2025 13:06:16 -0600 Message-ID: <20250910190619.2507730-1-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Message-ID-Hash: SIFXAYAEMAXBTAOAY5LUVRXTRVUHMYXD X-Message-ID-Hash: SIFXAYAEMAXBTAOAY5LUVRXTRVUHMYXD X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 1/2] Revert "sandbox: Avoid mon_len being larger than available RAM" List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass This fix turns out to be insufficient in the corner case where mon_len is smaller than available, emulated RAM but large enough that there isn't enough left. This reverts commit 88b810e241e7d1ccdf1d7329339cf5d5d9cef474. Signed-off-by: Simon Glass --- common/board_f.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index ef8b0ff7ef1..e23134a8403 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -464,11 +464,7 @@ static int reserve_uboot(void) * reserve memory for U-Boot code, data & bss * round down to next 4 kB limit */ - if (IS_ENABLED(CONFIG_SANDBOX) && gd->mon_len > gd->relocaddr) - log_debug("Cannot reserve space for U-Boot\n"); - else - gd->relocaddr -= gd->mon_len; - + gd->relocaddr -= gd->mon_len; gd->relocaddr &= ~(4096 - 1); #if defined(CONFIG_E500) || defined(CONFIG_MIPS) /* round down to next 64 kB limit so that IVPR stays aligned */ From patchwork Wed Sep 10 19:06:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 286 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757531202; bh=HDkiJuaMGipFlDPZBCIoOtI7abOOKmK85PpVKQ025lg=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=LJlN1lhirQGZYt8KOqZoLPxunQ0RotGEJTKn+9sMvbnJ4vJ4swtIxo8ganUmO3ebC Dzylcug4g6xCTBtAt0j2SDW07A4W9lnSQ5V3a80dV5HotEm5G814DAS3YRqYC01UJU SQ5y3TweLWT5yp3L2SQO0RCHYaE9JTYvxSMfgJQu4WlXuI8zKdS8ZbZ5bnNM6zcJIe V8Ny2dIL7HfDtRd2zPKwnrS9NwtGClDGPGEJ76EFW75QQYeWr5F09svPF58UjtUGKy 4UGU6hK6mS4NkJCvNbOHxJLyexDELiwB7sS01/y/3rJfiUyjKY+OnSCeBhV7P87IIy fA90uWD8OQZWg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B537267ABE for ; Wed, 10 Sep 2025 13:06:42 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id CXSHDycQkx8D for ; Wed, 10 Sep 2025 13:06:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757531202; bh=HDkiJuaMGipFlDPZBCIoOtI7abOOKmK85PpVKQ025lg=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=LJlN1lhirQGZYt8KOqZoLPxunQ0RotGEJTKn+9sMvbnJ4vJ4swtIxo8ganUmO3ebC Dzylcug4g6xCTBtAt0j2SDW07A4W9lnSQ5V3a80dV5HotEm5G814DAS3YRqYC01UJU SQ5y3TweLWT5yp3L2SQO0RCHYaE9JTYvxSMfgJQu4WlXuI8zKdS8ZbZ5bnNM6zcJIe V8Ny2dIL7HfDtRd2zPKwnrS9NwtGClDGPGEJ76EFW75QQYeWr5F09svPF58UjtUGKy 4UGU6hK6mS4NkJCvNbOHxJLyexDELiwB7sS01/y/3rJfiUyjKY+OnSCeBhV7P87IIy fA90uWD8OQZWg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A25D467A2E for ; Wed, 10 Sep 2025 13:06:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757531200; bh=bl2oDgxlocmIyKqIo5rmMTrBdpvD/p1un10rYVlm2EE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YvKDxgdMg1Xt2DeF2B2pa0aYRqOo2Rq5u3Uhrw6mwObNRZrb1vseQQUExdu6fdUg2 EwQ187mInoLvsFXaBc5kmM4Ve6Qx8t66UWBKs5bq/MW5PQOsWokRjOB+cyEgFTdCeI /E4uQ9wuc/G08INjgDp6KjkBeN7T03pnmYsCH0UVvZDF3oSZQcd1oM6FqTsr+3uv1/ 0qSp07gxQbUDx+vBVzYdAo1mY/DRizzU+F5oiMzzmMso6j64+lzo1C5Jwefax2MFBJ u0Hsf8rLxtKo4SnRG249F73DLZNhH2jZmWlIqgWW6e42v/IvdX8D1lMPn2ssLBB4+6 3sve76tuCa8Rg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3C16E67AB1; Wed, 10 Sep 2025 13:06:40 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id GYlmA-ziqRQm; Wed, 10 Sep 2025 13:06:40 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757531199; bh=r0SElFp24u3pOW4XuRuwCkzIuZM3NEOILgyqWF2bR/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PuXyfTlHfyK03yfzzfcSOgsh8SjEVgVOSPfOa/CYL9+Wx5IJfgrK0QszJo7p/26q6 qoWMLrlTZ9CzsYkAnqm/ycUoiat4I/apP39GeSaHECaPm0P1XIyTnu6SqOwpn4sTMM FWPsKamJKzc26SOB4BsKrGQ484OfP8p9bsYsDG6LvEpptm6iNPrxveVlNeCemvRjV/ QpuU72fjIDKB96/M2ElY10TLRAm3V5NyMyqo/ncYNFvWUOngCnc8LAk+b3k1EgAzIY GwGuV646YvHuyM23+Xbqc+R9RYF/3qEgPw+DGZfQiIpnEItihKGZ3op+u25l8ayko2 CZi5H2M9bs+LQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 19B886794C; Wed, 10 Sep 2025 13:06:39 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Wed, 10 Sep 2025 13:06:17 -0600 Message-ID: <20250910190619.2507730-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250910190619.2507730-1-sjg@u-boot.org> References: <20250910190619.2507730-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: DUEZTHT6NQMRGPDHEABCYVIQPLDC2GIJ X-Message-ID-Hash: DUEZTHT6NQMRGPDHEABCYVIQPLDC2GIJ X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 2/2] sandbox: Use a mon_len of 0 with the library List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass In the case of the shared/static libraries, the _end and _init symbols are not necessarily provided since the linker script is provided by the program which links against the U-Boot library. In some cases the memory size can show up as less than available memory, but enough that there is insufficient memory for U-Boot to start. It seems better to just set the mon_len to 0 for the library. Signed-off-by: Simon Glass --- common/board_f.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/board_f.c b/common/board_f.c index e23134a8403..40fe3aeb481 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -273,7 +273,7 @@ static int setup_mon_len(void) #elif defined(__ARM__) || defined(__MICROBLAZE__) gd->mon_len = (ulong)__bss_end - (ulong)_start; #elif defined(CONFIG_SANDBOX) && !defined(__riscv) - gd->mon_len = (ulong)_end - (ulong)_init; + gd->mon_len = gd_ulib() ? 0 : (ulong)_end - (ulong)_init; #elif defined(CONFIG_SANDBOX) /* gcc does not provide _init in crti.o on RISC-V */ gd->mon_len = 0;