From: Ye Li Date: Thu, 16 Apr 2026 13:48:38 +0000 (+0800) Subject: arm: layerscape: Check zero size memory bank before lmb_add X-Git-Tag: v2026.07-rc2~16^2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33ff22c0b169401ab555e8508c06da1848a2d539;p=thirdparty%2Fu-boot.git arm: layerscape: Check zero size memory bank before lmb_add In layerspace's lmb_arch_add_memory implementation, all memory bank are added to lmb, even some is with zero size. This will cause lmb treating it as overlap with available memory by lmb_addrs_overlap and merge with available memory. Finally causing available memory start address changed to 0. For example, on LX2160, before zero memory bank added to lmb, there are two available memory regions: - region 0, start 0x80000000, size 0x7be00000 - region 1, start 0x2080000000, size 0x700000000 After zero size memory bank added, merge to one region: - region 0, start 0, size 0x2780000000 This wrong new region causes efi_memory_init issue when allocating bounce buffer because of conflict address (with uboot reserved) is allocated. Signed-off-by: Ye Li Reviewed-by: Peng Fan Signed-off-by: Peng Fan --- diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c index cfbaa475701..7f0cb28f52d 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c +++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c @@ -1549,7 +1549,8 @@ void lmb_arch_add_memory(void) gd->arch.resv_ram < ram_start + ram_size) ram_size = gd->arch.resv_ram - ram_start; #endif - lmb_add(ram_start, ram_size); + if (ram_size > 0) + lmb_add(ram_start, ram_size); } } #endif