From owner-freebsd-arm@freebsd.org Sat Feb 15 17:25:27 2020 Return-Path: Delivered-To: freebsd-arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B560241226 for ; Sat, 15 Feb 2020 17:25:27 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic315-54.consmr.mail.gq1.yahoo.com (sonic315-54.consmr.mail.gq1.yahoo.com [98.137.65.30]) (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 48KcZt2zJfz4TJS for ; Sat, 15 Feb 2020 17:25:26 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: T8EOP.gVM1kpnpIIsTc8IsnXL6GwnSqAyudyQdRCZLy9VfSfAElHrM.8dbZ.iTB BF9eL8nmhCkNawSRUoHGZFu7wAZiR9oi5LiQVWY7SHvr4hTTylFjPTHRr9bTtGKs1rXvQ5SiDDyG S50rn0rEConYeQvCZmR5vwD.SntbsQQmm6HVDYLfXYqMwRvty31SswX88mFG0l8QMyNdPeGazw19 iF0eZB6.Zej8LVVt62Lvlp7pULUWrVojuxDicVLfRBHcdiS4CVyxpft81tEoLB5TCcw1t_eue7vH 19ThYejNSt0vX3HkXL_Uj6_8ymfNRN_RI4X_5bP4Oq9pLLZsPVnFhK9AAgSFrTIt5PNt9YG6SrBi Z_8N4Wv_r3FtkJiZpxDEuSD22GmuYmamoQJ5OvWNcVraPYAIJWT7r_HonJ5.5q.gBOxhoTu9a1ol YS7JJooODsAZGzLkxRPqywqxNfhdD90GGl6Cv1vdiY5tLcyZj9.36usHFw9OycFdghFYT2ZNthhw xZG6rJAybjDdhdwOe.gQvFI4D6pYwMxNWgJygAWsasuAjpiJWC4wbtY938yLx8r_MTJP2M311Qsp mZDJUmVHupYZeNcGklayPDy35RnCpcBIU20QHjf20TF3FFa_51h7ISP0CeaK.pXQW_coBLBxXY3H us5a8sUmJRW.F3edIEgLFlWi6R8I7Nab4F.NkV_LFIJMrmZgroEWrMWlsQsqMsLF7RFGAPglaM0O jxRoblFdgf5ns7Sb7hKiXdQl3r41mbOTyFBJ4XiSpl6CB04xLPJyJ9iOxfYLPP5WrShZUrTPt7AB O7FLJGd01KvBtd3qXvJA6Rl2JoeGyy5L2GGwovRHGWtueDy7MBsDzfKEHafYAx1pj1.IEBODpFKt EI.PjLVgM6y8zD7i2GwKA.YDgwikcYRQw9cW_PLi5QeopGMkmSdbi8B_hszHgu5xoYyg8lMNoE4q DqxVkkSD_MH_cn89VYZbGJvv.Kh.VMhbSyODvDB1jM9iQTgxSwV339gg7EB7KEjnisKSVFAJbh9l KxvuDHDTErj.D5wrnruq8m1yQsvr9gNWmzQyA1qNHcvQIWZiRwLM3JdyRor.iAcqXJHuXqxLSCwu P0aK.OWskhwtC7uViUYDYI1EJi0wa7ezwBen2Ky6Bs69IWb5PPmYYzeXgq.WXATMIlqjGkeQvIqU IVH16urUjcAw2c9BNe8wuGFJEnYnbTWl.Nq4I0tsfuG2S0UtVUBrWCpMx8v0Ibvkp_vSzdqppp0V RZHXzTNTtnnDpJPf07oDyP9E0iSmmdBWj8WjrYZci_Mq7eDVBOQsnTgYbbyZfja1RJuDLwKwzJP2 SqwZqiUwPbnGDkeDmmoYEwWnUncI.08rz35ABdLmf6NKuKDdfvl.81wC34uZoJZFDowCvHwuvMln M85HXvaXsAbBHxr3AjHUY6XzrnScrQvqHdc8.jI.ixuk5ctVlgypC3pgsr8psVYTPcys_ROxvKC7 Msi4- Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.gq1.yahoo.com with HTTP; Sat, 15 Feb 2020 17:25:24 +0000 Received: by smtp407.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 2da6ee850df08da3078401f1852662bf; Sat, 15 Feb 2020 17:25:20 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) Subject: The aarch64 RPi* boot problems and armstub8*.bin vs. u-boot: Robert Crowston's existing-interfacing-definition notes consolidated (reports things I missed) Message-Id: Date: Sat, 15 Feb 2020 09:25:18 -0800 Cc: Ralf Wenk , Andrew Turner , Oleksandr Tymoshenko , Emmanuel Vadot To: Robert Crowston , Kyle Evans , freebsd-arm X-Mailer: Apple Mail (2.3608.60.0.2.5) References: X-Rspamd-Queue-Id: 48KcZt2zJfz4TJS X-Spamd-Bar: - X-Spamd-Result: default: False [-1.47 / 15.00]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; RCPT_COUNT_SEVEN(0.00)[7]; FREEMAIL_TO(0.00)[protonmail.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.53)[-0.532,0]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.44)[-0.440,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (5.21), ipnet: 98.137.64.0/21(0.82), asn: 36647(0.66), country: US(-0.05)]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[30.65.137.98.list.dnswl.org : 127.0.5.0]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Feb 2020 17:25:27 -0000 [My investigation started from complete ignorance of the directly relevant material and I did not identify all the existing interfacing available.] Quoted is material I wrote and that Robert C. replied: >> So it may be sysutils/u-boot-rpi{3,4} that needs to >> arrange sufficient room to prevent messing up such. >> (Unless armstub8*.bin can adjust something that >> u-boot's EFI interface is based on for that initial >> "Reserved" area?) >=20 > The area to be reserved is already passed in register x1 by armstub to = u-boot here: > = https://github.com/gonzoua/rpi3-psci-monitor/blob/master/pscimon.S#L178 I missed that in my looking around for what interfaces propagate appropriate information. > u-boot can read this register before it does anything else in = save_boot_params in lowlevel_init.S. (e.g., = https://github.com/RobCrowston/u-boot/blame/7d1d1ce63c1fe50b451ef0c730e1cd= 870b5bd440/board/raspberrypi/rpi/lowlevel_init.S#L38). Good to know for folks considering what technique to use for a long-term fix. > In a separate message: >=20 >> I put in code to add a reserved memory region >> spanning the 2 pages at the beginning of the >> address space. This is enough to span all the >> armstub8-gic.bin content (that is loaded to >> address 0x0 in my test context). >=20 > I had looked at this when I first getting the armstub to work with the = Rpi4, and indeed I had no idea this was a problem again today. >=20 > In Tymoshenko's u-boot patch for the pi3, we modify the dtb in memory = to reserve these pages, before u-boot communicates the modified dtb to = the operating system. RPi3 contexts were the original reporters of the problem and made the majority of the reports. (I just had access to an RPi4B instead and so worked with that context.) So I do not expect such a patch is currently involved for sysutils/u-boot-rpi3 . My understanding from other messages, is that sysutils/u-boot-master is holding at its current version for other fixes currently in order to avoid breaking other contexts. > I used the same idea = (https://github.com/agherzan/u-boot/commit/7d1d1ce63c1fe50b451ef0c730e1cd8= 70b5bd440) when I first got the rpi4 to boot. Cool. > Does sysutils/u-boot-rpi4 do this as well? sysutils/u-boot-rpi4 has a hard coded: #ifdef CONFIG_EFI_LOADER /* Reserve the spin table */ efi_add_memory_map(0, 1, EFI_RESERVED_MEMORY_TYPE, 0); #endif in ft_board_setup in board/raspberrypi/rpi/rpi.c . That is what currently leads to the first page being avoided by the kernel for my test context. Changing the "1" to a "2" makes the kernel avoid 2 pages, which is currently sufficient. RPi3's are the primary context that started reporting the boot problems so I expect similar for sysutils/u-boot-rpi3 but I had a RPi4B context to work with and only looked at the sysutils/u-boot-rpi4 port that I could test. >> I had done other investigative work earlier to >> find for sure where armstub8-gic.bin was being >> loaded in my example context: address 0x0. >=20 > I am quite sure this is correct. We need the absolute addresses to be = accurate when we spin up the other CPUs. I had no directly relevant background knowledge and and so had the code report where it was put. But I had no background on how uniform the place was across RPi3's and RPi2 v1.2's and such. Glad to know it is uniform. Other relevant folks probably already knew that. > (Apologies if this was already known, the thread has been split and it = is a little hard to follow.) Having future communication avoid the investigative exploration history I went through would be simpler and better. At this point ,there is no reason for any exchange in the subject area to target me as far as I can tell. (Wrong background knowledge.) Kyle E. did recently submit dtc improvements spanning memreserve handling improvements: = https://lists.freebsd.org/pipermail/svn-src-head/2020-February/133765.html= = https://lists.freebsd.org/pipermail/svn-src-head/2020-February/133766.html= =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)