> From: Morgan Aldridge <morg...@makkintosshu.com> > Date: Sun, 23 May 2021 11:59:36 -0400 > > I've built `qemu` from source on macOS 11.3.1 with v8 of the Apple > Silicon support patchset[0], as follows: > > $ /bin/bash -c "$(curl -fsSL > https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" > $ brew install ninja pkgconfig glib pixman gnutls libssh libslirp > libpng zstd libusb libjpeg > $ cd ~/Projects > $ git clone https://git.qemu.org/git/qemu.git > $ cd qemu > $ git checkout master -b wip/hvf > $ curl 'https://patchwork.kernel.org/series/485309/mbox/' | git am --3way > $ curl > 'https://patchew.org/QEMU/ca+pcdy09+oqfxq3ymrnuqe59acoq7py2q4hqowgq4pnepcx...@mail.gmail.com/mbox' > | git am --3way > $ mkdir build && cd build > $ ../configure --target-list=aarch64-softmmu,x86_64-softmmu,i386-softmmu > --enable-cocoa > $ make -j 8 > > Then downloaded the latest QEMU EFI, plus OpenBSD 6.9/arm64 installer: > > $ curl -O > 'http://releases.linaro.org/components/kernel/uefi-linaro/latest/release/qemu64/QEMU_EFI.fd' > $ curl -O 'https://cdn.openbsd.org/pub/OpenBSD/6.9/arm64/install69.img > > And attempted to boot qemu, as follows: > > $ ./qemu-img create -f qcow2 openbsd-arm64.qcow2 10G > $ ./qemu-system-aarch64 \ > -M virt,highmem=off \ > -accel hvf \ > -m 512 \ > -cpu cortex-a72 \ > -bios QEMU_EFI.fd \ > -drive file=install69.img,format=raw,id=drive1 \ > -drive file=openbsd-arm64.qcow2,if=none,id=drive0,format=qcow2 \ > -device virtio-blk-device,drive=drive0 \ > -nographic \ > -serial tcp::4450,server,telnet,wait > $ telnet localhost 4450 > disks: sd0* sd1 sd2 sd3 > >> OpenBSD/arm64 BOOTAA64 1.4 > boot> > NOTE: random seed is being reused. > booting sd0a:/bsd: 8751984+1790920+569116+830804 > [636827+109+1074216+628691]=0xf91440 > > And qemu crashes with the following error: > > Assertion failed: (isv), function hvf_vcpu_exec, file > ../target/arm/hvf/hvf.c, line 869. > > I can successfully boot & install if I exclude `-accel hvf`. > > Not sure if anyone has any thoughts or advice on further debugging > this, but it'd be appreciated. I'm just experimenting to try to > provide useful bug reports to eventually see OpenBSD booting on > Hypervisor.framework on M1 as this is required for virtualizing on > macOS 11 Big Sur.
This is a bug in that patchset. The hardware traps certain cache maintenance instructions that OpenBSD uses and QEMU doesn't emulate those. I think emulation of those instructions can be as simple as just skipping them. I had a hack that implemented that and OpenBSD booted but ran into another issue. I think that other issue has since been fixed, but as long as that patch hasn't been integrated into QEMU it is a bit hard to submit bug reports and patches for it...