All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cort Dougan <cort@fsmlabs.com>
To: Benjamin Herrenschmidt <bh40@calva.net>
Cc: linuxppc-dev@lists.linuxppc.org, paulus@linuxcare.com
Subject: Re: bootloader & head.S weirdness
Date: Mon, 22 Nov 1999 14:37:32 -0700	[thread overview]
Message-ID: <19991122143732.B12973@hq.fsmlabs.com> (raw)
In-Reply-To: <19991122120429.031138@mailhost.mipsys.com>; from Benjamin Herrenschmidt on Mon, Nov 22, 1999 at 12:04:29PM +0100


Not always.  Keep in mind we have several machine types that follow the
same patch there.  We don't always enter with OF and OF doesn't always give
1:1 mappings, either.

} The kernel enters from OF, with the MMU in whatever state OF set it and
} the guarantee that at least it's mapped 1:1 with some memory (1Mb) also
} mapped just after it so that it can expand itself. This guarantees are
} the responsibility of the bootloader.

I don't care for it much but it gives us a foothold and OF doesn't seem to
use bat1 ever...

} At this point, it hacks a BAT to map the first 16Mb of memory to
} KERNELBASE. That I don't like since it means playing with mapping of
} potentially running code with MMU enabled (and you don't know if OF
} didn't use a BAT itself for mappping the RAM you are running from, future

Not dependent on the bootloader, just dependent on the current running
address and whether MSR_DR is set in the MSR or not.

} OF versions may do). It will then do all sort of weird guesses depending
} on the bootloader to know if it must translate or not the source address,
} do the copy and flush (which will usually default catch to OF with my
} bootloader, depending on where I loaded the kernel, etc...)

at 0x10000 on chrp when running quik.

} Quik tries to load the kernel at 0, which avoids most of those head.S
} issues, but the way it does is broken, since OF won't allow to CLAIM
} memory from 0 (at least not on my machine), that means potentially
} overriding bits of OF (I know OF tends to use high memory, but OF low
} memory vectors are still needed, at least on 603 for prom_entry to work).

We only do that after we've called prom_entry() for the last time, though.

} Also, the bootloader can't turn MMU off and clean TLB & BATs since
} prom_entry must have the correct OF mappings in order to work.
} 
} Instead of trying to find out the magical address to load the kernel,
} potentially breaking with future OF versions, and hacks like that, I
} finally decided to give a try at fixing head.S (I'm still using 2.2.x
} kernels, I beleive head.S did change with 2.3.x, I'll look into this later).
} 
} Basically, what I'm doing is, after bl prom_entry, and before filling the
} BAT, I turn the MMU off, clear all bats (in a 601-compatible way unlike
} the current kernel source tree), flush TLBs, and then continue to the
} code that sets up the BAT and moves down the kernel to 0. I also had to
} comment out the code that translates the source address on CHRP.

That's a good way to do it but shutting it down isn't always that easy.  On
some PReP's (the IBM 830 I think) we come into the kernel with MSR_IR on
and MSR_DR off and we're running with some odd I mappings (not D mappings, though).

} I'll post a patch later today, but I wanted to know if my way of doing
} things is broken or will break CHRP machines or not. Basically, I feel
} the "good way" is to shut down the MMU upon exit from prom_entry, and
} then play with BATs, copy&flush, etc...

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

  reply	other threads:[~1999-11-22 21:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-22 11:04 bootloader & head.S weirdness Benjamin Herrenschmidt
1999-11-22 21:37 ` Cort Dougan [this message]
1999-11-22 23:17   ` bootloader & head.S weirdness & restructuring Christian Zankel
1999-11-22 23:55     ` Cort Dougan
1999-11-23  3:31       ` Christian Zankel
1999-11-23  3:40         ` Cort Dougan
1999-11-23  6:37           ` Dan Malek
1999-11-23 18:22             ` Christian Zankel
1999-11-23 20:20               ` Dan Malek
1999-11-25 17:13                 ` Geert Uytterhoeven
1999-11-25 19:49                   ` Dan Malek
1999-11-26  9:06                     ` Geert Uytterhoeven
1999-11-26  9:42                       ` Michael Schmitz
1999-11-26 12:06                         ` Wolfgang Denk
1999-11-28 22:41                       ` Dan Malek
1999-11-29  7:12                         ` Geert Uytterhoeven
1999-11-23 16:12       ` Michael Schmitz
1999-11-23 16:17       ` David Edelsohn
1999-11-23 17:46         ` Cort Dougan
1999-11-23 16:15     ` Gabriel Paubert
1999-11-23 16:52       ` Marcus Sundberg
1999-11-23 17:01         ` Gabriel Paubert
1999-11-23 17:45           ` Cort Dougan
1999-11-23 10:35   ` bootloader & head.S weirdness Benjamin Herrenschmidt
1999-11-23 10:50     ` Momchil Velikov

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=19991122143732.B12973@hq.fsmlabs.com \
    --to=cort@fsmlabs.com \
    --cc=bh40@calva.net \
    --cc=linuxppc-dev@lists.linuxppc.org \
    --cc=paulus@linuxcare.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.