From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 2/3] spl: Remove overwrite of relocated malloc limit
Date: Sun, 22 Jan 2017 22:11:58 -0500 [thread overview]
Message-ID: <20170123031158.GD10853@bill-the-cat> (raw)
In-Reply-To: <20170122221937.5868-3-afd@ti.com>
On Sun, Jan 22, 2017 at 04:19:36PM -0600, Andrew F. Davis wrote:
> spl_init on some boards is called after stack and heap relocation, on
> some platforms spl_relocate_stack_gd is called to handle setting the
> limit to its value CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN when simple
> SPL malloc is enabled during relocation. spl_init should then not
> re-assign the old pre-relocation limit when this is defined.
>
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> ---
> common/spl/spl.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 462c3a2b97..abff85a725 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -187,7 +187,9 @@ int spl_init(void)
> #ifdef CONFIG_MALLOC_F_ADDR
> gd->malloc_base = CONFIG_MALLOC_F_ADDR;
> #endif
> +#ifndef CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN
> gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN;
> +#endif
> gd->malloc_ptr = 0;
> #endif
With fuller context of the function, I don't like this solution. When
we do have CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN we are setting both
malloc_limit and malloc_base down in spl_relocate_stack_gd() and would
not want to overwrite either of them, yes? So what's happening (I
think) is that CONFIG_SYS_MALLOC_F_LEN set for U-Boot proper but are in
the case where it's also not the valid size for SPL. Yes?
So I think, in sum, we should change the just-above-context line:
#if defined(CONFIG_SYS_MALLOC_F_LEN)
into:
#if defined(CONFIG_SYS_MALLOC_F_LEN) && \
!defined(CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN)
And comment above it what is going on.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170122/40a11782/attachment.sig>
next prev parent reply other threads:[~2017-01-23 3:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-22 22:19 [U-Boot] [PATCH v3 0/3] Add a config for AM335x High Security EVM Andrew F. Davis
2017-01-22 22:19 ` [U-Boot] [PATCH v3 1/3] malloc_simple: Add debug statements to memalign_simple Andrew F. Davis
2017-01-23 3:12 ` Tom Rini
2017-01-23 4:17 ` Lokesh Vutla
2017-01-22 22:19 ` [U-Boot] [PATCH v3 2/3] spl: Remove overwrite of relocated malloc limit Andrew F. Davis
2017-01-23 3:11 ` Tom Rini [this message]
2017-01-22 22:19 ` [U-Boot] [PATCH v3 3/3] defconfig: Add a config for AM335x High Security EVM Andrew F. Davis
2017-01-23 4:17 ` Lokesh Vutla
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=20170123031158.GD10853@bill-the-cat \
--to=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