From nobody Fri May 19 02:49:03 2023 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QMrrz3NzVz4CKky for ; Fri, 19 May 2023 02:49:07 +0000 (UTC) (envelope-from rivers@dignus.com) Received: from dignus.com (adsl-065-013-223-202.sip.rdu.bellsouth.net [65.13.223.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "office.dignus.com", Issuer "office.dignus.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QMrry0MVCz3DbB for ; Fri, 19 May 2023 02:49:05 +0000 (UTC) (envelope-from rivers@dignus.com) Authentication-Results: mx1.freebsd.org; dkim=none; spf=pass (mx1.freebsd.org: domain of rivers@dignus.com designates 65.13.223.202 as permitted sender) smtp.mailfrom=rivers@dignus.com; dmarc=none Received: from office.dignus.com (localhost [127.0.0.1]) by dignus.com (8.16.1/8.16.1) with ESMTPS id 34J2n3kV029622 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO) for ; Thu, 18 May 2023 22:49:03 -0400 (EDT) (envelope-from rivers@office.dignus.com) X-Authentication-Warning: office.dignus.com: Host localhost [127.0.0.1] claimed to be office.dignus.com Received: (from rivers@localhost) by office.dignus.com (8.16.1/8.16.1/Submit) id 34J2n3hg029621 for freebsd-arm@freebsd.org; Thu, 18 May 2023 22:49:03 -0400 (EDT) (envelope-from rivers) Date: Thu, 18 May 2023 22:49:03 -0400 (EDT) From: Thomas David Rivers Message-Id: <202305190249.34J2n3hg029621@office.dignus.com> To: freebsd-arm@freebsd.org Subject: some QEMU success in running armv7 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on office.dignus.com X-Spamd-Result: default: False [-0.79 / 15.00]; HFILTER_HOSTNAME_4(2.50)[adsl-065-013-223-202.sip.rdu.bellsouth.net]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.99)[-0.985]; R_SPF_ALLOW(-0.20)[+ip4:65.13.223.202:c]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[dignus.com]; MLMMJ_DEST(0.00)[freebsd-arm@freebsd.org]; ARC_NA(0.00)[]; R_DKIM_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROMTLD(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; ASN(0.00)[asn:7018, ipnet:65.13.220.0/22, country:US]; FROM_HAS_DN(0.00)[]; FREEFALL_USER(0.00)[rivers]; TO_DN_NONE(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; HAS_XAW(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; RCVD_TLS_LAST(0.00)[] X-Rspamd-Queue-Id: 4QMrry0MVCz3DbB X-Spamd-Bar: / X-ThisMailContainsUnwantedMimeParts: N List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org Just f.y.i. - here's the steps I was able to deduce today to get FreeBSD armv7 running under qemu... just in case someone goes looking for this... (I was doing this on a FreeBSD 12.3-RELEASE x86_64 system.) 1. Retrieve the armv7 image from: fetch https://download.freebsd.org/releases/arm/armv7/ISO-IMAGES/13.2/FreeBSD-13.2-RELEASE-arm-armv7-GENERICSD.img.xz and unzip it. This is an actual hard-drive image of a working system. 2. Assuming the qemu port has been installed - this command starts that system qemu-system-arm -M virt -m 512m -nographic \ -bios edk2-arm-code.fd \ -hda FreeBSD-13.2-RELEASE-arm-armv7-GENERICSD.img the existing terminal will be the console. There is no networking. There root user's password is 'root'. Unfortunately this doesn't provide networking in the guest. This compilation of QEMU also doesn't support the "-netdev user" mode of networking so I can't take advantage of that. (The FreeBSD 12.3 host is using QEMU emulator version 7.2.0 - from just the pkg install.) However, I found that using this option on qemu: -nic tap,ifname=tap7,script=no,downscript=no got it to use the tap interface on the host to emulate the virtio device to the guest. I also found this discussion regarding alignment issues in the virtio driver in armv7: https://forums.freebsd.org/threads/kernel-panic-on-armv7-with-qemu.89016/#post-610281 that resulted in PR 271288. Apparently it's because of newer versions of QEMU doing a better job at reporting unaligned memory accesses in the guest for the armv7 "ldm" instruction. When I use the tap interface, I did get the exact panic mentioned in the forum and the PR. I did find that specifying the rtl8139 device worked around the panic with the QEMU option: -nic tap,ifname=tap7,script=no,downscript=no,model=rtl8139 by the way - tap7 happens to be a tap device I'd already configured on the host FreeBSD 12.3 system - if you're doing this yourself, it will likely need to be a different tap device, see this write-up for info about how to configure a tap + bridge on your FreeBSD host: http://bsdwiki.reedmedia.net/wiki/networking_qemu_virtual_bsd_systems.html So - it seems a newer version of the armv7 kernel with the patch applied will fix the virtio driver problem, until then, model=rtl8139 works around it and I have networking and everything! - Dave R. - -- rivers@dignus.com Work: (919) 676-0847 Get your mainframe programming tools at http://www.dignus.com