Skip to contentSkip to conversation

Revert "lmb: Reinstate access to memory above ram_top"

PATCH NAK Peter Robinson 2 participants 4 messages May 29 – May 30 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "lmb: Reinstate access to memory above ram_top"

This reverts commit a3075db94d49f415658bf7e961e1eae90d9abc33.

This causes boot issues on Raspberry Pi 4/5 in a number of ways, the mmc needs memory < 4Gb, the mailbox needs it < 1Gb at the very least so there's some work to be done here for that platform.

---
 lib/lmb.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
lib/lmb.c +16 -1
index 8f12c6ad8e5..e2d9fe86c14 100644
@@ -611,6 +611,7 @@ static __maybe_unused void lmb_reserve_common_spl(void)
 static void lmb_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;
@@ -624,9 +625,23 @@ static void lmb_add_memory(void)
 
 	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)
+		if (size) {
 			lmb_add(bd->bi_dram[i].start, 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);
+		}
 	}
 }
 
Signature · 1 line
2.54.0
#1 lore raw
Quoted 7 lines · Peter Robinson

This reverts commit a3075db94d49f415658bf7e961e1eae90d9abc33.

This causes boot issues on Raspberry Pi 4/5 in a number of ways, the mmc needs memory < 4Gb, the mailbox needs it < 1Gb at the very least so there's some work to be done here for that platform.

NAK

The revert is wrong as that breaks other things, like use of DRAM above 4 GiB boundary, which is exactly why the original change was implemented.

If RPi has limitations, then those limitations should be imposed on RPi, not globally. Please add the LMB reservations on RPi only. Use lmb_arch_add_memory() to add those restrictions per-board/soc/arch instead.

#2 lore raw
Quoted 8 lines · Marek Vasut
Quoted 6 lines · Peter Robinson

This reverts commit a3075db94d49f415658bf7e961e1eae90d9abc33.

This causes boot issues on Raspberry Pi 4/5 in a number of ways, the mmc needs memory < 4Gb, the mailbox needs it < 1Gb at the very least so there's some work to be done here for that platform.

Quoted 5 lines
Quoted 1 line

NAK

The revert is wrong as that breaks other things, like use of DRAM above 4 GiB boundary, which is exactly why the original change was implemented.

Read the thread, Tom asked me to send a revert.

Quoted 3 lines

If RPi has limitations, then those limitations should be imposed on RPi, not globally. Please add the LMB reservations on RPi only. Use lmb_arch_add_memory() to add those restrictions per-board/soc/arch instead.

#3 lore raw
Quoted 9 lines · Peter Robinson
Quoted 8 lines · Marek Vasut
Quoted 6 lines · Peter Robinson

This reverts commit a3075db94d49f415658bf7e961e1eae90d9abc33.

This causes boot issues on Raspberry Pi 4/5 in a number of ways, the mmc needs memory < 4Gb, the mailbox needs it < 1Gb at the very least so there's some work to be done here for that platform.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

NAK

The revert is wrong as that breaks other things, like use of DRAM above 4 GiB boundary, which is exactly why the original change was implemented.

Read the thread, Tom asked me to send a revert.

The revert is wrong, I already sent you a way to fix your RPi problem too. It would be nice if you didn't use "Tom said so" as an argument in technical discussion, that is not helpful.

Quoted 3 lines
Quoted 3 lines

If RPi has limitations, then those limitations should be imposed on RPi, not globally. Please add the LMB reservations on RPi only. Use lmb_arch_add_memory() to add those restrictions per-board/soc/arch instead.