nixos/lib/qemu-common: Opportunistically use KVM

This will try to use KVM if available and fallback to using TCG if not.
Useful for nested virtualisation of arm on x86.
This commit is contained in:
Max Hausch 2022-04-05 11:49:42 +02:00
parent 1a069f4e72
commit a2465483e8
No known key found for this signature in database
GPG key ID: C19929CA092DD618

View file

@ -23,8 +23,8 @@ rec {
qemuBinary = qemuPkg: {
x86_64-linux = "${qemuPkg}/bin/qemu-kvm -cpu max";
armv7l-linux = "${qemuPkg}/bin/qemu-system-arm -enable-kvm -machine virt -cpu host";
aarch64-linux = "${qemuPkg}/bin/qemu-system-aarch64 -enable-kvm -machine virt,gic-version=host -cpu host";
armv7l-linux = "${qemuPkg}/bin/qemu-system-arm -machine virt,accel=kvm:tcg -cpu max";
aarch64-linux = "${qemuPkg}/bin/qemu-system-aarch64 -machine virt,gic-version=max,accel=kvm:tcg -cpu max";
powerpc64le-linux = "${qemuPkg}/bin/qemu-system-ppc64 -machine powernv";
powerpc64-linux = "${qemuPkg}/bin/qemu-system-ppc64 -machine powernv";
x86_64-darwin = "${qemuPkg}/bin/qemu-kvm -cpu max";