From owner-freebsd-ppc@freebsd.org Mon May 14 01:04:57 2018 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 98201FDEB8A for ; Mon, 14 May 2018 01:04:57 +0000 (UTC) (envelope-from marklmi26-fbsd@yahoo.com) Received: from sonic317-28.consmr.mail.bf2.yahoo.com (sonic317-28.consmr.mail.bf2.yahoo.com [74.6.129.83]) (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 20C107F81D for ; Mon, 14 May 2018 01:04:56 +0000 (UTC) (envelope-from marklmi26-fbsd@yahoo.com) X-YMail-OSG: lFjojrQVM1mGf8Rr0deM4YoxhdD3swD78nOkZEy8OBqj1Ffw4lfllGf.qq3AhMc ZgYVxR43KONuBKX9__dm086qCgH0kcJDYO_x7aSaNBsXnyyl0tt5uGT1Wd64mbxgt.s5u1U0C6jd KlSKvWRvHWZt0JtqvcWR4iilyaGdUHL4tFvBwZA9EoVdteKLMY4Nktj2lUDwdMtzF_QMzCfoMGug 2YW9s4CI2PZUXbVVrPHl3Zq5zlP2aw72tuqrvmRFrJqpx3YRyyOVqUbkKcNmPrf1.tqdtFUpHAo5 s9iSedGCyD0CG2T7dSb3_cpYuJfqeEmLymfOqy3HFtRIFLeMw6j0J7m1lTeyf9uOsoZcDtLJkV_d o84CgK.pU4if.iE1dda4WZtdW6MJpczym.sILFlccuVrOrBYayHH5M9xpWa3Su.GV_JxSgbdFuNB bKqu5sH2ZGIroKHN4aZ6KvSCfQFUUHRMB2DUh9Gb.C4pfpgrYsm5TgH4RXCHGVN1P4s0aeJ_lhMq .tha4U7kE2FGyIUkQAgkk2aHwyYXsUi67D3G2KspR4nDUWUjuStDgmw33yS4b672ibz3nosz2XsN boQ70IeAMLzT8MEx.nshTkoS5jaB9qqWsTajbSs1gFLu7hORLPw-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.bf2.yahoo.com with HTTP; Mon, 14 May 2018 01:04:50 +0000 Received: from c-76-115-7-162.hsd1.or.comcast.net (EHLO [192.168.1.25]) ([76.115.7.162]) by smtp422.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 6e87548ab73ab669016d221ecb98dcd3; Mon, 14 May 2018 01:04:47 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: head -r333575's kernel: fails to boot old PowerMac G5 so-called "Quad Core", failing very early From: Mark Millard In-Reply-To: <1c62913a-0caa-aa6e-b0b6-97c338aa50c7@freebsd.org> Date: Sun, 13 May 2018 18:04:45 -0700 Cc: freebsd-ppc@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <94E173AD-74C0-43ED-9D0D-86D9A56C2A74@yahoo.com> <1c62913a-0caa-aa6e-b0b6-97c338aa50c7@freebsd.org> To: Nathan Whitehorn X-Mailer: Apple Mail (2.3445.6.18) X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 May 2018 01:04:57 -0000 On 2018-May-13, at 5:35 PM, Nathan Whitehorn = wrote: > This should be fixed if you update past r333594. > -Nathan Confirmed: my -r333594 buildkernel booted normally. Thanks! > On 05/13/18 16:12, Mark Millard via freebsd-ppc wrote: >> I'd had to revert to the old kernel from the last time I'd >> updated the old PowerMac G5 "Quad Core" for powerpc64 style >> use [back in early Jan.]: >>=20 >> # uname -apKU >> FreeBSD FBSDG5L 12.0-CURRENT FreeBSD 12.0-CURRENT r327364M powerpc = powerpc64 1200054 1200063 >>=20 >> because buildkernel instalkernel for -r333575 results for >> all the following fail in the same way: >>=20 >> A) devel/powerpc64-xtoolchain-gcc based build >> (from /usr/ports/ -r469767 so before the upgrade to 6.4) >> B) gcc 4.2.1 based build >> C) system clang6 based build >>=20 >> These were all amd64 -> powerpc64 cross builds. Each is a >> non-debug build --but with symbols. >>=20 >> The following 3 lines are displayed and nothing more >> visible happens after that in the boot sequence, the >> lines are the ones that start with: >>=20 >> GDB: no debug ports present >> KDB: debugger backends: >> KDB: current backend: >>=20 >> It does not display any Copyright notice line or even >> clear the screen. >>=20 >> The old -r327364 kernel boots the old PowerMac G5 "Quad Core" >> just fine (with the -r333575 world at this point). >>=20 >> So far, this much suggests the issue is not toolchain related, >> although in all 3 cases devel/powerpc64-binutils is in use >> so it can not be eliminated as easily. >>=20 >> [A problem is I'm very restricted on the amount of time >> I can be involved in bisecting this and 333575-327364=3D=3D6211 >> for the version span. Another problem is that, at the failure >> stage, getting information about failure details is >> problematical on the old PowerMac, even if I could apply >> the time for such.] >>=20 >>=20 >> For powerpc64 context I have: >>=20 >> # more /usr/src/sys/powerpc/conf/GENERIC64vtsc-NODBG >> # >> # GENERIC -- Custom configuration for the powerpc/powerpc64 >> # >>=20 >> include "GENERIC64" >>=20 >> ident GENERIC64vtsc-NODBG >>=20 >> makeoptions DEBUG=3D-g # Build kernel with gdb(1) = debug symbols >>=20 >> nooptions PS3 # Sony Playstation 3 = HACK!!! to allow sc >>=20 >> options KDB # Enable kernel debugger = support >>=20 >> options ALT_BREAK_TO_DEBUGGER >> options BREAK_TO_DEBUGGER >>=20 >> # For minimum debugger support (stable branch) use: >> options KDB_TRACE # Print a stack trace for a = panic >> options DDB # Enable the kernel debugger >> options GDB # HACK!!! ... >>=20 >> # Extra stuff: >> #options VERBOSE_SYSINIT # Enable verbose sysinit = messages >> #options BOOTVERBOSE=3D1 >> #options BOOTHOWTO=3DRB_VERBOSE >> #options KTR >> #options KTR_MASK=3DKTR_TRAP >> ##options KTR_CPUMASK=3D0xF >> #options KTR_VERBOSE >>=20 >> # HACK!!! to allow sc for 2560x1440 display on Radeon X1950 that vt = historically mishandled during booting >> device sc >> #device kbdmux # HACK: already listed by vt >> options SC_OFWFB # OFW frame buffer >> options SC_DFLT_FONT # compile font in >> makeoptions SC_DFLT_FONT=3Dcp437 >>=20 >>=20 >> # Disable any extra checking for. . . >> nooptions DEADLKRES # Enable the deadlock = resolver >> nooptions INVARIANTS # Enable calls of extra = sanity checking >> nooptions INVARIANT_SUPPORT # Extra sanity checks of = internal structures, required by INVARIANTS >> nooptions WITNESS # Enable checks to detect = deadlocks and cycles >> nooptions WITNESS_SKIPSPIN # Don't run witness on = spinlocks for speed >> nooptions DIAGNOSTIC >> nooptions MALLOC_DEBUG_MAXZONES # Separate malloc(9) zones >>=20 >> device filemon >> device geom_label >>=20 >>=20 >>=20 >> # svnlite diff = /usr/src/contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp >> Index: /usr/src/contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp >> =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 >> --- /usr/src/contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp = (revision 333575) >> +++ /usr/src/contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp = (working copy) >> @@ -1176,7 +1176,7 @@ >> // For SVR4, don't emit a move for the CR spill slot if we = haven't >> // spilled CRs. >> if (isSVR4ABI && (PPC::CR2 <=3D Reg && Reg <=3D PPC::CR4) >> - && !MustSaveCR) >> + && (!MustSaveCR && isPPC64)) >> continue; >>=20 >> // For 64-bit SVR4 when we have spilled CRs, the spill = location >>=20 >>=20 >>=20 >> Note: The following file does not intend a powerpc64 functional = change >> but a powerpc (32-bit) change: >>=20 >> # svnlite diff /usr/src/sys/powerpc/ofw/ofw_machdep.c >> Index: /usr/src/sys/powerpc/ofw/ofw_machdep.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 >> --- /usr/src/sys/powerpc/ofw/ofw_machdep.c (revision 333575) >> +++ /usr/src/sys/powerpc/ofw/ofw_machdep.c (working copy) >> @@ -116,26 +116,27 @@ >> * Assume that interrupt are disabled at this point, or >> * SPRG1-3 could be trashed >> */ >> -#ifdef __powerpc64__ >> - __asm __volatile("mtsprg1 %0\n\t" >> - "mtsprg2 %1\n\t" >> - "mtsprg3 %2\n\t" >> - : >> - : "r"(ofmsr[2]), >> - "r"(ofmsr[3]), >> - "r"(ofmsr[4])); >> -#else >> - __asm __volatile("mfsprg0 %0\n\t" >> - "mtsprg0 %1\n\t" >> - "mtsprg1 %2\n\t" >> - "mtsprg2 %3\n\t" >> - "mtsprg3 %4\n\t" >> - : "=3D&r"(ofw_sprg0_save) >> - : "r"(ofmsr[1]), >> - "r"(ofmsr[2]), >> - "r"(ofmsr[3]), >> - "r"(ofmsr[4])); >> +#ifndef __powerpc64__ >> + if (!(cpu_features & PPC_FEATURE_64)) >> + __asm __volatile("mfsprg0 %0\n\t" >> + "mtsprg0 %1\n\t" >> + "mtsprg1 %2\n\t" >> + "mtsprg2 %3\n\t" >> + "mtsprg3 %4\n\t" >> + : "=3D&r"(ofw_sprg0_save) >> + : "r"(ofmsr[1]), >> + "r"(ofmsr[2]), >> + "r"(ofmsr[3]), >> + "r"(ofmsr[4])); >> + else >> #endif >> + __asm __volatile("mtsprg1 %0\n\t" >> + "mtsprg2 %1\n\t" >> + "mtsprg3 %2\n\t" >> + : >> + : "r"(ofmsr[2]), >> + "r"(ofmsr[3]), >> + "r"(ofmsr[4])); >> } >>=20 >> static __inline void >> @@ -152,7 +153,8 @@ >> * PCPU data cannot be used until this routine is called ! >> */ >> #ifndef __powerpc64__ >> - __asm __volatile("mtsprg0 %0" :: "r"(ofw_sprg0_save)); >> + if (!(cpu_features & PPC_FEATURE_64)) >> + __asm __volatile("mtsprg0 %0" :: = "r"(ofw_sprg0_save)); >> #endif >> } >> #endif >>=20 >>=20 >>=20 >> Note: The following file's change is actually for >> !defined(__powerpc64__) added code . . . >>=20 >> # svnlite diff /usr/src/sys/powerpc/aim/mmu_oea64.c >> Index: /usr/src/sys/powerpc/aim/mmu_oea64.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 >> --- /usr/src/sys/powerpc/aim/mmu_oea64.c (revision 333575) >> +++ /usr/src/sys/powerpc/aim/mmu_oea64.c (working copy) >> @@ -1820,6 +1820,18 @@ >> PV_PAGE_UNLOCK(m); >> } >>=20 >> +#if defined(AIM) && !defined(__powerpc64__) >> +// >> +// Part of PowerMac G5 HACK FOR PROBLEM FINDING. . . >> +// (G5 used via 32-bit FreeBSD.) >> +// >> + >> +extern char _GOT_START_[]; // beginning of .got/.got.plt >> +extern char _GOT_END_[]; // ending of .got/.got.plt >> + >> +extern vm_offset_t __startkernel, __endkernel; >> +#endif >> + >> /* >> * Map a wired page into kernel virtual address space. >> */ >> @@ -1830,6 +1842,52 @@ >> struct pvo_entry *pvo, *oldpvo; >>=20 >> pvo =3D alloc_pvo_entry(0); >> +#if defined(AIM) && !defined(__powerpc64__) >> + // >> + // PowerMac G5 HACK FOR PROBLEM FINDING. . . >> + // (G5 used via 32-bit FreeBSD.) >> + // >> + // As a problem-finding-aid try to catch some examples of >> + // jumping to non-code in the kernel before it tries to >> + // execute that that code. Hopefully this will show where >> + // the bad jump into the likes of the .hash section is >> + // happening. (dbb bt and vmcore.*'s have not lead to >> + // that information so far.) >> + // >> + if (cpu_features & PPC_FEATURE_64) >> + { >> + // First deal with pages that should have the = original >> + // VM_PROT_EXECUTE status for something on the page >> + // (most pages in the kernel area). So pages with = some >> + // byte(s) from .text, .got, or .got.plt, along with >> + // any requested from before where __startkernel >> + // indicates. Also any va requested from a page >> + // containing where __endkernel indicates or later >> + // gets VM_PROT_EXECUTE if such a va is requested. >> + // >> + // So: have just the rest of the kernel area not have >> + // VM_PROT_EXECUTE status in hopes that it will = report >> + // where the code is that is making bad jumps to >> + // non-code, such as jumping into the .hash section >> + // instead of reporting on illegal instructions >> + // from the incorrect traget area. >> + // >> + if ( va < ((vm_offset_t)(etext+(PAGE_SIZE-1)) & = ~PAGE_MASK) ) >> + pvo->pvo_pte.prot =3D VM_PROT_READ | = VM_PROT_WRITE | VM_PROT_EXECUTE; >> + >> + else if ( ((vm_offset_t)_GOT_START_ & ~PAGE_MASK) <=3D= va >> + && va < = ((vm_offset_t)(_GOT_END_+(PAGE_SIZE-1)) & ~PAGE_MASK) >> + ) >> + pvo->pvo_pte.prot =3D VM_PROT_READ | = VM_PROT_WRITE | VM_PROT_EXECUTE; >> + >> + else if ( va < (__endkernel & ~PAGE_MASK) ) >> + pvo->pvo_pte.prot =3D VM_PROT_READ | = VM_PROT_WRITE; >> + >> + else // Otherwise do as before the HACK: >> + pvo->pvo_pte.prot =3D VM_PROT_READ | = VM_PROT_WRITE | VM_PROT_EXECUTE; >> + } >> + else >> +#endif >> pvo->pvo_pte.prot =3D VM_PROT_READ | VM_PROT_WRITE | = VM_PROT_EXECUTE; >> pvo->pvo_pte.pa =3D (pa & ~ADDR_POFF) | moea64_calc_wimg(pa, = ma); >> pvo->pvo_vaddr |=3D PVO_WIRED; >>=20 >>=20 >>=20 >> Note: The following should not matter because it is only for >> devel/powerpc64-gcc but gcc 4.2.1 and system clang6 got the >> same result: >>=20 >> # svnlite diff /usr/ports/devel/powerpc64-gcc/Makefile >> Index: /usr/ports/devel/powerpc64-gcc/Makefile >> =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 >> --- /usr/ports/devel/powerpc64-gcc/Makefile (revision 469767) >> +++ /usr/ports/devel/powerpc64-gcc/Makefile (working copy) >> @@ -2,7 +2,7 @@ >>=20 >> PORTNAME=3D gcc >> PORTVERSION=3D 6.3.0 >> -PORTREVISION=3D 5 >> +PORTREVISION=3D 6 >> CATEGORIES=3D devel >> MASTER_SITES=3D GCC/releases/gcc-${DISTVERSION} >> PKGNAMEPREFIX?=3D powerpc64- >> @@ -42,6 +42,7 @@ >> GNU_CONFIGURE=3D yes >> CONFIGURE_OUTSOURCE=3D yes >> CONFIGURE_ARGS+=3D--target=3D${GCC_TARGET} --disable-nls = --enable-languages=3Dc,c++ \ >> + --enable-gnu-indirect-function \ >> --without-headers \ >> --with-gmp=3D${LOCALBASE} \ >> --with-pkgversion=3D"FreeBSD Ports Collection for = ${PKGNAMEPREFIX:C/-//g}" \ >> @@ -104,6 +105,6 @@ >>=20 >> # This port and all its slave ports fail on aarch64 -- but not all >> # the same way. Provide this definition for the master. >> -BROKEN_aarch64?=3D fails to package >> +#BROKEN_aarch64?=3D fails to package >>=20 >> .include >>=20 >=20 =3D=3D=3D Mark Millard marklmi26-fbsd at yahoo.com ( dsl-only.net went away in early 2018-Mar)