Search code examples
macosqemu

hvf accelerator for Apple Silicon in guest systems other than aarch64


I downloaded QEMU via Homebrew (brew install qemu) on a MacBook Pro M2 Pro with MacOS Sonoma. I noticed that the hvf accelerator is not compatible with qemu-system-x86_64. I also explored other guest systems and the only system that supports hvf is qemu-system-aarch64 (i.e., the same architecture as the host system).

According to QEMU's documentation, MacOS should be able to support hvf. Why is this system-dependent? How can I enable hvf for the other systems (if possible at all)?


Solution

  • Hardware acceleration requires that the host CPU and guest CPU are the same architecture -- this is because the guest code is directly running on the host CPU, with no emulation. So on a Mac with Apple Silicon you can run other Arm guests accelerated using qemu-system-aarch64; but you can't run accelerated x86 guests, because the host CPU is not an x86. Conversely, on an older intel Mac, you can use -accel hvf to run accelerated intel guests with qemu-system-x86_64, but you can't run accelerated Arm guests.