All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chee, Tien Fong <tien.fong.chee@intel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 6/6] arm: socfpga: a10: move SPL stack size to Kconfig
Date: Wed, 20 Mar 2019 04:15:45 +0000	[thread overview]
Message-ID: <1553055344.10073.2.camel@intel.com> (raw)
In-Reply-To: <84a1af08-c23a-c633-4a2c-69847a0279f1@gmail.com>

On Tue, 2019-03-19 at 17:29 +0100, Simon Goldschmidt wrote:
> Am 19.03.2019 um 17:19 schrieb Chee, Tien Fong:
> > 
> > On Fri, 2019-03-15 at 21:13 +0100, Simon Goldschmidt wrote:
> > > 
> > > Instead of fixing the SPL stack to 64 KiB in the board config
> > > header
> > > via
> > > CONFIG_SYS_SPL_MALLOC_SIZE, let's just use
> > > CONFIG_SPL_SYS_MALLOC_F_LEN
> > > in the defconfig.
> > > 
> > > This also has the advandage that it removes sub-mach specific
> > > ifdefs
> > > in
> > > socfpga_common.h.
> > > 
> > > Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com
> > > >
> > > ---
> > Hi Simon,
> > 
> > I found the culprit in patch[5], you cannot put mem_malloc_init in
> > spl_common_init function because spl_common_init would be called in
> > board_init_f, then board_init_f would call mem_malloc_init,
> > mem_malloc_init would store start and end addresses to few global
> > variables such as mem_malloc_start, mem_malloc_end and
> > mem_malloc_brk.
> > By that time, global variables are unavailable yet.
> Thanks for testing. Patch 2/6 should make sure global variables are 
> available in board_init_f by clearing bss *before* calling that 
> function, not *after* calling it. Because technicaly, global
> variables 
> are always available for a10-SPL as they are located in SRAM. They
> only 
> got cleared after board_init_f...
Yes, you are right, memset would clear .BSS after mem_malloc_init.
> 
> Which gets me to my error: I forgot to enable the newly added 
> CONFIG_SPL_CLEAR_BSS_F in this patch. Could you probably try again
> with 
> CONFIG_SPL_CLEAR_BSS_F enabled? That would be great!
Tested, passing. May be force enabling it or compile error if full
malloc is used?

Thanks.
TF.
> 
> Regards,
> Simon
> 
> > 
> > 
> > Thanks.
> > TF
> > 
> > > 
> > > 
> > > Changes in v2: None
> > > 
> > >   configs/socfpga_arria10_defconfig |  1 +
> > >   include/configs/socfpga_common.h  | 14 --------------
> > >   2 files changed, 1 insertion(+), 14 deletions(-)
> > > 
> > > diff --git a/configs/socfpga_arria10_defconfig
> > > b/configs/socfpga_arria10_defconfig
> > > index f321a0ac3b..8d0479cc05 100644
> > > --- a/configs/socfpga_arria10_defconfig
> > > +++ b/configs/socfpga_arria10_defconfig
> > > @@ -2,6 +2,7 @@ CONFIG_ARM=y
> > >   CONFIG_ARCH_SOCFPGA=y
> > >   CONFIG_SYS_TEXT_BASE=0x01000040
> > >   CONFIG_SYS_MALLOC_F_LEN=0x2000
> > > +CONFIG_SPL_SYS_MALLOC_F_LEN=0x10000
> > >   CONFIG_TARGET_SOCFPGA_ARRIA10_SOCDK=y
> > >   CONFIG_SPL=y
> > >   CONFIG_IDENT_STRING="socfpga_arria10"
> > > diff --git a/include/configs/socfpga_common.h
> > > b/include/configs/socfpga_common.h
> > > index 181af9b646..16c83900c3 100644
> > > --- a/include/configs/socfpga_common.h
> > > +++ b/include/configs/socfpga_common.h
> > > @@ -251,16 +251,6 @@ unsigned int
> > > cm_get_qspi_controller_clk_hz(void);
> > >   #define CONFIG_SPL_TEXT_BASE		CONFIG_SYS_INIT_RAM
> > > _ADDR
> > >   #define CONFIG_SPL_MAX_SIZE		CONFIG_SYS_INIT_RAM_
> > > SIZE
> > >   
> > > -#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
> > > -/* SPL memory allocation configuration, this is for FAT
> > > implementation */
> > > -#ifndef CONFIG_SYS_SPL_MALLOC_START
> > > -#define CONFIG_SYS_SPL_MALLOC_SIZE	0x00010000
> > > -#define CONFIG_SYS_SPL_MALLOC_START	(CONFIG_SYS_INIT_RAM_
> > > SIZE
> > > - \
> > > -					 CONFIG_SYS_SPL_MALLOC_S
> > > IZE
> > > + \
> > > -					 CONFIG_SYS_INIT_RAM_ADD
> > > R)
> > > -#endif
> > > -#endif
> > > -
> > >   /* SPL SDMMC boot support */
> > >   #ifdef CONFIG_SPL_MMC_SUPPORT
> > >   #if defined(CONFIG_SPL_FS_FAT) || defined(CONFIG_SPL_FS_EXT4)
> > > @@ -294,11 +284,7 @@ unsigned int
> > > cm_get_qspi_controller_clk_hz(void);
> > >   /*
> > >    * Stack setup
> > >    */
> > > -#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
> > >   #define CONFIG_SPL_STACK		CONFIG_SYS_INIT_SP_ADDR
> > > -#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
> > > -#define CONFIG_SPL_STACK		CONFIG_SYS_SPL_MALLOC_ST
> > > ART
> > > -#endif
> > >   
> > >   /* Extra Environment */
> > >   #ifndef CONFIG_SPL_BUILD

  reply	other threads:[~2019-03-20  4:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-15 20:13 [U-Boot] [PATCH v2 0/6] spl: full-featured heap cleanups Simon Goldschmidt
2019-03-15 20:13 ` [U-Boot] [PATCH v2 1/6] spl: add Kconfig option to clear bss early Simon Goldschmidt
2019-03-22  7:53   ` Simon Glass
2019-03-22  8:16     ` Simon Goldschmidt
2019-03-30 20:03       ` Simon Glass
2019-03-15 20:13 ` [U-Boot] [PATCH v2 2/6] spl: arm: implement SPL_CLEAR_BSS_F Simon Goldschmidt
2019-03-15 20:13 ` [U-Boot] [PATCH v2 3/6] dlmalloc: fix malloc range at end of ram Simon Goldschmidt
2019-03-15 20:13 ` [U-Boot] [PATCH v2 4/6] dlmalloc: be compatible to tiny printf Simon Goldschmidt
2019-03-15 20:13 ` [U-Boot] [PATCH v2 5/6] spl: support using full malloc with SYS_MALLOC_F_LEN Simon Goldschmidt
2019-03-22  7:53   ` Simon Glass
2019-03-22  8:08     ` Simon Goldschmidt
2019-03-15 20:13 ` [U-Boot] [PATCH v2 6/6] arm: socfpga: a10: move SPL stack size to Kconfig Simon Goldschmidt
2019-03-19 16:19   ` Chee, Tien Fong
2019-03-19 16:29     ` Simon Goldschmidt
2019-03-20  4:15       ` Chee, Tien Fong [this message]
2019-03-20  6:59         ` Simon Goldschmidt

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=1553055344.10073.2.camel@intel.com \
    --to=tien.fong.chee@intel.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 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.