Why official powerpc64 FreeBSD's PowerMac G5 booting sometimes works and sometimes hangs

Mark Millard markmi at dsl-only.net
Mon Mar 2 22:49:25 UTC 2015


Various PowerMac G5 configurations have variable behavior when booting: sometimes hanging up and other times booting fine. This is one of the things that any proposed fix had to be able to explain beyond just seeming to work: How does the fix remove a source of uncontrolled variability? Just what is varying that is to be avoided?

Sometimes ofmsr on the PowerMac G5 Quad-Core that I most frequently use looks like (ofmsr addresses specific to my build of the time):

(kgdb) x/5gx 0xc3b328
0xc3b328 <ofmsr>:	0x1000000000003030 0x0000000000000001
0xc3b338 <ofmsr+16>:	0x0000000001c35ec0 0x0000000000000000
0xc3b348 <ofmsr+32>:	0x000000007ff7e800

So ofmsr[1]==1. Other times ofmsr for the same build looks like:

(kgdb) x/5gx 0xc3b328
0xc3b328 <ofmsr>:	0x1000000000003030 0x0000000000000000
0xc3b338 <ofmsr+16>:	0x0000000001c35ec0 0x0000000000000000
0xc3b348 <ofmsr+32>:	0x000000007ff7e800

So ofwmsr[1]==0.

So far I've not observed any other ofmsr[1] values. I'll keep monitoring for a while. 

ofmsr[1] is the source of the boot-to-boot variability in what is copied to SPRG0 before ofwcall in official FreeBSD powerpc64 builds for my testing contexts. This copy to SPRG0 happens via openfirmware_core and its use of ofw_sprg_prepare.

Leaving the FreeBSD SPRG0 value in place (ignoring ofwmsr[1]) when preparing to call  ofwcall sidesteps this particular uncontrolled variability. The result is highly reliable booting for the G5's I'm testing on: no hangs so far.

Thus instead of:

	__asm __volatile("mfsprg0 %0\n\t"
			 "mtsprg0 %1\n\t"
			 "mtsprg1 %2\n\t"
			 "mtsprg2 %3\n\t"
			 "mtsprg3 %4\n\t"
			 : "=&r"(ofw_sprg0_save)
			 : "r"(ofmsr[1]),
			 "r"(ofmsr[2]),
			 "r"(ofmsr[3]),
			 "r"(ofmsr[4]));

in my builds I'm using code that does:

	__asm __volatile("mfsprg0 %0\n\t"
			 "mtsprg1 %1\n\t"
			 "mtsprg2 %2\n\t"
			 "mtsprg3 %3\n\t"
			 : "=&r"(ofw_sprg0_save)
			 : "r"(ofmsr[2]),
			 "r"(ofmsr[3]),
			 "r"(ofmsr[4]));


===
Mark Millard
markmi at dsl-only.net




More information about the freebsd-ppc mailing list