public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm: fix bug on relocation address
Date: Fri, 01 Feb 2013 09:17:14 +0100	[thread overview]
Message-ID: <510B7A0A.5070906@denx.de> (raw)
In-Reply-To: <1359642542-18998-1-git-send-email-lroluk@gmail.com>

Hello Luca,

on 31.01.2013 15:29, Luca Ellero wrote:
> If (N. SDRAM banks > 1) and they are not contiguous, don't relocate
> u-boot at (CONFIG_SYS_SDRAM_BASE + gd->ram_size), which is a bug.
> Instead use the end of 2nd bank (even if there are more than 2 banks)
> 
> Signed-off-by: Luca Ellero <lroluk@gmail.com>
> Cc: Albert Aribaud <albert.u.boot@aribaud.net>
> Cc: Heiko Schocher <hs@denx.de>
> ---
> 
> On ARM architectures there is a bug getting top of SDRAM (where u-boot 
> will be relocated). Top of SDRAM will always be:
> 
> CONFIG_SYS_SDRAM_BASE + gd->ram_size
> 
> anyway this can be wrong since SDRAM can be composed by more that one 
> bank in not-contiguous address space.
> (CONFIG_SYS_SDRAM_BASE + gd->ram_size) can land to not existent SDRAM 
> addresses and can be very dangerous since it can potentially corrupt 
> real SDRAM (in most cases SDRAM is aliased so writing to some 
> not-existent address can write to real address).
> Some arch use more than 2 banks but implementing all macros checks to 
> PHYS_SDRAM_* leads to very ugly code, so I think using 2nd bank is good 
> and does not generates bloated code

This is not a valid use case for U-Boot! Look in the README
section "Memory Management". This is not so trivial as it looks,
as for example the stack pointer starts somewhere near the end
of RAM and grows downwards. If you now have RAM with gaps, it maybe
reaches an address, which is not valid ...

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

      parent reply	other threads:[~2013-02-01  8:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-31 14:29 [U-Boot] [PATCH] arm: fix bug on relocation address Luca Ellero
2013-01-31 19:08 ` Jeroen Hofstee
2013-02-01  8:50   ` Luca Ellero
2013-02-01 10:07     ` Heiko Schocher
2013-02-01  9:49       ` Luca Ellero
2013-02-07  9:07         ` Luca Ellero
2013-02-01  8:17 ` Heiko Schocher [this message]

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=510B7A0A.5070906@denx.de \
    --to=hs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox