From owner-freebsd-ppc@freebsd.org Sun Jun 26 23:22:51 2016 Return-Path: Delivered-To: freebsd-ppc@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F835B80CAA for ; Sun, 26 Jun 2016 23:22:51 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-211-153.reflexion.net [208.70.211.153]) (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 361E32FA2 for ; Sun, 26 Jun 2016 23:22:50 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 3193 invoked from network); 26 Jun 2016 23:23:20 -0000 Received: from unknown (HELO mail-cs-01.app.dca.reflexion.local) (10.81.19.1) by 0 (rfx-qmail) with SMTP; 26 Jun 2016 23:23:20 -0000 Received: by mail-cs-01.app.dca.reflexion.local (Reflexion email security v7.90.3) with SMTP; Sun, 26 Jun 2016 19:23:29 -0400 (EDT) Received: (qmail 28097 invoked from network); 26 Jun 2016 23:23:28 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 26 Jun 2016 23:23:28 -0000 X-No-Relay: not in my network Received: from [192.168.0.105] (ip70-189-131-151.lv.lv.cox.net [70.189.131.151]) by iron2.pdx.net (Postfix) with ESMTPSA id 2CE1CB1E001 for ; Sun, 26 Jun 2016 16:22:38 -0700 (PDT) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Re: svn commit: r302214 - head/sys/powerpc/aim [my PowerMac G5 testing delayed] Message-Id: Date: Sun, 26 Jun 2016 16:22:41 -0700 To: FreeBSD PowerPC ML Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) X-Mailer: Apple Mail (2.3124) X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jun 2016 23:22:51 -0000 Quoting: > Author: nwhitehorn > Date: Sun Jun 26 18:43:42 2016 > New Revision: 302214 > URL:=20 > https://svnweb.freebsd.org/changeset/base/302214 >=20 >=20 > Log: > Enter 64-bit mode as early as possible in the 64-bit PowerPC boot = sequence. > Most of the effect of setting MSR[SF] is that the CPU will stop = ignoring > the high 32 bits of registers containing addresses in load/store > instructions. As such, the kernel was setting it only when it began = to > need access to high memory. MSR[SF] also affects the operation of = some > conditional instructions, however, and so setting it at late times = could > subtly break code at very early times. This fixes use of the FDT = mode in > loader, and FDT boot more generally, on 64-bit PowerPC systems. > =20 > Hardware provided by: IBM LTC > Approved by: re (kib) >=20 > Modified: > head/sys/powerpc/aim/aim_machdep.c > head/sys/powerpc/aim/locore64.S Usually I would test a couple of powerpc64 capable PowerMacs (a = so-called "Quad Core" one and a Dual Processor, single core per = processor, one) for if this changes the boot behavior noticeably for = them. But it will likely be a couple of months or more before I again = have access to them. Hopefully others will happen to test such examples = before then. Context note for PowerMacs used under powerpc64 FreeBSD: When I boot a powerpc64 PowerMac with a FreeBSD for powerpc64 I normally = run with a personal PowerMac specific change to allow reliable booting, = even when there is lots of RAM (8G, 12G, or 16G). The change is tied to = the transitions into and out of Apple's OpenFirmware and I observed it = to avoid memory trashing that I had observed otherwise. When I made this change I effectively eliminated just one instruction = from ofw_sprg_prepare(void): I went for the smallest generated-code = change that made the booting reliable on the PowerMac's that I commonly = have access to. The below just eliminates the pair: "mtsprg0 %1\n\t" and "r"(ofmsr[1]),=20 # svnlite diff /usr/src/sys/powerpc/ofw/ofw_machdep.c=20 Index: /usr/src/sys/powerpc/ofw/ofw_machdep.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- /usr/src/sys/powerpc/ofw/ofw_machdep.c (revision 302180) +++ /usr/src/sys/powerpc/ofw/ofw_machdep.c (working copy) @@ -111,6 +111,24 @@ * Assume that interrupt are disabled at this point, or * SPRG1-3 could be trashed */ +#if defined(AIM) && defined(__powerpc64__) +/* HACK: PowerMac G5 specific code to avoid demonstrated hangs in + * the early boot time frame: avoid mtsprg0 use. + * This would need a live test for PowerMac vs. not in order + * to remove HACK status --but without calling into + * OpenFirmware or the problem would be recreated. + */ + if (1) + __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])); + else +#endif __asm __volatile("mfsprg0 %0\n\t" "mtsprg0 %1\n\t" "mtsprg1 %2\n\t" I did not change the mfsprg0 nor did I change ofw_sprg_restore(void): = the booting was reliable without any change for those. [I do have access to my sources even though I do not have access to the = PowerMacs for a while.] =3D=3D=3D Mark Millard markmi at dsl-only.net