From owner-freebsd-ppc@freebsd.org Fri May 10 07:29:46 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 81BF4159A6E4 for ; Fri, 10 May 2019 07:29:46 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic316-8.consmr.mail.gq1.yahoo.com (sonic316-8.consmr.mail.gq1.yahoo.com [98.137.69.32]) (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 593B793CBB for ; Fri, 10 May 2019 07:29:45 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: AFr80RUVM1kBUq81uBvfXE2TD2R_YUJHcc7NJ.UxJsYxDTrsh_1GHXtPoKOFaD2 CRsFN.hTYX4qiQ3IUxSEWCmVgrw9YX6AlKPTEW_r0iAC7yRYa6FLfH4w4fDgD5dgKP5htjo8_khI yZmjI3nQt3V7auCVUTlcoCwX.tgkmJ4hHg9B57h52u3p_U3DV.uLol_VVq2ZKpRCoUm5WUa6KqxL VZPXV3d0C1KqEeXwa_Q90pHWa1_GtV5gDIREr.ki4wx9tTeZJf6tUdCsp1rYLCOz1vPRm4FK3s67 50cdIIipM4X79wTI9Zx0b9RuwBugcX5fbtlhONW5KEbdzAINVywIwzffCdeLSnwQ3PBIPp5j_tLz .aycop383bVMbpQLsXl00FaA7eVTnAaincLsM0LODgntZrdjquo.53Z1Eo5Hf8ARlrcaRnujrdHF 5NcaFv.zR9rbNbpBknd.YcN4Vd24qWvz3EzgnXI1Dl4ryz4779l3val9G2i3SfZDr0tXJaU6bq8F BPCtl.nZLm4QMpSHp_ZlA_jWHO_xzXaxjxyJWRsGYK7ZkMZFm.CvUKLzHent5INnQMoX1STn8XDo 74xJXPOkkolpMuzCt1L8etQJx3AmtWBUVpigjMpnECQ7WpHbUelBtsNZs3OYmsrfQyBujlEpHHSO FTOeIC98cpSncvX5zGEfBuoHG9ml.RyYjjzDELBO8W_j6RRiJd_NbB.wHBbxi44z_G2_8vMLCwHR A1ewBTuj5UdL_6HoUtB06wG_j8r0Zo0ckZQf7jEzcsgMbRl0GzG3kuJDMaf3Vpb7Rq9fllu16pUx MN_eL52ha2d_XMUSmu7.A5b7f73bqG14HxmaUcCrgqhDdRzc_gm0bW.ZAcMyqHHlMPRjrGf1CJnq nSYR9VchR_b61NR_Z0XSvCIxLHN24DW9qq_55gy63PAgctSZ99XnWDLsoykkNc0D4EqY7jALN01P 5zBbi5UE88CKgSQxv7eImASGq8sanbOxg38HIej87squrDQ35PEuaPwqNqidvDVwiOhQR5OcryMu vMDCuBPJNMOc2R.kFKZ7FAcwW9YDfQODDqElsuyX47GbutMqQPvlJYqziatD_rXpw8jOtmKs7gcm begyZDqmekYo1u9Z6Z1dhwT0O7mYBlsWwVVy5lTcR.GUeXJgAKT.mCKYBkzzN1Lv8EbRr9cs.bEG HYtg- Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.gq1.yahoo.com with HTTP; Fri, 10 May 2019 07:29:41 +0000 Received: from c-76-115-7-162.hsd1.or.comcast.net (EHLO [192.168.1.103]) ([76.115.7.162]) by smtp429.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 7b49a8b7f6cf762f3d510029fd130745; Fri, 10 May 2019 07:29:40 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Subject: 970/G5 powerpc64: why are HIOR (311), HID0, HID1 set in cpudep_ap_setup *AFTER* cpudep_ap_bootstrap tries general PSL_IR|PSL_DR activity for pcpup->pc_curthread->td_pcb-> Message-Id: Date: Fri, 10 May 2019 00:29:39 -0700 To: Justin Hibbits , FreeBSD PowerPC ML X-Mailer: Apple Mail (2.3445.104.8) X-Rspamd-Queue-Id: 593B793CBB X-Spamd-Bar: + X-Spamd-Result: default: False [1.46 / 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)[]; DKIM_TRACE(0.00)[yahoo.com:+]; MX_GOOD(-0.01)[cached: mta6.am0.yahoodns.net]; RCPT_COUNT_TWO(0.00)[2]; 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)[]; NEURAL_HAM_MEDIUM(-0.33)[-0.329,0]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.88)[0.879,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(1.20)[ip: (4.50), ipnet: 98.137.64.0/21(0.86), asn: 36647(0.69), country: US(-0.06)]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.22)[0.221,0]; RCVD_IN_DNSWL_NONE(0.00)[32.69.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 07:29:46 -0000 cpudep_ap_bootstrap uses the EXC_DSE (slbtrap) sometimes when it tries to do the pcpup->pc_curthread->td_pcb-> to get the stack pointer. Yet HIOR (311) controls where exception code is found but is initialized after the attempted use of EXC_DSE (and, possibly, EC_ISE use). HID0 has to do with, in part, locking, enalbing, and invaldiating the isntruction and data caches (and power modes). HID1 has to do with, in part, controlling instruction fetch and instruction decode functions. It looks to me like pcpup->pc_curthread->td_pcb-> should come after all the=ose have been set up. In other words, given the content of the routines involved, the order in: cpu_reset_handler: GET_TOCBASE(%r2) addis %r1,%r2,TOC_REF(tmpstk)@ha ld %r1,TOC_REF(tmpstk)@l(%r1) /* get new SP */ addi %r1,%r1,(TMPSTKSZ-48) bl CNAME(cpudep_ap_early_bootstrap) /* Set PCPU */ nop lis %r3,1@l bl CNAME(pmap_cpu_bootstrap) /* Turn on virtual memory */ nop bl CNAME(cpudep_ap_bootstrap) /* Set up PCPU and stack */ nop mr %r1,%r3 /* Use new stack */ bl CNAME(cpudep_ap_setup) nop GET_CPUINFO(%r5) ld %r3,(PC_RESTORE)(%r5) cmpldi %cr0,%r3,0 beq %cr0,2f nop li %r4,1 bl CNAME(longjmp) nop 2: #ifdef SMP bl CNAME(machdep_ap_bootstrap) /* And away! */ nop #endif seems wrong to me, doing general execution before the context has been initialized. (Of course re-ordering could involve moving code between routines, not just changes to cpu_reset_handler.) Note: I never found HIOR (311) set for the bsp. I did not find any HID1 code for the 970 bsp. It appears that whatever openfirmware or the loader sets up is used as-is. For the bsp, powerpc_init seems to use cpu_feature_setup, and so use cpu_970_setup (for HID0) earlier than on the ap's (relative to things like ->pc_curthread->td_pcb-> ). aim_eary_init seems to be next (for HID5). moeas64_probe_large_page via moeas64_early_bootstrap via early in moea64_bootstrap_native via pmapinit (for HID4). I'm unsure of relative timing of this one. === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)