Page MenuHomeFreeBSD

[PowerPC] Fix translation-related crashes during startup
ClosedPublic

Authored by bdragon on Jul 2 2020, 5:02 AM.
Referenced Files
F81662489: D25547.id74011.diff
Fri, Apr 19, 3:26 PM
Unknown Object (File)
Fri, Apr 12, 6:47 AM
Unknown Object (File)
Jan 7 2024, 2:58 PM
Unknown Object (File)
Dec 20 2023, 4:34 AM
Unknown Object (File)
Dec 14 2023, 10:02 PM
Unknown Object (File)
Nov 26 2023, 8:32 PM
Unknown Object (File)
Nov 25 2023, 12:54 AM
Unknown Object (File)
Nov 9 2023, 6:21 PM

Details

Summary

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.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped