* [U-Boot] [PATCH v2] board_f: reserve noncached space below malloc area
@ 2019-08-16 16:57 Vikas Manocha
2019-08-27 0:18 ` Tom Rini
0 siblings, 1 reply; 2+ messages in thread
From: Vikas Manocha @ 2019-08-16 16:57 UTC (permalink / raw)
To: u-boot
Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.
Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
---
Changes in v2: added blank line before return
common/board_f.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/common/board_f.c b/common/board_f.c
index 59745d5..58529d2 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -439,12 +439,29 @@ static int reserve_uboot(void)
return 0;
}
+#ifdef CONFIG_SYS_NONCACHED_MEMORY
+static int reserve_noncached(void)
+{
+ /* round down to SECTION SIZE (typicaly 1MB) limit */
+ gd->start_addr_sp &= ~(MMU_SECTION_SIZE - 1);
+ gd->start_addr_sp -= CONFIG_SYS_NONCACHED_MEMORY;
+ debug("Reserving %dM for noncached_alloc() at: %08lx\n",
+ CONFIG_SYS_NONCACHED_MEMORY >> 20, gd->start_addr_sp);
+
+ return 0;
+}
+#endif
+
/* reserve memory for malloc() area */
static int reserve_malloc(void)
{
gd->start_addr_sp = gd->start_addr_sp - TOTAL_MALLOC_LEN;
debug("Reserving %dk for malloc() at: %08lx\n",
TOTAL_MALLOC_LEN >> 10, gd->start_addr_sp);
+#ifdef CONFIG_SYS_NONCACHED_MEMORY
+ reserve_noncached();
+#endif
+
return 0;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH v2] board_f: reserve noncached space below malloc area
2019-08-16 16:57 [U-Boot] [PATCH v2] board_f: reserve noncached space below malloc area Vikas Manocha
@ 2019-08-27 0:18 ` Tom Rini
0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2019-08-27 0:18 UTC (permalink / raw)
To: u-boot
On Fri, Aug 16, 2019 at 09:57:44AM -0700, Vikas Manocha wrote:
> Noncached area at present is being initialized to random space after malloc
> area. It works in most the cases as it goes to stack area & stack is not
> overwriting it being far from it.
>
> Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190826/b4b630f8/attachment.sig>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-27 0:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-16 16:57 [U-Boot] [PATCH v2] board_f: reserve noncached space below malloc area Vikas Manocha
2019-08-27 0:18 ` 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.