Search code examples
macosvirtual-machineqemukvmhaxm

How can Qemu run on macOS and Windows with hardware virtualization?


Qemu can be installed on Windows and macOS. I understand that Qemu has support for KVM and TCG (which is not hardware assisted virtualization). So, if I install Qemu on macOS and Windows, will it use TCG?

I suppose Windows and macOS have their own virtualization extensions on the kernel, just live KVM.

I know that in windows this solution is hyper-v or HAXM, don't know the difference. It looks like Qemu supports it.

What about macOS?


Solution

  • By default QEMU will use TCG (ie pure emulation), but it supports different possible hardware accelerators on different host OSes. The QEMU command line option "-accel help" will tell you which ones have been compiled into a particular QEMU binary, and you can use "-accel name-of-accelerator" to enable the one you want. Not all are available on all hosts. On Linux you can use KVM, and this is the oldest and best tested of the "use the host CPU's hardware virtualization support" accelerators. Also supported are "hax" (intel HAXM), "hvf" (macOS Hypervisor.framework), and "whpx" (Windows Hypervisor Platform).

    In all cases, the guest CPU architecture must be the same as the host CPU architecture (eg x86-on-x86, or arm-on-arm), and there must be specific support in QEMU for using a particular accelerator on the architecture you care about (for instance as of late 2020 we support Hypervisor.framework only for x86), and the accelerator itself might be host-OS specific (eg "whpx" is Windows hosts only).