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

1

6

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?

Burgonet answered 7/12, 2020 at 7:27 Comment(2)
TCG = trusted computing group, i.e. a committee designing standards to "trusted" computing (in the eyes of big it companies, not in the eyes of the end users)Geter
More relevantly here, TCG = Tiny Code Generator, which is the name of QEMU's JIT which it uses for CPU emulation...Collyer
C
12

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).

Collyer answered 7/12, 2020 at 14:24 Comment(4)
Why does qemu have only 'kvm' and 'tgc' on the accel folder? github.com/qemu/qemu/tree/stable-4.2/accelBurgonet
Because the others haven't really been properly refactored into accel/ yet. Notably, the others are all at the moment specific to a particular target architecture, ie x86, so they haven't needed a place to have "common code for this accelerator which is shared across multiple targets". One of the things the work on making hvf support aarch64 targets does is indeed to move a lot of the code into accel/hvf.Collyer
thanks @PeterMaydell... it was the only place where I found this info... and under windows the -whpx really make a difference... a 10x+ difference...Wakayama
it seems like hax is no longer supported per superuser.com/questions/1841980/… / wiki.qemu.org/ChangeLog/8.0Vday

© 2022 - 2024 — McMap. All rights reserved.