Skip to contentSkip to conversation

board_f: Only reserve memory for U-Boot if we're going to relocate

PATCH New Alexey Brodkin 2 participants 4 messages Jan 25, 2018 – Feb 22, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some paceat the very end of usable memory area. If U-Boot is huge and we cannot use a lot of memory this loss will be pretty inconvenient.

Cc Simon Glass <[email protected]>
Cc Bin Meng <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc York Sun <[email protected]>
Cc Stefan Roese <[email protected]>
---
 common/board_f.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)
common/board_f.c +15 -13
index 92743089087e..d1662199a570 100644
@@ -396,19 +396,21 @@ static int reserve_trace(void)
 
 static int reserve_uboot(void)
 {
-	/*
-	 * reserve memory for U-Boot code, data & bss
-	 * round down to next 4 kB limit
-	 */
-	gd->relocaddr -= gd->mon_len;
-	gd->relocaddr &= ~(4096 - 1);
-#if defined(CONFIG_E500) || defined(CONFIG_MIPS)
-	/* round down to next 64 kB limit so that IVPR stays aligned */
-	gd->relocaddr &= ~(65536 - 1);
-#endif
-
-	debug("Reserving %ldk for U-Boot at: %08lx\n", gd->mon_len >> 10,
-	      gd->relocaddr);
+	if (!(gd->flags & GD_FLG_SKIP_RELOC)) {
+		/*
+		 * reserve memory for U-Boot code, data & bss
+		 * round down to next 4 kB limit
+		 */
+		gd->relocaddr -= gd->mon_len;
+		gd->relocaddr &= ~(4096 - 1);
+	#if defined(CONFIG_E500) || defined(CONFIG_MIPS)
+		/* round down to next 64 kB limit so that IVPR stays aligned */
+		gd->relocaddr &= ~(65536 - 1);
+	#endif
+
+		debug("Reserving %ldk for U-Boot at: %08lx\n",
+		      gd->mon_len >> 10, gd->relocaddr);
+	}
 
 	gd->start_addr_sp = gd->relocaddr;
 
Signature · 1 line
2.14.3
#1 lore raw

PATCH 1/1 board_f: Only reserve memory for U-Boot if we're going to relocate

Hi Alexey,

Quoted 1 line · Alexey Brodkin

In case of no relocation we'll just waste some paceat the very end

space at?

Quoted 1 line

of usable memory area. If U-Boot is huge and we cannot use a lot of memory this

What do you mean by 'U-Boot is huge'? How huge, and why would it be huge?

Quoted 8 lines

loss will be pretty inconvenient.

Cc Simon Glass <[email protected]>
Cc Bin Meng <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc York Sun <[email protected]>
Cc Stefan Roese <[email protected]>
Quoted 4 lines
---
 common/board_f.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

Other than that:

#2 lore raw

PATCH 1/1 board_f: Only reserve memory for U-Boot if we're going to relocate

Hi Simon,

Quoted 6 lines · Simon Glass

Hi Alexey,

Quoted 1 line · Alexey Brodkin

In case of no relocation we'll just waste some paceat the very end

space at?

Sure, thanks for pointing out!

Quoted 4 lines
Quoted 2 lines

of usable memory area. If U-Boot is huge and we cannot use a lot of memory this

What do you mean by 'U-Boot is huge'? How huge, and why would it be huge?

I was talking about relative sizes of U-Boot compared to available RAM. Consider we have less than 1 Mb of RAM and U-Boot's size is ~200 kB - in that case looking 20% of RAM is not what we really want.

In more typical case when we have tens, hundreds or thousands of megabytes of RAM essentially loosing even another megabyte makes not much sense :)

-Alexey

#3 lore raw

PATCH 1/1 board_f: Only reserve memory for U-Boot if we're going to relocate

Hi Alexey,

Quoted 15 lines · Alexey Brodkin

Hi Simon,

Quoted 6 lines · Simon Glass

Hi Alexey,

Quoted 1 line · Alexey Brodkin

In case of no relocation we'll just waste some paceat the very end

space at?

Sure, thanks for pointing out!

Quoted 3 lines
Quoted 2 lines

of usable memory area. If U-Boot is huge and we cannot use a lot of memory this

Quoted 9 lines
Quoted 1 line

What do you mean by 'U-Boot is huge'? How huge, and why would it be huge?

I was talking about relative sizes of U-Boot compared to available RAM. Consider we have less than 1 Mb of RAM and U-Boot's size is ~200 kB - in that case looking 20% of RAM is not what we really want.

In more typical case when we have tens, hundreds or thousands of megabytes of RAM essentially loosing even another megabyte makes not much sense :)

OK I see, so really is it the memory which is small, rather than U-Boot that is huge? If so, can you please update the commit message?

Regards,
Simon