All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] lmb: Reserve U-Boot separately if relocation is disabled
@ 2021-11-13 17:34 marek.vasut
  2021-11-18 23:26 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: marek.vasut @ 2021-11-13 17:34 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Simon Glass, Tom Rini

From: Marek Vasut <marek.vasut+renesas@gmail.com>

In case U-Boot starts with GD_FLG_SKIP_RELOC, the U-Boot code is
not relocated, however the stack and heap is at the end of DRAM
after relocation. Reserve a LMB area for the non-relocated U-Boot
code so it won't be overwritten.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
---
V2: Make this fully generic
V3: Cast _start to uintptr_t first
---
 lib/lmb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/lmb.c b/lib/lmb.c
index 676b3a0bda..f72996a424 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -13,6 +13,7 @@
 #include <malloc.h>
 
 #include <asm/global_data.h>
+#include <asm/sections.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -144,6 +145,10 @@ void arch_lmb_reserve_generic(struct lmb *lmb, ulong sp, ulong end, ulong align)
 			bank_end = end - 1;
 
 		lmb_reserve(lmb, sp, bank_end - sp + 1);
+
+		if (gd->flags & GD_FLG_SKIP_RELOC)
+			lmb_reserve(lmb, (phys_addr_t)(uintptr_t)_start, gd->mon_len);
+
 		break;
 	}
 }
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] lmb: Reserve U-Boot separately if relocation is disabled
  2021-11-13 17:34 [PATCH v3] lmb: Reserve U-Boot separately if relocation is disabled marek.vasut
@ 2021-11-18 23:26 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2021-11-18 23:26 UTC (permalink / raw)
  To: marek.vasut; +Cc: u-boot, Marek Vasut, Simon Glass

[-- Attachment #1: Type: text/plain, Size: 561 bytes --]

On Sat, Nov 13, 2021 at 06:34:37PM +0100, marek.vasut@gmail.com wrote:

> From: Marek Vasut <marek.vasut+renesas@gmail.com>
> 
> In case U-Boot starts with GD_FLG_SKIP_RELOC, the U-Boot code is
> not relocated, however the stack and heap is at the end of DRAM
> after relocation. Reserve a LMB area for the non-relocated U-Boot
> code so it won't be overwritten.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-18 23:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-13 17:34 [PATCH v3] lmb: Reserve U-Boot separately if relocation is disabled marek.vasut
2021-11-18 23:26 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.