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);
}
}
}