public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] atngw100: Use virtual address in CONFIG_ENV_ADDR
Date: Sun, 30 Aug 2009 22:42:18 +0200	[thread overview]
Message-ID: <20090830224218.10f14dc4@siona> (raw)
In-Reply-To: <20090830181101.23C3A833DBD2@gemini.denx.de>

On Sun, 30 Aug 2009 20:11:01 +0200
Wolfgang Denk <wd@denx.de> wrote:

> Dear Haavard & Becky,
> 
> In message <20090830173640.2af9ce3c@siona> you wrote:
> >
> > >  The only way for that to work
> > > is when VA=PA (or, depending on what you were doing with the
> > > address,
> 
> Well, VA==PA is the default setting for U-Boot that shall be used for
> all systems, unless it is really impossible on a board to implement an
> exception from that rule.

While not impossible, following that rule on the NGW100 would require
that I either disable the caches (which would result in a massive
slowdown) or start using the MMU more actively to get the caching
properties right.

> > > you just got lucky).  The CFI driver was the outlier - all the
> > > other flash code was treating the start field as a VA already.
> > > So I don't think just  reverting the patch is the answer.
> 
> We did not even have any notion of VA's in U-Boot until very
> recently, and I call on everybody not to make U-Boot more complicated
> than necessary.

I don't think any boards with PA==VA are affected. This issue is about
two platforms with VA!=PA following different rules...

> In almost all cases RAM and NOR flash fit easily in the physical
> address space of the CPUs, and for the sake of this majority of
> systems it must be possible to access memory on such systems assuming
> a simple 1:1 mapping.

You're ignoring cache issues.

> Any changes to the code to correctly support other mappings must be
> done in a way that they (1) do not break and (2) do not add additional
> burdon on systems with a simple 1:1 mapping.

That was the idea when I introduced map_physmem() to the CFI driver a
while back: the externally visible addresses were kept unchanged, while
the remapping was done internally. Also, map_physmem() is a no-op on
platforms with a simple 1:1 mapping.

> > >  If you use something to do memory accesses, it's virtual.
> 
> Unless you have a very special system you can rely on a strict 1:1
> mapping.

Technically, the addresses seen by the CPU are virtual. And I don't
think systems with a cache should be considered 'very special' these
days...

> > There are basically two ways to fix it: Either go back to using
> > physical addresses in the flash API, or make CONFIG_ENV_ADDR virtual
> 
> I understand we cannot do that, because some systems need to map (NOR)
> flash to virtual addresses outside the physical address space. Ok, so
> the CFI driver shall consistently be able to use VAs - but on simple
> systems with a 1:1 mapping there shall be no need in the system
> configuration to spend any thoughts on this.

But exactly what's wrong with hiding all this complexity inside
map_physmem()? It was designed _exactly_ for this purpose -- to allow
platforms with non-trivial mappings between VA and PA to do the
necessary mapping when the driver requests it.

> > (and from what I hear, the jffs2 code needs a similar fix.) This
> > patch does the latter, but it seems like it doesn't fix things
> > completely, and Wolfgang didn't appear very happy about it.
> 
> Indeed I'm deeply trouble when log standing rules get silently bent
> and even broken.

And I deeply regret using the CFI driver on NGW100...it took a lot of
effort to get it mostly limping along, and then it got broken at the
first opportunity. I should have stuck with the much smaller and more
efficient board-specific driver I had to begin with.

That PA==VA rule is pretty much the reason we're in this mess -- if
more platforms had broken this rule, perhaps more of the code would
have been written properly without lots of implicit conversion from PA
to VA via ugly casts between unsigned long and all sorts of pointers.

Haavard

  reply	other threads:[~2009-08-30 20:42 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-28  8:42 [U-Boot] [PATCH] atngw100: Use virtual address in CONFIG_ENV_ADDR Haavard Skinnemoen
2009-08-28  9:16 ` Mark Jackson
2009-08-28  9:34   ` Haavard Skinnemoen
2009-08-28 10:16     ` Mark Jackson
2009-08-28 10:27       ` Haavard Skinnemoen
2009-08-28 10:35         ` Mark Jackson
2009-08-28 11:58           ` Wolfgang Denk
2009-08-28 11:56 ` Wolfgang Denk
2009-08-28 12:14   ` Haavard Skinnemoen
2009-08-28 13:42     ` Kumar Gala
2009-08-28 13:49       ` Haavard Skinnemoen
2009-08-28 19:58         ` Becky Bruce
2009-08-29 11:39           ` Stefan Roese
2009-08-30 15:52             ` Haavard Skinnemoen
2009-08-30 15:36           ` Haavard Skinnemoen
2009-08-30 18:11             ` Wolfgang Denk
2009-08-30 20:42               ` Haavard Skinnemoen [this message]
2009-08-31 11:57                 ` Wolfgang Denk
2009-08-31 13:53                   ` Haavard Skinnemoen
2009-08-31 17:46                     ` Wolfgang Denk
2009-09-01  8:57                       ` Haavard Skinnemoen
2009-09-01  9:16                         ` Stefan Roese
2009-09-01 10:18                           ` Haavard Skinnemoen
2009-09-01  9:47                         ` Wolfgang Denk
2009-09-01 10:38                           ` Haavard Skinnemoen
2009-09-01 11:05                             ` Wolfgang Denk
2009-09-01 11:42                               ` Haavard Skinnemoen
2009-09-01 13:04                                 ` Wolfgang Denk
2009-09-01 13:23                                   ` Haavard Skinnemoen
2009-09-01 13:47                                     ` Wolfgang Denk
2009-09-01 13:52                                       ` Haavard Skinnemoen
2009-09-01 14:49                                     ` Thiago A. Corrêa
2009-09-01 15:20                                       ` Haavard Skinnemoen
2009-09-01 15:56                                         ` Mark Jackson
2009-09-01 17:50                                           ` [U-Boot] Virtual addresses, u-boot, and the MMU J. William Campbell
2009-09-01 19:21                                             ` Wolfgang Denk
2009-09-01 22:01                                               ` J. William Campbell
2009-09-02  7:59                                                 ` Wolfgang Denk
2009-09-03 16:09                                                   ` Becky Bruce
2009-09-03 17:25                                                     ` J. William Campbell
2009-09-03 17:32                                                     ` Andrew Dyer
2009-09-04  8:34                                                     ` Mark Jackson
2009-09-04  8:58                                                       ` Haavard Skinnemoen
2009-09-04  8:44                                                     ` Haavard Skinnemoen
2009-08-31 20:05                   ` [U-Boot] [PATCH] atngw100: Use virtual address in CONFIG_ENV_ADDR Becky Bruce
2009-09-01  9:15                     ` Haavard Skinnemoen
2009-08-31 19:17               ` Becky Bruce
2009-09-01 10:15                 ` Haavard Skinnemoen

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=20090830224218.10f14dc4@siona \
    --to=haavard.skinnemoen@atmel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox