public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: linux-sh@vger.kernel.org
Subject: Re: ioremap() on SH
Date: Thu, 14 Feb 2008 17:09:15 +0000	[thread overview]
Message-ID: <20080214170915.GA17023@linux-sh.org> (raw)
In-Reply-To: <cda58cb80802140636i69449582v6ecc03449df46b02@mail.gmail.com>

On Thu, Feb 14, 2008 at 05:42:32PM +0100, Franck Bui-Huu wrote:
> On Thu 14/02 23:57, Paul Mundt wrote:
> > On Thu, Feb 14, 2008 at 03:36:31PM +0100, Franck Bui-Huu wrote:
> > In 29-bit physical mode, there is no real differentiation. P1 and P2 are
> > both non-translatable sections that refer to the low 512M (P1 is cached,
> > and P2 is uncached). If you're using the MIPS terminology, these are
> > KSEG0 and KSEG1 respectively. In the nommu context the logic is
> > simplified since we don't really have that sort of segmentation, so
> > there's still a direct 1:1 correlation between physical and virtual there
> > also. Thus, we can take a P2 address with a cached remap and hand back
> > the P1 equivalent, and vice versa for cached->uncached transitions.
> 
> What does PXSEG(offset) mean if 'offset' is a physical address ?
> 
> From my understanding this macro used to retreive a *virtual* address
> segment from a *virtual* address. However PXSEG(offset) retrieves the
> *virtual* address segment from a *physical* address which seems a no
> sense.
> 
You've apparently neglected the importance of the term "non-translatable"
as was mentioned above. There is a 1:1 correlation here in the low-512MB.
P1 and P2 are _fixed_, you only have virtual<->physical translations in
P3/P0(U0), and occasionally P4. Otherwise it is only the cacheability of
the mapping that matters, which is determined by whether you access it as
a P1 or P2 address. As should be apparent, we do not take page faults for
non-translatable areas.

> Why doing the following test "PXSEG(offset) < P3SEG" where P3SEG yields
> to 0xc0000000. If offset is 0xa0000000 for example, assuming that 32 bits
> physical mode exists, what's ioremap returning ?
> 
0xa000000 is the P2 base, which is the uncached start. In this case
PXSEG(0xa0000000) = 0xa0000000, so it depends on what you specify as the
ioremap flags. If you want a cacheable mapping, you will get back
0x80000000 which is the cached equivalent of that address. If you want it
uncached, you will get back 0xa0000000. 0x80000000 and 0xa0000000 point
at exactly the same thing, just with different caching attributes.

If you wanted to do a dumb ioremap that assumed you always wanted
uncached and didn't try to deal with the special cases where we need page
table mappings, your ioremap would just be a wrapper to P2SEGADDR, and
this is in fact what we used to have.

  parent reply	other threads:[~2008-02-14 17:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-14 14:36 ioremap() on SH Franck Bui-Huu
2008-02-14 14:57 ` Paul Mundt
2008-02-14 16:42 ` Franck Bui-Huu
2008-02-14 17:09 ` Paul Mundt [this message]
2008-02-14 19:39 ` Franck Bui-Huu
2008-02-15 13:15 ` Stuart MENEFY
2008-02-15 21:12 ` Franck Bui-Huu
2008-02-18 13:44 ` Stuart MENEFY

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=20080214170915.GA17023@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=linux-sh@vger.kernel.org \
    /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