From: Marek Vasut Date: Thu, 5 Jan 2023 01:22:22 +0000 (+0100) Subject: arm: stm32mp: Fix board_get_usable_ram_top() again X-Git-Tag: v2023.07~214^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a2e0b041d662e4c80502cd5c9a8326d026f9deb1;p=platform%2Fkernel%2Fu-boot.git arm: stm32mp: Fix board_get_usable_ram_top() again Do not access gd->ram_size and assume this is actual valid RAM size. Since commit 777aaaa706b ("common/memsize.c: Fix get_effective_memsize() to check for overflow") the RAM size may be less than gd->ram_size , call get_effective_memsize() to get the limited value instead. The aforementioned commit makes STM32MP15xx boards with 1 GiB of DRAM at 0xc0000000 hang on boot, which is a grave defect. Signed-off-by: Marek Vasut Reviewed-by: Patrick Delaunay --- diff --git a/arch/arm/mach-stm32mp/dram_init.c b/arch/arm/mach-stm32mp/dram_init.c index 9346fa8..80ba5c2 100644 --- a/arch/arm/mach-stm32mp/dram_init.c +++ b/arch/arm/mach-stm32mp/dram_init.c @@ -51,7 +51,7 @@ phys_size_t board_get_usable_ram_top(phys_size_t total_size) /* found enough not-reserved memory to relocated U-Boot */ lmb_init(&lmb); - lmb_add(&lmb, gd->ram_base, gd->ram_size); + lmb_add(&lmb, gd->ram_base, get_effective_memsize()); boot_fdt_add_mem_rsv_regions(&lmb, (void *)gd->fdt_blob); /* add 8M for reserved memory for display, fdt, gd,... */ size = ALIGN(SZ_8M + CONFIG_SYS_MALLOC_LEN + total_size, MMU_SECTION_SIZE),