public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] hang: ARM64/Relocating u-boot from u-boot
Date: Fri, 10 Jul 2015 10:48:42 +0200	[thread overview]
Message-ID: <20150710104842.1caa156e@lilith> (raw)
In-Reply-To: <20150709203848.DA7663805B1@gemini.denx.de>

Hello Wolfgang,

On Thu, 09 Jul 2015 22:38:48 +0200, Wolfgang Denk <wd@denx.de> wrote:
> Dear Albert,
> 
> In message <20150708084625.5a18e9a5@lilith> you wrote:
> > 
> > > http://www.denx.de/wiki/view/DULG/CanUBootBeConfiguredSuchThatItCanBeStartedInRAM
> > 
> > If I may, this FAQ is slightly outdated, in that chainloading U-Boot is
> > not only possible but actually made possible by design, at least for
> > many ARM (and possibly some ARM64) targets, and I suspect for many
> > non-ARM targets too, as long as they use SPL.
> 
> I agree that the documentation could need some dditional explanations,
> but it is not exactly outdated nor incorrect.
> 
> > First off: the FAQ is perfectly true if applied to running SPL from
> > SPL.
> 
> Right.  This is the part that needs to be explained:  You cannot (at
> least not in general, there are always some exceptions) run the code
> that is supposed to "run first" again from an already running U-Boot.
> 
> With Non-SPL versions this is the plain U-Boot binary, with SPL it's
> the SPL, etc.
> 
> > IOW, on targets with SPL, U-Boot starts with the guarantee that all
> > initializations needed for external RAM to work have been done, and
> > it guarantees that it will not perform these external RAM inits again.
> 
> This is true, but not always sufficient.  There may still be
> initializations that cannot be done again.
> 
> > And since an SPL-chainloaded U-Boot runs with external already
> > initialized and does not initialize it again, it follows that this
> > U-Boot is a valid environment for running another instance of itself,
> > provided the new instance and current instances do not overwrite each
> > other.
> 
> This is often the case, but not necessarily always.  There are systems
> with components that can be initialized just once after a reset - for
> example, the watchdog on some systems.  If your first U-Boot
> configures the watchdog on such a system to run, and you try and load
> another U-Boot image which tries to disable the watchdog, it will not
> work, and the new U-Boot will crash as it fails to trigger toe
> watchdog.
> 
> > All of this makes it nont only perfectly possible for (SPL-run) U-Boot
> > to chainload (SPL-run) U-Boot, it pretty much guarantees it.
> 
> The point is, this guarantee is a one-time-only guarantee.  There is
> no guarantee that you can do exactly the same twice, without a reset
> inbetween.
> 
> Yes, I agree, it will just work in most of the cases.  But this is
> _not_ guaranteed, and we should at least warn potential users of such
> methods that they really have to understand _exactly_ what they are
> doing, and even if it's working now it may be broken in the next
> version of U-Boot.
> 
> > (on an OT note, I'd even say that a SPL-supported U-Bot which cannot
> > chainload itself probably does not completely and/or properly reset the
> > hardware into booting condition, but that's slightly beside the point.)
> 
> Not all hardware can be reset by software actions alone.  There are
> things like write-once registers.  Once written, you MUST perform a
> reset to write any different values.

All of the above is right: there is no 100% guarantee that this will
work, not even "close-enough" guarantee; and yes, there is hardware out
there that is write-once-per-power-cycle, which may or may not prevent
resetting it to a known state.

> > Maybe we could add an addendum to the FAQ for the SPL and ROM bootloader
> > cases?
> 
> It's a wiki, all contributions are welcome.

OK -- I was not so much asking for someone to do it than asking whether
the general direction of the proposed edit would be fine. :)

> Best regards,
> 
> Wolfgang Denk

Amicalement,
-- 
Albert.

      reply	other threads:[~2015-07-10  8:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-07 22:05 [U-Boot] hang: ARM64/Relocating u-boot from u-boot Jagan Teki
2015-07-07 22:36 ` Wolfgang Denk
2015-07-08  6:46   ` Albert ARIBAUD
2015-07-09 19:52     ` Jagan Teki
2015-07-09 20:40       ` Wolfgang Denk
2015-07-09 20:38     ` Wolfgang Denk
2015-07-10  8:48       ` Albert ARIBAUD [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=20150710104842.1caa156e@lilith \
    --to=albert.u.boot@aribaud.net \
    --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