From owner-freebsd-ppc@FreeBSD.ORG Mon Mar 2 22:49:24 2015 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E9BDF904 for ; Mon, 2 Mar 2015 22:49:24 +0000 (UTC) Received: from asp.reflexion.net (outbound-242.asp.reflexion.net [69.84.129.242]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B49D329 for ; Mon, 2 Mar 2015 22:49:24 +0000 (UTC) Received: (qmail 6945 invoked from network); 2 Mar 2015 22:49:22 -0000 Received: from unknown (HELO mail-cs-01.app.dca.reflexion.local) (10.81.19.1) by 0 (rfx-qmail) with SMTP; 2 Mar 2015 22:49:22 -0000 Received: by mail-cs-01.app.dca.reflexion.local (Reflexion email security v7.40.1) with SMTP; Mon, 02 Mar 2015 17:49:22 -0500 (EST) Received: (qmail 22890 invoked from network); 2 Mar 2015 22:49:22 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (DHE-RSA-AES256-SHA encrypted) SMTP; 2 Mar 2015 22:49:22 -0000 X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network Received: from [192.168.1.8] (c-67-189-19-145.hsd1.or.comcast.net [67.189.19.145]) by iron2.pdx.net (Postfix) with ESMTPSA id 5D9AE1C405E; Mon, 2 Mar 2015 14:49:17 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Subject: Why official powerpc64 FreeBSD's PowerMac G5 booting sometimes works and sometimes hangs From: Mark Millard In-Reply-To: Date: Mon, 2 Mar 2015 14:49:20 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <21F3006A-19DA-44F7-8F37-F5FFE8555715@dsl-only.net> References: To: FreeBSD PowerPC ML , Nathan Whitehorn , Justin Hibbits X-Mailer: Apple Mail (2.2070.6) X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Mar 2015 22:49:25 -0000 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 : 0x1000000000003030 0x0000000000000001 0xc3b338 : 0x0000000001c35ec0 0x0000000000000000 0xc3b348 : 0x000000007ff7e800 So ofmsr[1]=3D=3D1. Other times ofmsr for the same build looks like: (kgdb) x/5gx 0xc3b328 0xc3b328 : 0x1000000000003030 0x0000000000000000 0xc3b338 : 0x0000000001c35ec0 0x0000000000000000 0xc3b348 : 0x000000007ff7e800 So ofwmsr[1]=3D=3D0. So far I've not observed any other ofmsr[1] values. I'll keep monitoring = for a while.=20 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" : "=3D&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" : "=3D&r"(ofw_sprg0_save) : "r"(ofmsr[2]), "r"(ofmsr[3]), "r"(ofmsr[4])); =3D=3D=3D Mark Millard markmi at dsl-only.net