From owner-freebsd-arm@freebsd.org Fri Jan 1 20:59:50 2021 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 EF56E4D3C7E for ; Fri, 1 Jan 2021 20:59:50 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic309-21.consmr.mail.gq1.yahoo.com (sonic309-21.consmr.mail.gq1.yahoo.com [98.137.65.147]) (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 4D6y864scmz3qmF for ; Fri, 1 Jan 2021 20:59:50 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1609534789; bh=DhuE4YnPGTeStYK9E/UiP5DYGOvwk9MLswiH8d5G0rk=; h=Subject:From:Date:To:From:Subject; b=YMDp89rbZtFUo1i1WL+EqOpp68u4YV7Cnd0JfAizwcW2ZrLtCApwr4bc6iHZPnIXeAKlSAIOEAJoe/Y3ZPS0JEca7zzeE3N0igLY5UBwMBns192JC+bEYp4YzSW7LlSZCORIvkELFxxaPqRu7LUkrmjMjrHI6dLttmUwJaKX54U2l4Hx3N0mkIxQT94e5gYgdthij6hin+bAPRJ/InINaextaWcmzuai7hywk95n/5AmfGybNeRiQhxz9Uhc9bzb9Ka+nmY6a1PyBD05F37tQg0VZEWI1f9+wodMe4D3Q5iuwlJecePbLn1kWLLKFN3eSElQtNsazYs2sUyZgKO7dQ== X-YMail-OSG: mqNGG8MVM1kUEZXk1TguLsVzTeON1uW1rjDSvTuTUvb7zXnuRyuZCwrjplAYTVQ a6nX7OjJQ7laoN1WdND.1YKO9r6gyHUUOdIfSzaBqSt6fqgxxqkoz5R7TIM.sH8M8ptl5egqfVxc ViwkJvpKT7d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0qEP1PaWOSUMjdtz5o8anR9nsmpeuCGJFz3adA06Os6sCUp0rFav6 MviPej9KWACWoee.FnAL_Jl3lIOCWf7_zZXF_RK6v2Rufgtqjx0fZet2k9TQu0s.uu8SZCdClHtk qanoBx0tCCknn1t9oSk_KJY.StQ_8cMX0HPsgdAwKdXJmZSIFNznxxUbqK79USWDD3bmr5yL3Ksj 2MKdFl1b7KY5zjvxI3w5WxA3tPYE9U8ASOhRf7H75xAKKrhIWVuL8_jVXrQp0hF6XM3s_s7I0IuG JutSc25ki9jmv7mFkhsmGS_4ScN5VE7iquZ17jYx8jlvFydWApYpvhNr3b_q7G6ZNH9FQjij3Wah XmFgrllbx2Alrn2VT1potRgt5Y5tUUOg- Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.gq1.yahoo.com with HTTP; Fri, 1 Jan 2021 20:59:49 +0000 Received: by smtp406.mail.bf1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 4ea31491c80c806ddecef0ced831b0b5; Fri, 01 Jan 2021 20:59:47 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Subject: Re: RPi4b 8GB 13.0-Current, XHCI broken, wrong U-Boot ? From: Mark Millard In-Reply-To: Date: Fri, 1 Jan 2021 12:59:45 -0800 Cc: Robert Crowston , freebsd-arm Content-Transfer-Encoding: quoted-printable Message-Id: References: <007c8658-b7b6-6852-536c-9c36af64506b@ip-ether.net> To: Kyle Evans X-Mailer: Apple Mail (2.3654.40.0.2.32) X-Rspamd-Queue-Id: 4D6y864scmz3qmF X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jan 2021 20:59:51 -0000 On 2021-Jan-1, at 10:24, Kyle Evans wrote: > On Fri, Jan 1, 2021 at 11:05 AM Robert Crowston via freebsd-arm > wrote: >>=20 >> The u-boot output is not a smoking gun; the u-boot version packaged = up there did not have the driver in it. The freebsd driver is separate = and does not depend on u-boot. >>=20 >> As I recall, that warning indicates that we tried, but failed to load = the firmware, which I haven=E2=80=99t seen in the wild before. Could you = try booting in verbose mode? >>=20 >> Do you know what version of USB firmware is installed on the Pi? = Alternatively, when did you purchase this hardware? (My suspicion is = that the Pi foundation moved the goalposts again ...) >>=20 >> You say this works fine with the UEFI boot? If you can use boot with = that one, it would be good to see if it works. >>=20 >> Re: state of the pi 4, I guess we should bundle up a proper image of = it, either for USB drive or SD Card, instead of telling users to perform = all this surgery. >>=20 >=20 > What surgery are you referring to here? The -RPI image OP tried from > the 24th is one that should boot as-is on all arm64 RPi variants > without modification using the upstream U-Boot rpi arm64 config and a > consolidated config.txt that conditionally does what's needed for the > RPi4. I'm not aware of any unpatched version of u-boot for FreeBSD yet that has bdinfo showing u-boot itself reserving all the RAM required for armstub8-gic.bin and its operation --so that u-boot guarantees to not touch that RAM. This is a different issue from the one of keeping the FreeBSD kernel from touching RAM it should not touch. In essence armstub_rsrvd is not being respected because it is ignored. (I might misremember the terminology but the wording is suggestive.) An example from u-boot bdinfo output is: lmb_dump_all: memory.cnt =3D 0x3 memory.size =3D 0x0 memory.reg[0x0].base =3D 0x0 .size =3D 0x3e000000 memory.reg[0x1].base =3D 0x40000000 .size =3D 0xbc000000 memory.reg[0x2].base =3D 0x100000000 .size =3D 0x100000000 reserved.cnt =3D 0x2 reserved.size =3D 0x0 reserved.reg[0x0].base =3D 0x0 .size =3D 0x1000 reserved.reg[0x1].base =3D 0x3db4bb30 .size =3D 0x4b44d0 I reported the above as a hypothesis for something that might have been involved in the fairly early "Synchronous Abort" crashes that I reported on the lists sometime around 2020-Dec-17 or so for my attempt to use /usr/local/share/u-boot/u-boot-rpi-arm64/u-boot.bin to set up a 8GiByte RPi4B. (My initial report confused the u-boot vs. FreeBSD kernel issue and I later replied noting that mistake.) Back in mid 2020-Oct I had written and posted patches for this lack of reservation but I was unsure about its upstream viability: QUOTE (There may be whitespace issues.) I doubt that the patches below are appropriate to upstream in some respects. It is more targeted at being a sysutils/u-boot-rpi[34] patch because what armstub8*.bin supplies in x1 seems specific to the armstub8*.bin FreeBSD uses. . . . # more = /usr/ports/sysutils/u-boot-rpi4/files/patch-board__raspberrypi__rpi__lowle= vel_init.S=20 --- board/raspberrypi/rpi/lowlevel_init.S.orig 2020-10-05 = 08:15:32.000000000 -0700 +++ board/raspberrypi/rpi/lowlevel_init.S 2020-10-13 = 11:33:39.273950000 -0700 @@ -18,9 +18,22 @@ #ifdef CONFIG_ARM64 adr x8, fw_dtb_pointer str x0, [x8] +#if defined(CONFIG_EFI_LOADER) + /* Setup to allow reserving the stack and such that is */ + /* after the likes of FreeBSD armstub8-gic.bin in RAM. */ + adr x8, armstub_rsrvd + str x1, [x8] +#endif #else ldr r8, =3Dfw_dtb_pointer str r2, [r8] +#if defined(CONFIG_EFI_LOADER) +#error "Before aarch64 does not use armstub*.bin files" + /* Setup to allow reserving the stack and such that is */ + /* after the likes of a armstub*.bin in RAM. */ + ldr r8, =3Darmstub_rsrvd + str r3, [r8] +#endif #endif /* Returns */ # more = /usr/ports/sysutils/u-boot-rpi4/files/patch-board__raspberrypi__rpi__rpi.c= =20 --- board/raspberrypi/rpi/rpi.c.orig 2020-10-05 08:15:32.000000000 = -0700 +++ board/raspberrypi/rpi/rpi.c 2020-10-13 11:02:15.582706000 -0700 @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -33,6 +34,7 @@ * does not get cleared later. */ unsigned long __section(".data") fw_dtb_pointer; +unsigned long __section(".data") armstub_rsrvd; /* TODO(sjg@chromium.org): Move these to the msg.c file */ struct msg_get_arm_mem { @@ -494,4 +496,29 @@ #endif return 0; +} + +void board_lmb_reserve(struct lmb *lmb) +{ +#ifdef CONFIG_EFI_LOADER + /* + * NOTE: lmb_reserve (and more) does not deal with overlaps with + * pre-existing reservations. + * But board_lmb_reserve is called before the original + * first-page is added. So use knowledge of what will = happen + * later to avoid overlaps. + */ + + phys_addr_t base =3D 0x0u; + phys_addr_t size =3D CONFIG_RPI_EFI_NR_SPIN_PAGES << = EFI_PAGE_SHIFT; + if (size < armstub_rsrvd) size =3D armstub_rsrvd; + + if (size <=3D EFI_PAGE_SIZE) return; + + /* Avoid future overlap */ + base +=3D EFI_PAGE_SIZE; + size -=3D EFI_PAGE_SIZE; + + lmb_reserve(lmb, base, size); +#endif } ENDQUOTE =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)