Date: Sun, 7 Feb 2021 17:45:49 -0800 From: Mark Millard <marklmi@yahoo.com> To: Brandon Bergren <bdragon@FreeBSD.org>, freebsd-ppc <freebsd-ppc@freebsd.org> Subject: The "bl __restartkernel" patch: I've no clue why I've not seen the problem Message-ID: <788D3E39-BA40-451C-988D-858D6FF16F27@yahoo.com> References: <788D3E39-BA40-451C-988D-858D6FF16F27.ref@yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> The branch main has been updated by bdragon: >=20 > URL:=20 > = https://cgit.FreeBSD.org/src/commit/?id=3Dd26f2a50ff48dacd38ba358d658882d5= 1f7bdbc4 >=20 >=20 > commit d26f2a50ff48dacd38ba358d658882d51f7bdbc4 > Author: Brandon Bergren < > bdragon at FreeBSD.org > > > AuthorDate: 2021-02-07 22:05:41 +0000 > Commit: Brandon Bergren < > bdragon at FreeBSD.org > > > CommitDate: 2021-02-07 22:13:55 +0000 >=20 > powerpc64: Fix boot on virtual-mode OF (PowerMac G5) > =20 > In 78599c32efed3247d165302a1fbe8d9203e38974, CFI endproc = decoration was > added to locore64.S. However, it missed the subtle detail that > __restartkernel_virtual() falls through to __restartkernel(). This = was > causing boot failure on PowerMac G5, as it tried to execute the > epilogue as code. > =20 > Fix this by branching to __restartkernel() instead of = intentionally > running off the end of the function. > =20 > While here, add some additional notes on how the virtual mode = restart > works. > =20 > MFC after: 3 days > --- > sys/powerpc/aim/locore64.S | 10 ++++++++++ > 1 file changed, 10 insertions(+) >=20 > diff --git a/sys/powerpc/aim/locore64.S b/sys/powerpc/aim/locore64.S > index 0bc0619620d9..f0a183c4b331 100644 > --- a/sys/powerpc/aim/locore64.S > +++ b/sys/powerpc/aim/locore64.S > @@ -255,6 +255,16 @@ ASENTRY_NOPROF(__restartkernel_virtual) > addi %r14, %r14, 1 > cmpdi %r14, 16 > blt 1b > + > + /* > + * Now that we are set up with a temporary direct map, we can > + * continue with __restartkernel. Translation will be switched > + * back on at the rfid, at which point we will be executing from > + * the temporary direct map we just installed, until the kernel > + * takes over responsibility for the MMU. > + */ > + bl __restartkernel > + nop > ASEND(__restartkernel_virtual) > =20 > ASENTRY_NOPROF(__restartkernel) Wow. Somehow I've not had boot powerpc64 FreeBSD boot problems since the ASEND(__restartkernel_virtual) addition. For example, the current boot code has ( from objdump output of /boot/kernel/kernel ): 0000000000100710 <__restartkernel_virtual> addis r2,r12,302 0000000000100714 <__restartkernel_virtual+0x4> addi r2,r2,10480 0000000000100718 <__restartkernel_virtual+0x8> mfmsr r14 000000000010071c <__restartkernel_virtual+0xc> andi. r14,r14,61389 0000000000100720 <__restartkernel_virtual+0x10> mtmsr r14 0000000000100724 <__restartkernel_virtual+0x14> isync 0000000000100728 <__restartkernel_virtual+0x18> li r14,0 000000000010072c <__restartkernel_virtual+0x1c> li r18,0 0000000000100730 <__restartkernel_virtual+0x20> oris r18,r18,49152 0000000000100734 <__restartkernel_virtual+0x24> rldicr r18,r18,32,31 0000000000100738 <__restartkernel_virtual+0x28> slbmfev r15,r14 000000000010073c <__restartkernel_virtual+0x2c> slbmfee r16,r14 0000000000100740 <__restartkernel_virtual+0x30> or r16,r16,r14 0000000000100744 <__restartkernel_virtual+0x34> ori r16,r16,16 0000000000100748 <__restartkernel_virtual+0x38> or r16,r16,r18 000000000010074c <__restartkernel_virtual+0x3c> rldicr r17,r16,0,37 0000000000100750 <__restartkernel_virtual+0x40> isync 0000000000100754 <__restartkernel_virtual+0x44> slbie r17 0000000000100758 <__restartkernel_virtual+0x48> slbmte r15,r16 000000000010075c <__restartkernel_virtual+0x4c> isync 0000000000100760 <__restartkernel_virtual+0x50> addi r14,r14,1 0000000000100764 <__restartkernel_virtual+0x54> cmpdi r14,16 0000000000100768 <__restartkernel_virtual+0x58> blt 0000000000100738 = <__restartkernel_virtual+0x28> ... 0000000000100778 <__restartkernel_virtual+0x68> nop 000000000010077c <__restartkernel_virtual+0x6c> nop 0000000000100780 <__restartkernel> addis r2,r12,302 0000000000100784 <__restartkernel+0x4> addi r2,r2,10368 0000000000100788 <__restartkernel+0x8> mtsrr1 r9 000000000010078c <__restartkernel+0xc> bl 0000000000100790 = <__restartkernel+0x10> 0000000000100790 <__restartkernel+0x10> mflr r25 0000000000100794 <__restartkernel+0x14> add r25,r8,r25 0000000000100798 <__restartkernel+0x18> addi r25,r25,20 000000000010079c <__restartkernel+0x1c> mtsrr0 r25 00000000001007a0 <__restartkernel+0x20> rfid 00000000001007a4 <__restartkernel+0x24> bl 0000000000100630 = <__start> 00000000001007a8 <__restartkernel+0x28> nop I wonder what implicit oddities have been happening because of it, without obvious boot problems. Or is the above only involved for some PowerMac G5s? Cool find. I've a ports rebuild in progress that may well not finish for another 6+ hours. I'll not be updating for this until sometime after the port build finishes. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?788D3E39-BA40-451C-988D-858D6FF16F27>