All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm: socfpga: Fix bootcounter located at the end of internal SRAM
Date: Tue, 30 Oct 2018 14:13:56 +0100	[thread overview]
Message-ID: <f85ce9ba-f6a1-7387-2093-e78b94870fbd@denx.de> (raw)
In-Reply-To: <CAAh8qswFzRnEtCWy=p0m-Xm1Em5DyzwZCyod365UK4LifexSmQ@mail.gmail.com>

On 30.10.18 14:02, Simon Goldschmidt wrote:
> 
> 
> Stefan Roese <sr at denx.de <mailto:sr@denx.de>> schrieb am Di., 30. Okt. 2018, 13:50:
> 
>     On 30.10.18 13:37, Simon Goldschmidt wrote:
>      > On Tue, Oct 30, 2018 at 12:28 PM Stefan Roese <sr at denx.de <mailto:sr@denx.de>> wrote:
>      >>
>      >> On 30.10.18 12:17, Simon Goldschmidt wrote:
>      >>
>      >> <snip>
>      >>
>      >>>           >     diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
>      >>>           >     index 2330143cf1..bd8f5c8c41 100644
>      >>>           >     --- a/include/configs/socfpga_common.h
>      >>>           >     +++ b/include/configs/socfpga_common.h
>      >>>           >     @@ -31,8 +31,21 @@
>      >>>           >       #define CONFIG_SYS_INIT_RAM_ADDR       0xFFE00000
>      >>>           >       #define CONFIG_SYS_INIT_RAM_SIZE       0x40000 /* 256KB */
>      >>>           >       #endif
>      >>>           >     +
>      >>>           >     +/*
>      >>>           >     + * Some boards (e.g. socfpga_sr1500) use 8 bytes at the end of the internal
>      >>>           >     + * SRAM as bootcounter storage. Make sure to not put the stack directly
>      >>>           >     + * at this address to not overwrite the bootcounter by checking, if the
>      >>>           >     + * bootcounter address is located in the internal SRAM.
>      >>>           >     + */
>      >>>           >     +#if ((CONFIG_SYS_BOOTCOUNT_ADDR > CONFIG_SYS_INIT_RAM_ADDR) && \
>      >>>           >     +     (CONFIG_SYS_BOOTCOUNT_ADDR < (CONFIG_SYS_INIT_RAM_ADDR +  \
>      >>>           >     +                                  CONFIG_SYS_INIT_RAM_SIZE)))
>      >>>           >     +#define CONFIG_SYS_INIT_SP_ADDR                CONFIG_SYS_BOOTCOUNT_ADDR
>      >>>           >     +#else
>      >>>           >       #define CONFIG_SYS_INIT_SP_ADDR                        \
>      >>>           >              (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE)
>      >>>           >     +#endif
>      >>>
>      >>>
>      >>> Can we have this check on CONFIG_INIT_RAM_SIZE instead of the
>      >>> initial stack pointer?
>      >>>
>      >>> That would ensure the SPL size checks stay intact.
>      >>
>      >> I'm not really sure what you mean with this. Could you please
>      >> explain in more detail?
>      >
>      > Sorry for being unclear. What I meant was: currently
>      > CONFIG_SYS_INIT_RAM_SIZEis 0x10000 (the full 64 kByte).
>      > So if CONFIG_SYS_BOOTCOUNT_ADDR is 0xfffffff8, I think we should
>      > define CONFIG_SYS_INIT_RAM_SIZE to 0xfff8. That way, not only the
>      > CONFIG_SYS_INIT_SP_ADDR define is correct but CONFIG_SPL_MAX_SIZE is
>      > checked to not overlap this address, too.
>      >
>      > Would that make sense to you?
> 
>     Yes, I thought that you meant it this way. I'm not sure if we
>     should go this way. As we would change CONFIG_SYS_INIT_RAM_SIZE
>     to something that does not represent the physical size of the
>     on-chip SRAM. This could be very confusing and misleading, if
>     this define is used elsewhere.
> 
> 
> Hmm, okay. I dont want to push you there. I just thought it would
> be good to have the SPL binary size check correct...

Of course would this be good. But perhaps we can make this SPL
binary size check "better" by not changing the INIT_RAM_SIZE
define. Its definitely possible - I just don't know how hard
(I didn't look into this).

Thanks,
Stefan

  reply	other threads:[~2018-10-30 13:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-30  9:00 [U-Boot] [PATCH] arm: socfpga: Fix bootcounter located at the end of internal SRAM Stefan Roese
2018-10-30  9:07 ` Simon Goldschmidt
2018-10-30  9:36   ` Stefan Roese
2018-10-30 10:24     ` Marek Vasut
2018-10-30 10:34     ` Simon Goldschmidt
2018-10-30 11:17       ` Simon Goldschmidt
2018-10-30 11:28         ` Stefan Roese
2018-10-30 12:37           ` Simon Goldschmidt
2018-10-30 12:50             ` Stefan Roese
2018-10-30 13:02               ` Simon Goldschmidt
2018-10-30 13:13                 ` Stefan Roese [this message]
2018-10-30 13:24                   ` Marek Vasut
2018-10-30 15:00                     ` Simon Goldschmidt
2018-10-30 15:18                       ` Marek Vasut
2018-10-30 15:33                         ` Stefan Roese
2018-10-30 16:59                           ` Marek Vasut

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=f85ce9ba-f6a1-7387-2093-e78b94870fbd@denx.de \
    --to=sr@denx.de \
    --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.