[PATCH] lmb: Reinstate access to memory above ram_top

Tom Rini trini at konsulko.com
Sat May 30 16:25:57 CEST 2026


On Sat, May 30, 2026 at 04:22:56PM +0200, Marek Vasut wrote:
> On 5/30/26 3:44 PM, Peter Robinson wrote:
> 
> > > The revert is wrong as that breaks other things , like use of DRAM above
> > > 4 GiB boundary, which is exactly why this change was implemented. If RPi
> > > has limitations, then those limitations should be imposed on RPi, not
> > > globally, so add the LMB reservations on RPi.
> > 
> > I have no idea how LMB works so please send a patch that does that.
> 
> Try this:
> 
> // Enable CONFIG_LMB_ARCH_MEM_MAP=y
> 
> #include <lmb.h>
> 
> void lmb_arch_add_memory(void)
> {
> 	int i;
> 	phys_addr_t bank_end;
> 	phys_size_t size;
> 	u64 ram_top = gd->ram_top;
> 	struct bd_info *bd = gd->bd;
> 
> 	/* Assume a 4GB ram_top if not defined */
> 	if (!ram_top)
> 		ram_top = 0x100000000ULL;
> 
> 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
> 		size = bd->bi_dram[i].size;
> 		bank_end = bd->bi_dram[i].start + size;
> 
> 		if (size) {
> 			/*
> 			 * Reserve memory above ram_top as
> 			 * no-overwrite so that it cannot be
> 			 * allocated
> 			 */
> 			if (bd->bi_dram[i].start >= ram_top)
> 				lmb_reserve(bd->bi_dram[i].start, size,
> 					    LMB_NOOVERWRITE);
> 			else if (bank_end > ram_top)
> 				lmb_reserve(ram_top, bank_end - ram_top,
> 					    LMB_NOOVERWRITE);
> 		}
> 	}
> }

I see our last emails crossed, thanks for posting this to help figure
out what's going, Marek.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20260530/c92ed9e6/attachment.sig>


More information about the U-Boot mailing list