From owner-freebsd-ppc@freebsd.org Sun Jun 26 23:38:36 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 0F41AB80EB3 for ; Sun, 26 Jun 2016 23:38:36 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from d.mail.sonic.net (d.mail.sonic.net [64.142.111.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D90B724F0 for ; Sun, 26 Jun 2016 23:38:35 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from comporellon.tachypleus.net (75-101-50-44.static.sonic.net [75.101.50.44]) (authenticated bits=0) by d.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id u5QNcWKu015602 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Sun, 26 Jun 2016 16:38:33 -0700 Subject: Re: svn commit: r302214 - head/sys/powerpc/aim [my PowerMac G5 testing delayed] To: freebsd-ppc@freebsd.org References: From: Nathan Whitehorn Message-ID: <57706778.9060604@freebsd.org> Date: Sun, 26 Jun 2016 16:38:32 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Sonic-CAuth: UmFuZG9tSVYDVS1tSfqyAvwGCZXi/2g2IGDDDIFzfYr3WV4IA27rJIn1il+rTcUlWnVrfQvBXYnBF2X2f7HbJqv44Wc4kWD/p70v6lTupZQ= X-Sonic-ID: C;POIIGPc75hGEuZNwxPCmMQ== M;yklKGPc75hGEuZNwxPCmMQ== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd 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:38:36 -0000 On 06/26/16 16:22, Mark Millard wrote: > Quoting: > >> Author: nwhitehorn >> Date: Sun Jun 26 18:43:42 2016 >> New Revision: 302214 >> URL: >> https://svnweb.freebsd.org/changeset/base/302214 >> >> >> 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. >> >> Hardware provided by: IBM LTC >> Approved by: re (kib) >> >> 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]), Those might be fixed with this change. Your patch (not restoring OF's SPRG0) will break a lot of Apple hardware. It's also not clear to me why it would do anything: it replaces firmware's SPRG0 with FreeBSD's SPRG0, trashing firmware state if it uses the register, in a situation (interrupts off) in which FreeBSD never uses SPRG0 either. As such, I would assume you are exposing another problem (maybe the one fixed in this commit). One thing it would be great to have some testing on after this change is the FDT layer in loader. If you set usefdt=1 from the loader prompt, loader will distill the OF device tree into an FDT and then stop Open Firmware completely before transferring control to FreeBSD. This should avoid any possible problems accessing Open Firmware from the kernel, as well as making boot a little faster. -Nathan