From owner-freebsd-ppc@freebsd.org Fri May 10 10:23:41 2019 Return-Path: Delivered-To: freebsd-ppc@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3006159EBAB for ; Fri, 10 May 2019 10:23:41 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic317-22.consmr.mail.gq1.yahoo.com (sonic317-22.consmr.mail.gq1.yahoo.com [98.137.66.148]) (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 B44C86A9EE for ; Fri, 10 May 2019 10:23:40 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: j5sxUtwVM1k_KLPP_6RLQbjwQKFx36Ddrg9Sp4pfW.ZngVrHCcuGV_5meNzcHRF 0IxxdGYoy1VfWH9BFeKHm2TACpz1lmPfKM3M9rJLTQQYfrOwCEpoUeNCxHwQYdkyTaPZtcEiMC4m _0t13xz1gPUL9TxJ2T.FR3Q323z5vHcrxXyUogLlEqe1Yv5kiZMVyIaOADXKeO7YyObtAwmjTFJf IsJH1E53_DXE0ouGW9jmFve18wGkDXVWSTeIAcwnOv5rD7a8cHHsgKAEIDPoa.jx_wpL5LI.KFk3 hTXWl5BjgyY2TBKew7lbcsS0SaEXkRhesyiBEitkwtAkwJCjJqwngYVKYNSqiODlKecUSyRPTasp Ipkr71WeMxTapoOtSLoreRfL5uciM9UKnY4MgC2DPTh.iJAWk8qxLqGGoyq3YsmqBSi3i9_3mkSn P2tdlkggLtxdDatX.Dj58L1bfpRXYZxtCt8E0pQKEfZ51qm92mz4qElSExeOH7VWo7yu5nGj1weW _f6AGEMe4iKS_Qiaq.pAR2Mwwdi2arCdDggUoX.yfaxstMtti8wvW4o70LFYaYfhY0KNFB1_3_lk uLb4xIU0bKAvml.lnailJiBK1R25t7FD2LUcAZlNdhPwDdFMfvN0QwsN7Mx3gRXEm2PKZnUKYJXw GxM06l9X3SBDjQQYsMECT2UdTuLNn7Li_n2hOgeuATHKhTnGHmYRaWS6XZp9npB.6SoM9HPWilo. QV3BRN73CQoeYCFtWCrbfwADiUURstcwuLyNfkQRzWQqAuo.u1ioJK3JMATowuUjMIwfrOeJcbEl ASr5UeRSP3sHLMRx4c4KABTV6Io9mI5taH50aXFBLJd_VBymb0SxoqSzcpfsB0P9XQeOqUhqeU2C ObsGkbMZ1_tsh58b7wvzGHCkyEaFidZ2AZaaJZ6Top1olzSBNAE.EIQr2mksnKF1tywNHS9AjTGd yKYIT1G2OZLDOlagKTjz3SgLa5OXxpykDyQtfSzCo.OXWT5kV8YhHbGaUWeEmo2SK_5Q9jr_tfqq WpWMxKeb.Q3Qs5r7j_NJsxVzT_ZZrCJpRoyR2H7kxqEY2rJHU9PtP8asODvRfx82ic.jmY0GPJia wL9.hoABtBIS_iABo5UZ.DTE7yHaG7l8llEIgprMhlctdJZcLu1JW6fS.9lX441yb_BQOEnkfw7Y ju7czj.WCeTo- Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.gq1.yahoo.com with HTTP; Fri, 10 May 2019 10:23:37 +0000 Received: from c-76-115-7-162.hsd1.or.comcast.net (EHLO [192.168.1.103]) ([76.115.7.162]) by smtp420.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 92cbba6f426518dd2750e72244c78de6; Fri, 10 May 2019 10:23:37 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Subject: Re: 970/PowerMac G5 cpudep_ap_bootstrap slb-related hangup *solved* . . . From: Mark Millard In-Reply-To: <2E7A0894-E5B0-4776-95F2-76B7EE0EE93C@yahoo.com> Date: Fri, 10 May 2019 03:23:36 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <2E7A0894-E5B0-4776-95F2-76B7EE0EE93C@yahoo.com> To: Justin Hibbits , FreeBSD PowerPC ML X-Mailer: Apple Mail (2.3445.104.8) X-Rspamd-Queue-Id: B44C86A9EE X-Spamd-Bar: ++ X-Spamd-Result: default: False [2.92 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; MV_CASE(0.50)[]; FREEMAIL_FROM(0.00)[yahoo.com]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.01)[cached: mta6.am0.yahoodns.net]; DKIM_TRACE(0.00)[yahoo.com:+]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_SPAM_SHORT(0.69)[0.694,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(1.59)[ip: (6.46), ipnet: 98.137.64.0/21(0.86), asn: 36647(0.69), country: US(-0.06)]; NEURAL_SPAM_MEDIUM(0.47)[0.466,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.68)[0.680,0]; RCVD_IN_DNSWL_NONE(0.00)[148.66.137.98.list.dnswl.org : 127.0.5.0] X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 May 2019 10:23:42 -0000 [Having removed all my prior investigatory material, I include a svnlite diff that I've booted based on, a comparatively minimal diff from the head -r347003 that I started from.] On 2019-May-10, at 02:15, Mark Millard wrote: > [This continues a prior message, but I choose a new subject > text for the testing that showed the kind of material working.] >=20 > I have the slbtrap/handle_kernel_slb_spill working instead > of hanging up when it has an slb-miss (and well as when there > is no miss). >=20 > In /usr/src/sys/powerpc/aim/mp_cpudep.c I moved the > 970 code for HID0 and HID1 from cpudep_ap_setup, code > that looks like, >=20 > /* Set HIOR to 0 */ > __asm __volatile("mtspr 311,%0" :: "r"(0)); > powerpc_sync(); >=20 > /* > * The 970 has strange rules about how to update HID = registers. > * See Table 2-3, 970MP manual > * > * Note: HID4 and HID5 restored already in > * cpudep_ap_early_bootstrap() > */ >=20 > __asm __volatile("mtasr %0; sync" :: "r"(0)); > #ifdef __powerpc64__ > __asm __volatile(" \ > sync; isync; = \ > mtspr %1, %0; = \ > mfspr %0, %1; mfspr %0, %1; mfspr %0, %1; = \ > mfspr %0, %1; mfspr %0, %1; mfspr %0, %1; = \ > sync; isync" > :: "r"(bsp_state[0]), "K"(SPR_HID0)); > __asm __volatile("sync; isync; \ > mtspr %1, %0; mtspr %1, %0; sync; isync" > :: "r"(bsp_state[1]), "K"(SPR_HID1)); > #else > __asm __volatile(" \ > ld %0,0(%2); = \ > sync; isync; = \ > mtspr %1, %0; = \ > mfspr %0, %1; mfspr %0, %1; mfspr %0, %1; = \ > mfspr %0, %1; mfspr %0, %1; mfspr %0, %1; = \ > sync; isync" > : "=3Dr"(reg) : "K"(SPR_HID0), "b"(bsp_state)); > __asm __volatile("ld %0, 8(%2); sync; isync; \ > mtspr %1, %0; mtspr %1, %0; sync; isync" > : "=3Dr"(reg) : "K"(SPR_HID1), "b"(bsp_state)); > #endif >=20 > powerpc_sync(); >=20 > Here to? moved it to cpudep_ap_early_bootstrap, just before the > code for HID4 and HID5, and I commented out 2 #if/endif lines: >=20 > void > cpudep_ap_early_bootstrap(void) > { > //#ifndef __powerpc64__ > register_t reg; > //#endif >=20 > switch (mfpvr() >> 16) { > case IBM970: > case IBM970FX: > case IBM970MP: >> .>.> INSERT CODE HERE <.<.<. >=20 > /* Restore HID4 and HID5, which are necessary for the = MMU */ >=20 > #ifdef __powerpc64__ > mtspr(SPR_HID4, bsp_state[2]); powerpc_sync(); isync(); > mtspr(SPR_HID5, bsp_state[3]); powerpc_sync(); isync(); > #else > __asm __volatile("ld %0, 16(%2); sync; isync; \ > mtspr %1, %0; sync; isync;" > : "=3Dr"(reg) : "K"(SPR_HID4), "b"(bsp_state)); > __asm __volatile("ld %0, 24(%2); sync; isync; \ > mtspr %1, %0; sync; isync;" > : "=3Dr"(reg) : "K"(SPR_HID5), "b"(bsp_state)); > #endif > powerpc_sync(); > break; > . . . >=20 > This does the initialization before cpudep_ap_bootstrap, > instead of after. >=20 > With things then sufficiently initialized for PSL_IR|PSL_DR > code to doing things like pcpup->pc_curthread->td_pcb-> > that sometimes have slb misses, it boots fine, > loading into the slb as needed. No more checkstop status > (or whatever it was). >=20 > I do not know if non-970 contexts should have similar > changes in the ordering of initializations or not. > But, clearly, the 970 family members do need such. >=20 > I'm not claiming that other material from other notes > that I sent out should be ignored, only that the above > changes the observed failing behavior, and so is a big > gain all by itself. And it is simple to do without > other investigations that might be involved in the > more overall context. Of course, whitespace details, may not be well preserved below. (The commenting out of the two #if/#endif lines was unnecessary and is not done in the below.) # svnlite diff /mnt/usr/src/sys/ | more Index: /mnt/usr/src/sys/powerpc/aim/mp_cpudep.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 --- /mnt/usr/src/sys/powerpc/aim/mp_cpudep.c (revision 347003) +++ /mnt/usr/src/sys/powerpc/aim/mp_cpudep.c (working copy) @@ -68,6 +68,46 @@ case IBM970: case IBM970FX: case IBM970MP: + /* Set HIOR to 0 */ + __asm __volatile("mtspr 311,%0" :: "r"(0)); + powerpc_sync(); + + /* + * The 970 has strange rules about how to update HID = registers. + * See Table 2-3, 970MP manual + * + * Note: HID4 and HID5 restored already in + * cpudep_ap_early_bootstrap() + */ + + __asm __volatile("mtasr %0; sync" :: "r"(0)); + #ifdef __powerpc64__ + __asm __volatile(" \ + sync; isync; = \ + mtspr %1, %0; = \ + mfspr %0, %1; mfspr %0, %1; mfspr %0, %1; = \ + mfspr %0, %1; mfspr %0, %1; mfspr %0, %1; = \ + sync; isync"=20 + :: "r"(bsp_state[0]), "K"(SPR_HID0)); + __asm __volatile("sync; isync; \ + mtspr %1, %0; mtspr %1, %0; sync; isync" + :: "r"(bsp_state[1]), "K"(SPR_HID1)); + #else + __asm __volatile(" \ + ld %0,0(%2); = \ + sync; isync; = \ + mtspr %1, %0; = \ + mfspr %0, %1; mfspr %0, %1; mfspr %0, %1; = \ + mfspr %0, %1; mfspr %0, %1; mfspr %0, %1; = \ + sync; isync"=20 + : "=3Dr"(reg) : "K"(SPR_HID0), "b"(bsp_state)); + __asm __volatile("ld %0, 8(%2); sync; isync; \ + mtspr %1, %0; mtspr %1, %0; sync; isync" + : "=3Dr"(reg) : "K"(SPR_HID1), "b"(bsp_state)); + #endif + + powerpc_sync(); + /* Restore HID4 and HID5, which are necessary for the = MMU */ =20 #ifdef __powerpc64__ @@ -314,45 +354,6 @@ case IBM970: case IBM970FX: case IBM970MP: - /* Set HIOR to 0 */ - __asm __volatile("mtspr 311,%0" :: "r"(0)); - powerpc_sync(); - - /* - * The 970 has strange rules about how to update HID = registers. - * See Table 2-3, 970MP manual - * - * Note: HID4 and HID5 restored already in - * cpudep_ap_early_bootstrap() - */ - - __asm __volatile("mtasr %0; sync" :: "r"(0)); - #ifdef __powerpc64__ - __asm __volatile(" \ - sync; isync; = \ - mtspr %1, %0; = \ - mfspr %0, %1; mfspr %0, %1; mfspr %0, %1; = \ - mfspr %0, %1; mfspr %0, %1; mfspr %0, %1; = \ - sync; isync"=20 - :: "r"(bsp_state[0]), "K"(SPR_HID0)); - __asm __volatile("sync; isync; \ - mtspr %1, %0; mtspr %1, %0; sync; isync" - :: "r"(bsp_state[1]), "K"(SPR_HID1)); - #else - __asm __volatile(" \ - ld %0,0(%2); = \ - sync; isync; = \ - mtspr %1, %0; = \ - mfspr %0, %1; mfspr %0, %1; mfspr %0, %1; = \ - mfspr %0, %1; mfspr %0, %1; mfspr %0, %1; = \ - sync; isync"=20 - : "=3Dr"(reg) : "K"(SPR_HID0), "b"(bsp_state)); - __asm __volatile("ld %0, 8(%2); sync; isync; \ - mtspr %1, %0; mtspr %1, %0; sync; isync" - : "=3Dr"(reg) : "K"(SPR_HID1), "b"(bsp_state)); - #endif - - powerpc_sync(); break; case IBMCELLBE: #ifdef NOTYET /* Causes problems if in instruction = stream on 970 */ =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)