From: Albert Cahalan <acahalan@gmail.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: use of BAT before taking over the MMU
Date: Wed, 6 Oct 2010 22:05:56 -0400 [thread overview]
Message-ID: <AANLkTikH-f7MCxVyWr_mrfzeooQwRqTf4pGVEFSLO4Zy@mail.gmail.com> (raw)
In-Reply-To: <B30ADD93-5210-4FFC-A7AA-C6B21A785B09@kernel.crashing.org>
On Tue, Oct 5, 2010 at 11:31 AM, Segher Boessenkool
<segher@kernel.crashing.org> wrote:
> An OS shouldn't expect to have more than its own program image
> RAM mapped, in general.
Linux actually makes calls to allocate more. I'm thankful
that Linux always specifies an address, so I was able to
get away with simply returning success. I wonder how this
works for a firmware implementation that resides in RAM,
using the memory that Linux demands. Must the firmware
move itself out of the way?
>> Of course that faults immediately, so I have a handler that
>> loads IBAT0 with a 128 KiB mapping. I treat the BAT like a
>> direct-mapped software-loaded TLB. (like MIPS arch MMU)
>
> Just map the first 256MB and don't worry about anything else?
> Seems a lot simpler to me ;-)
I was expecting that Linux would demand plenty of mappings,
including small ones and ones for IO. I was preparing myself
for that.
>> Note that Linux can fail even with a firmware that doesn't touch
>> the BAT registers. The MMU is on,
>
> You can boot Linux with the MMU off as well.
That wasn't obvious for the prom_init path. IEEE docs seemed
to suggest that the firmware must provide MMU handling.
>> and 0xc0000000 may be
>> where the firmware expects to have... MMIO for the console,
>> the client interface entry point, a forth stack, whatever.
>> The BAT takes priority, and thus the firmware splatters stuff
>> right onto the kernel or dies trying to read something it left there.
>
> Like I said, you're supposed to swap OS BATs with firmware BATs
> in your client interface entry and exit. =A0You have to switch
> a lot of other registers there as well already, so that's no
> big deal.
Well no. This isn't real hardware. My prom entry point looks
something like this:
eciwx r0,r0,r0
blr
My ISI and DSI handlers look something like this:
ecowx r0,r0,r0
rfi
The firmware doesn't need **any** registers. It's magic. I was
just using the BAT registers to map what Linux wanted mapped.
Anyway, I'm no longer able to reproduce the problem. I think
something unrelated was causing strange behavior. This is a
bit of a surprise since I would've expected a crash. Oh well.
next prev parent reply other threads:[~2010-10-07 2:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-02 18:32 use of BAT before taking over the MMU Albert Cahalan
2010-10-04 4:25 ` Segher Boessenkool
2010-10-04 16:06 ` Albert Cahalan
2010-10-05 7:54 ` Segher Boessenkool
2010-10-05 8:11 ` Benjamin Herrenschmidt
2010-10-05 8:10 ` Benjamin Herrenschmidt
2010-10-05 12:05 ` Albert Cahalan
2010-10-05 12:28 ` Benjamin Herrenschmidt
2010-10-05 15:31 ` Segher Boessenkool
2010-10-07 2:05 ` Albert Cahalan [this message]
2010-10-07 8:00 ` Benjamin Herrenschmidt
2010-10-05 15:22 ` Segher Boessenkool
2010-10-05 8:09 ` Benjamin Herrenschmidt
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=AANLkTikH-f7MCxVyWr_mrfzeooQwRqTf4pGVEFSLO4Zy@mail.gmail.com \
--to=acahalan@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=segher@kernel.crashing.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;
as well as URLs for NNTP newsgroup(s).