]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r364447:
authorBrandon Bergren <bdragon@FreeBSD.org>
Fri, 21 Aug 2020 03:31:01 +0000 (03:31 +0000)
committerBrandon Bergren <bdragon@FreeBSD.org>
Fri, 25 Dec 2020 21:00:51 +0000 (15:00 -0600)
commit2ca7f72fee3cffa0cc366c1db69199b436f2e908
treeda54c61fcefaa3516bdf19906e9df321639e00fc
parentefc7664f9ba1322ab5ba47a1a64e29fa661021ed
MFC r364447:

[PowerPC] Fix translation-related crashes during startup

After spending a lot of time trying to track down what was going on, I have
isolated the "black screen" failures when using boot1 to boot a G4 machine.

It turns out we were replacing the traps before installing the temporary
BAT entry for the bottom of physical memory. That meant that until the MMU
was bootstrapped, the cached translations were the only thing keeping us
from losing.

Throwing boot1 into the mix was affecting execution flow enough to cause us
to hit an uncached page and crash.

Fix this by properly setting up the initial BAT entry at the same time we
are replacing the OpenFirmware traps, so we can continue executing in
segment 0 until the rest of the DMAP has been set up.

A second thing discovered while researching this is that we were entering a
BAT region for segment 16. It turns out this range was a) considered part
of KVA, and b) has firmware mappings with varying attributes.

If we ever accessed an unmapped page in segment 16, it would cause a BAT
entry to be installed for the whole segment, which would bypass the
existing mappings until it was flushed out again.

Instead, translate the OFW memory attributes into VM memory attributes and
install the ranges into the kernel address space properly.

Reviewed by: adalava
MFC after: 3 weeks
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D25547

(cherry picked from commit f10baa404986adb5733fd5745d467a8f69409ce3)
sys/powerpc/aim/aim_machdep.c
sys/powerpc/aim/mmu_oea.c