From owner-freebsd-ppc@freebsd.org Sun Sep 18 11:46:08 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 8E777BDFCCA for ; Sun, 18 Sep 2016 11:46:08 +0000 (UTC) (envelope-from jau789@gmail.com) Received: from mail-lf0-x242.google.com (mail-lf0-x242.google.com [IPv6:2a00:1450:4010:c07::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0F429D52 for ; Sun, 18 Sep 2016 11:46:08 +0000 (UTC) (envelope-from jau789@gmail.com) Received: by mail-lf0-x242.google.com with SMTP id s64so7031813lfs.2 for ; Sun, 18 Sep 2016 04:46:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=FQOFyLW3s4MFUIPmXwJiA3TLsewXKb4cJDe6W5S6HdU=; b=TU13LSUwIH8E8QiVXgnaS8NB/Z6lrq0WL+3/2L/lnVUa7fxb6Z1Nw0S4l8ysoSdJqc 6lbg+RjWDgxrdAcKzBz7w4dZ4thYT3e9a6TvtanC3q87JcT6wl2E7b5/Bh3tBObBu6tX k/PYty0Eb3CpfhT5+wOcaEZYd0lVpjhq0EXGu5/QrybyTdMGObSUk8w1bwqtAVf3v+yF Ibi1RCVSTlhoj1p9wixDNEjjWvyax/PmsBxsTO/YaPuR+E8fEjEiW9ddqw7GZlDkUb/Q smPDMjVg7VeBChgInYq+vQTdNRKfA5kbMrw0sEe2wTBe/oGRWxMIRLayMuOCtKQh4ssC 40ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=FQOFyLW3s4MFUIPmXwJiA3TLsewXKb4cJDe6W5S6HdU=; b=ic8lAG61LQT7jvi9HgOELhwc4T/HJrKHiuMwxcgmiY3CYcy/HQ+/66xR9ArmSltxn6 u7rIzrcKf9hrOenHiLp7Zp6kk2t7vQ24e+s0SeUx89i4L1tO3qviORH9fo23CHVl2uMe F/Mb5cuQ/YLOjTwgbN3Z5lRmUDyqRBsPo97M6YbB/40qoaBsd/Kaw4LkyQhTAPfdCPFU rzfXcuZri/j1zH3YgrjGU0BP/Rpxo2GYPHnB/1gBdUbYjna1hqAjY7ZXFVqZx7Ws0/zY vuwEI8K3WODPDCaYVR7bcJlgUqBPdhbcaRhKzz2Z09SqQRkKDC4+/uFQhoItFvmEEIja Jfdw== X-Gm-Message-State: AE9vXwP/fM7XgapKuTKDZRgg5qKMcUAHZfXsrr0SnHHX+LNZCzcajFJGRRbpebmyEWsSYQ== X-Received: by 10.46.1.42 with SMTP id 42mr9181455ljb.68.1474199164639; Sun, 18 Sep 2016 04:46:04 -0700 (PDT) Received: from [192.168.1.131] (xdsl-205-1.nblnetworks.fi. [83.145.205.1]) by smtp.googlemail.com with ESMTPSA id x14sm3863240lfa.4.2016.09.18.04.46.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Sep 2016 04:46:04 -0700 (PDT) Subject: Re: [Bug 205458] 11.0-CURRENT/10-STABLE powerpc64: a PowerMac G5 specific sys/powerpc/ofw/ofw_machdep.c change for reliable PowerMac G5 booting (with lots of RAM) To: Mark Millard , FreeBSD PowerPC ML References: <0F078304-8E8F-4EB1-B721-B6C4B885F118@dsl-only.net> From: "Jukka A. Ukkonen" Message-ID: <20095902-e09a-1a02-c2d1-b402a7eec79d@gmail.com> Date: Sun, 18 Sep 2016 14:46:02 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <0F078304-8E8F-4EB1-B721-B6C4B885F118@dsl-only.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Sep 2016 11:46:08 -0000 On 09/17/16 00:41, Mark Millard wrote: > Jukka A. Ukkonen jau789 at gmail.com wrote on Fri Sep 16 15:36:05 UTC 2016 : > >> it seems my PowerMac G5 is perfectly happy with this... >> >> __asm __volatile("mfsprg0 %0\n\t" >> : "=&r"(ofw_sprg0_save) >> : >> ); > > for the content in ofw_sprg_prepare(void). > > Interestingly ofw_sprg0_save's use to save and restore requires that the same processor be in use in the restore side, ofw_sprg_restore(void): SPRG0 content is processor specific. > > If the sprg0 save-restore is even required is not obvious to me: being required would imply that that something else is adjusting it between the save and restore code executions. > > The following is just in the form of another simplest-local-changes experiment/analysis pass, not a "how it should be coded for general FreeBSD use" form for __powerpc64__ or at least for for PowerMac/iMac/Xserve G5's specifically. . . > > Given what is reported above by Jukka it would appear that the above __asm lines possibly could be removed/disabled if ofw_sprg_restore(void) also had its __asm line removed/disabled: i.e., > > __asm __volatile("mtsprg0 %0" :: "r"(ofw_sprg0_save)); > > would no log be in use to access ofw_sprg0_save. > > Effectively overall for the intended __powerpc64__ PowerMac(/iMac?/Xserver?) experimental context ofw_sprg_prepare and ofw_sprg_restore are then no-ops. > > In effect ofw_sprg0_save and ofmsr[1] to ofmsr[4] would not be in significant use. But. . . > > OF_initial_setup(void *fdt_ptr, void *junk, int (*openfirm)(void *)) > > still would have __asm references to ofmsr[1] through ofmsr[4] where they are initialized. > > > You might want to try deleting/disabling the __asm statements in ofw_sprg_prepare(void) and in ofw_sprg_restore(void) at the same time to see if it makes any difference. If it does make a difference that would be interesting and important. Otherwise it helps identify some more (PowerMac/. . . context specific) unnecessary code. You asked it and I tested it. I must admit, though, that I had a kind of an Arthur Dent moment during the test. Remember the red button on the wall with the sign on the side telling: "Do not press this button!", and then Arthur being himself happily presses the button anyway just to see the warning sign to be illuminated. I was not quite so lucky. It seems touching the current sprg0 treatment is a guaranteed method to panic the system right at the beginning of autoconfigure. --jau