Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jun 2016 16:38:32 -0700
From:      Nathan Whitehorn <nwhitehorn@freebsd.org>
To:        freebsd-ppc@freebsd.org
Subject:   Re: svn commit: r302214 - head/sys/powerpc/aim [my PowerMac G5 testing delayed]
Message-ID:  <57706778.9060604@freebsd.org>
In-Reply-To: <B2997643-4FB3-43AF-8942-61E6E4DB2ACF@dsl-only.net>
References:  <B2997643-4FB3-43AF-8942-61E6E4DB2ACF@dsl-only.net>

next in thread | previous in thread | raw e-mail | index | archive | help


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?57706778.9060604>