use of BAT before taking over the MMU

Segher Boessenkool segher at kernel.crashing.org
Wed Oct 6 02:31:46 EST 2010


>>> The PowerPC OF binding requires the firmware to save and restore
>>> the BATs on entry to / exit from the firmware.
>
> That would defeat the purpose of setting them.
> They are used to provide Linux with mappings.

The initial state the OS has for the BATs is what the firmware
provides it with, sure.

An OS shouldn't expect to have more than its own program image
RAM mapped, in general.

> 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 ;-)

> 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.

> 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.  You have to switch
a lot of other registers there as well already, so that's no
big deal.


Segher



More information about the Linuxppc-dev mailing list