Date: Fri, 19 May 2023 09:45:17 +0200 From: Mario Marietto <marietto2008@gmail.com> To: Thomas David Rivers <rivers@dignus.com> Cc: freebsd-arm@freebsd.org Subject: Re: some QEMU success in running armv7 Message-ID: <CA%2B1FSigvF8V-8=iUHdaM-dmRCxXrms4FRfQDqAWFTsb4iEB--w@mail.gmail.com> In-Reply-To: <202305190249.34J2n3hg029621@office.dignus.com> References: <202305190249.34J2n3hg029621@office.dignus.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000de3b2505fc071a08 Content-Type: text/plain; charset="UTF-8" Nice review. infortunately kvm does not work ? and a qemu vm without kvm is very slow and useless. Il ven 19 mag 2023, 04:49 Thomas David Rivers <rivers@dignus.com> ha scritto: > > 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 > > --000000000000de3b2505fc071a08 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto">Nice review. infortunately kvm does not work ? and a qemu= vm without kvm is very slow and useless.</div><br><div class=3D"gmail_quot= e"><div dir=3D"ltr" class=3D"gmail_attr">Il ven 19 mag 2023, 04:49 Thomas D= avid Rivers <<a href=3D"mailto:rivers@dignus.com">rivers@dignus.com</a>&= gt; ha scritto:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:= 0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br> Just f.y.i. - here's the steps I was able to deduce today<br> to get FreeBSD armv7 running under qemu... just in case<br> someone goes looking for this... (I was doing this on a<br> FreeBSD 12.3-RELEASE x86_64 system.)<br> <br> <br> 1.=C2=A0 =C2=A0Retrieve the armv7 image from:<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 fetch <a href=3D"https://download.freebsd.org/r= eleases/arm/armv7/ISO-IMAGES/13.2/FreeBSD-13.2-RELEASE-arm-armv7-GENERICSD.= img.xz" rel=3D"noreferrer noreferrer" target=3D"_blank">https://download.fr= eebsd.org/releases/arm/armv7/ISO-IMAGES/13.2/FreeBSD-13.2-RELEASE-arm-armv7= -GENERICSD.img.xz</a><br> =C2=A0 =C2=A0 =C2=A0and unzip it.=C2=A0 =C2=A0This is an actual hard-drive = image of a working<br> =C2=A0 =C2=A0 =C2=A0system.<br> <br> 2.=C2=A0 Assuming the qemu port has been installed - this command<br> =C2=A0 =C2=A0 starts that system<br> <br> =C2=A0 =C2=A0 qemu-system-arm -M virt -m 512m -nographic \<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0-bios edk2-arm-code.fd \<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0-hda FreeBSD-13.2-RELEASE-arm-armv7-GENERICSD.im= g<br> <br> =C2=A0 =C2=A0 the existing terminal will be the console.=C2=A0 There is no<= br> =C2=A0 =C2=A0 networking.<br> <br> =C2=A0 =C2=A0 There root user's password is 'root'.<br> <br> Unfortunately this doesn't provide networking in the guest.=C2=A0 This<= br> compilation of QEMU also doesn't support the "-netdev user" m= ode<br> of networking so I can't take advantage of that.=C2=A0 (The FreeBSD 12.= 3<br> host is using QEMU emulator version 7.2.0 - from just the pkg <br> install.)=C2=A0 However, I found that using this option on qemu:<br> <br> =C2=A0 =C2=A0 -nic tap,ifname=3Dtap7,script=3Dno,downscript=3Dno<br> <br> got it to use the tap interface on the host to emulate the virtio<br> device to the guest.<br> <br> I also found this discussion regarding alignment issues in the<br> virtio driver in armv7:<br> <br> =C2=A0 <a href=3D"https://forums.freebsd.org/threads/kernel-panic-on-armv7-= with-qemu.89016/#post-610281" rel=3D"noreferrer noreferrer" target=3D"_blan= k">https://forums.freebsd.org/threads/kernel-panic-on-armv7-with-qemu.89016= /#post-610281</a><br> <br> that resulted in PR 271288.=C2=A0 =C2=A0Apparently it's because of newe= r versions<br> of QEMU doing a better job at reporting unaligned memory accesses in the <b= r> guest for the armv7 "ldm" instruction.<br> <br> When I use the tap interface, I did get the exact panic mentioned<br> in the forum and the PR.<br> <br> I did find that specifying the rtl8139 device worked around the panic<br> with the QEMU option:<br> <br> =C2=A0 -nic tap,ifname=3Dtap7,script=3Dno,downscript=3Dno,model=3Drtl8139<b= r> <br> by the way - tap7 happens to be a tap device I'd already configured<br> on the host FreeBSD 12.3 system - if you're doing this yourself,<br> it will likely need to be a different tap device, see this<br> write-up for info about how to configure a tap + bridge on your<br> FreeBSD host:<br> =C2=A0 =C2=A0<a href=3D"http://bsdwiki.reedmedia.net/wiki/networking_qemu_v= irtual_bsd_systems.html" rel=3D"noreferrer noreferrer" target=3D"_blank">ht= tp://bsdwiki.reedmedia.net/wiki/networking_qemu_virtual_bsd_systems.html</a= ><br> <br> So - it seems a newer version of the armv7 kernel with the patch<br> applied will fix the virtio driver problem, until then, model=3Drtl8139<br> works around it and I have networking and everything!<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 - Dave R. -<br> <br> --<br> <a href=3D"mailto:rivers@dignus.com" target=3D"_blank" rel=3D"noreferrer">r= ivers@dignus.com</a>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 Work: (919) 676-0847<br> Get your mainframe programming tools at <a href=3D"http://www.dignus.com" r= el=3D"noreferrer noreferrer" target=3D"_blank">http://www.dignus.com</a><br= > <br> </blockquote></div> --000000000000de3b2505fc071a08--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2B1FSigvF8V-8=iUHdaM-dmRCxXrms4FRfQDqAWFTsb4iEB--w>