From 018034d223270e168fd57aff598ff518faacde37 Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Fri, 11 Feb 2022 16:44:36 +0100 Subject: [PATCH] build_library/qemu_template.sh: enable accel=hvf on Macs Macs don't support KVM but have the equivalent HVF machine. Also switch to the more modern q35 machine. The arm64 branch hasn't been tested. Signed-off-by: Jeremi Piotrowski --- build_library/qemu_template.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/build_library/qemu_template.sh b/build_library/qemu_template.sh index 62de9c358d..a9a3dec518 100755 --- a/build_library/qemu_template.sh +++ b/build_library/qemu_template.sh @@ -160,14 +160,23 @@ if [ "${SAFE_ARGS}" -eq 1 ]; then # Disable KVM, for testing things like UEFI which don't like it set -- -machine accel=tcg "$@" else + accel="" + case "$(uname)" in + Linux) + accel=kvm ;; + Darwin) + accel=hvf ;; + *) + die "Unsupported OS" ;; + esac case "${VM_BOARD}+$(uname -m)" in amd64-usr+x86_64) # Emulate the host CPU closely in both features and cores. - set -- -machine accel=kvm -cpu host -smp "${VM_NCPUS}" "$@" ;; + set -- -machine q35,accel=$accel -cpu host -smp "${VM_NCPUS}" "$@" ;; amd64-usr+*) set -- -machine pc-q35-2.8 -cpu kvm64 -smp 1 -nographic "$@" ;; - arm64-usr+aarch64) - set -- -machine virt,accel=kvm,gic-version=3 -cpu host -smp "${VM_NCPUS}" -nographic "$@" ;; + arm64-usr+aarch64|arm64-usr+arm64) + set -- -machine virt,accel=$accel,gic-version=3 -cpu host -smp "${VM_NCPUS}" -nographic "$@" ;; arm64-usr+*) if test "${VM_NCPUS}" -gt 4 ; then VM_NCPUS=4