[PATCH 1/2] Revert "sandbox: Avoid mon_len being larger than available RAM"

From: Simon Glass <sjg@chromium.org> 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 <sjg@chromium.org> --- 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 */ -- 2.43.0 base-commit: ec32a6ef1554369aa114c2c032fb9e72460fd192 branch: ulig

From: Simon Glass <sjg@chromium.org> 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 <sjg@chromium.org> --- 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; -- 2.43.0 base-commit: ec32a6ef1554369aa114c2c032fb9e72460fd192 branch: ulig
participants (1)
-
Simon Glass