From: "Grant Likely" <grant.likely@secretlab.ca>
To: "Kumar Gala" <galak@kernel.crashing.org>
Cc: miltonm@bga.com, linuxppc-dev@ozlabs.org, paulus@samba.org,
scottwood@freescale.com
Subject: Re: [RFC/PATCH v2] powerpc: add ioremap_early() function for mapping IO regions before MMU_init()
Date: Thu, 14 Aug 2008 14:40:15 -0600 [thread overview]
Message-ID: <fa686aa40808141340o42250512nd2d34ee3a5f37a10@mail.gmail.com> (raw)
In-Reply-To: <4A0D4C49-48F8-4E0D-9C42-EB0503EA4BCB@kernel.crashing.org>
On Thu, Aug 14, 2008 at 1:59 PM, Kumar Gala <galak@kernel.crashing.org> wrote:
>
> On Aug 14, 2008, at 11:43 AM, Grant Likely wrote:
>
>> On Thu, Aug 14, 2008 at 10:24 AM, Kumar Gala <galak@kernel.crashing.org>
>> wrote:
>>>>>
>>>>> what happens if we run out of bats?
>>>>
>>>> Then it returns NULL and the caller must handle it. The board port
>>>> maintainer needs understand the board/CPU/SoC and not depend on more
>>>> BATs than are available. They also need to understand that there is a
>>>> tradeoff between BATs for IO and BATs for RAM. If the board port uses
>>>> up all the BATs for IO, then RAM above 256MB ends up getting mapped
>>>> with PTEs and there is a performance hit. My expectation is that only
>>>> platform code will use this facility. Device drivers should continue
>>>> to use ioremap() and will gain the benefit of the BATs if platform
>>>> code already set them up. I can add some text to the documentation to
>>>> describe this.
>>>>
>>>> I'm not going to make any attempt to fallback to PTEs for IO when
>>>> there isn't enough BATs. Doing so adds an order of magnitude more
>>>> complexity.
>>>
>>> that's fine.. I just didn't look at setbat() to see it errors out.
>>>
>>> Also can we get rid of LOAD_BAT in head_32.S?
>>
>> Mostly. It is still needed for BAT0 when setting up RAM, but the rest
>> of it can be dumped.
>
> Can we not do BAT0 in C code?
Not easily. Currently BAT0 gives us the first 16M of RAM during early
boot. The new code protects BAT0 and makes sure it can only be used
for mapping RAM. If it got chosen for an IO mapping, then it would
get blown away immediately and the kernel would crash. Its okay for
BAT0 to be used for RAM because RAM doesn't need to be immediately
mapped. It can wait just setup the data and wait for LOAD_BAT to fix
it up.
An alternate solution is to reserve a second BAT higher up to use as
the 'real' RAM mapping so that 'real' mapping of RAM could be
performed immediately while leaving the old one intact. That would
eliminate the need for LOAD_BAT, but it also leaves only 2 BAT slots
available for IO and memory above 256M. On the other hand, it might
be okay to release the reserved BATs after the first real RAM mapping
is established, but doing so adds some complexity to the handling of
__map_without_bats because the initial mapping still needs to be
disabled in head_32.S.
g.
prev parent reply other threads:[~2008-08-14 20:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-13 3:03 [RFC/PATCH v2] powerpc: add ioremap_early() function for mapping IO regions before MMU_init() Grant Likely
2008-08-14 13:00 ` Kumar Gala
2008-08-14 15:00 ` Grant Likely
2008-08-14 16:24 ` Kumar Gala
2008-08-14 16:43 ` Grant Likely
2008-08-14 19:59 ` Kumar Gala
2008-08-14 20:40 ` Grant Likely [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=fa686aa40808141340o42250512nd2d34ee3a5f37a10@mail.gmail.com \
--to=grant.likely@secretlab.ca \
--cc=galak@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=miltonm@bga.com \
--cc=paulus@samba.org \
--cc=scottwood@freescale.com \
/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;
as well as URLs for NNTP newsgroup(s).