mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: ARM, MMU and IO space mapping
Date: Mon, 28 Nov 2011 18:43:06 +0100	[thread overview]
Message-ID: <87d3cc87o5.fsf@free.fr> (raw)
In-Reply-To: <20111128074319.GO27267@pengutronix.de> (Sascha Hauer's message of "Mon, 28 Nov 2011 08:43:19 +0100")

Sascha Hauer <s.hauer@pengutronix.de> writes:

> That's why I had to disable this mapping. Most other SoCs do not have
> flash on 0x0. The i.MX processors for example have their internal ROM
> there.
Ah, I see.

>> And as a consequence, I'm a bit afraid that my disk-on-chip, having it's memory
>> mapped to 0x0 - 0x2000, will be difficult to convert ... I must think of a way
>> in there.
>
> Your options are:
>
> - Add some switch to disable the 0x0 mapping.
> - Add ioremap support.
>
> I think we should go for the former for now. Real ioremap support
> requires more thinking about how we want to do it. Will all drivers have
> to do it or only the cfi driver?
I think that only cfi and disk-on-chips drivers will have that problem, as being
mapped (from an memory bus address POV) to address 0 is bound to boot code,
which relies on some kind of memory (ROM, flash, ...).

And disabling 0x0 mapping will make the MMU booting quite fragile IMHO.
Consider the following example:
 - a flash/ROM is mapped at address 0 for booting the ARM SoC
 - as requested by ARM, the first words of the flash are the vectors, with the
 first one being the reset vector into a code that is supposed to run in a
 *non-MMU* context
 - the ARM core starts, and IPL is loaded
 - IPL loads SPL (barebox)
 - barebox remaps 0x0 to vectors at malloc'd 0xa0003f00 (former solution)
 - barebox switches into MMU on
 - a bug happens in barebox (urgh!!!) and the exception vector is triggered
 ===> here, the flash/ROM vector is used
 ===> this vectors assumes running from MMU-disabled environment
 - the code running in the IPL triggers an exception because it's in MMU
 environment
  => eternal cycle begins

I think either :
 - we implement ioremap
 - or we forbid (on ARM) MMU with board requiring 0x0 iomapped device

I would prefer a simple ioremap solution of the like:
 - a mach-XXX declares an adress-space for io-remapping (contiguous, section
 aligned and of size multiple of 1MBytes)
   => if not => MMU config is not possible
             => ioremap() gives back the flat physical address
   => if yes => MMU config is possible
             => ioremap() gives back an entry in io-remapping address space
 - ioremap() is embedded in dev_request_mem_region()

What do you think ?

>> I don't know either. All I see is that the datacache is filled so that stale
>> values are flushed out, and then it's flushed again through normal coproc
>> operations.
>> Note that there's an erratum in the XScale series that says that turning off the
>> cache leaves "dirty bits" set, and reenabling it later might cause havoc. That
>> would be a good reason for UBoot the read the 64kb before turning off the MMU,
>> wouldn't it ?
>
> Yes, it would. Does your first stage loader use the MMU?
Well, when barebox is stable enough for me, no.
For now, the answer will be yes, as barebox will be the TPL:
 - IPL load SPL, which is a proprietary bootloader
   => IPL runs in non-MMU mode
 - SPL loads the TPL (third program loader), which is barebox
   => SPL uses MMU
I need the IPL/SPL/TPL, as if there is any problem with barebox, the current SPL
is stable and will enable me to reflash the TPL (ie. barebox). I have no JTAG
access by now to my board, so I cannot afford loosing the security of the SPL.

When my barebox will be stable enough, and I'll be bold enough, I'll replace the
SPL with barebox :)

Cheers.

-- 
Robert

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2011-11-28 17:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-24 11:24 Robert Jarzmik
2011-11-24 12:04 ` Sascha Hauer
2011-11-24 14:23   ` Marc Kleine-Budde
2011-11-24 20:09   ` Robert Jarzmik
2011-11-24 20:25     ` Marc Kleine-Budde
2011-11-25  0:01     ` Sascha Hauer
2011-11-27 22:30       ` Robert Jarzmik
2011-11-28  7:43         ` Sascha Hauer
2011-11-28 17:43           ` Robert Jarzmik [this message]
2011-11-29  8:15             ` Sascha Hauer
2011-11-30 22:06               ` Robert Jarzmik
2011-12-01 14:26                 ` Sascha Hauer
2011-12-01 14:34                   ` Marc Kleine-Budde
2011-12-11 13:01                   ` Robert Jarzmik

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=87d3cc87o5.fsf@free.fr \
    --to=robert.jarzmik@free.fr \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.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