From: marek.vasut@gmail.com
To: u-boot@lists.denx.de
Cc: Marek Vasut <marek.vasut+renesas@gmail.com>,
Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>
Subject: [PATCH v3] lmb: Reserve U-Boot separately if relocation is disabled
Date: Sat, 13 Nov 2021 18:34:37 +0100 [thread overview]
Message-ID: <20211113173437.32049-1-marek.vasut@gmail.com> (raw)
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
next reply other threads:[~2021-11-13 17:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-13 17:34 marek.vasut [this message]
2021-11-18 23:26 ` [PATCH v3] lmb: Reserve U-Boot separately if relocation is disabled Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211113173437.32049-1-marek.vasut@gmail.com \
--to=marek.vasut@gmail.com \
--cc=marek.vasut+renesas@gmail.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox