From 2aeb0474e6150d80ce21e5da7d801fa48d586b2b Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Tue, 21 Oct 2025 05:40:22 -0700 Subject: [PATCH] dev: add support for automatic hypervisor.framework usage on macOS --- hack/common.sh | 5 +++++ hack/dev/boot.sh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hack/common.sh b/hack/common.sh index f1b21f1..a75085b 100644 --- a/hack/common.sh +++ b/hack/common.sh @@ -41,3 +41,8 @@ if [ -z "${QEMU_ACCEL}" ] && [ "${TARGET_ARCH}" = "${HOST_ARCH}" ] && grep -E '^flags.*:.+ vmx .*' /proc/cpuinfo >/dev/null; then QEMU_ACCEL="kvm" fi + +if [ "$(uname)" = "Darwin" ] && [ "${TARGET_ARCH}" = "${HOST_ARCH}" ] && + [ "$(sysctl -n kern.hv_support 2>&1 || true)" = "1" ]; then + QEMU_ACCEL="hvf" +fi diff --git a/hack/dev/boot.sh b/hack/dev/boot.sh index 092319a..24488ad 100755 --- a/hack/dev/boot.sh +++ b/hack/dev/boot.sh @@ -19,7 +19,7 @@ elif [ "${TARGET_ARCH}" = "aarch64" ]; then fi if [ -n "${QEMU_ACCEL}" ]; then - set -- "${@}" "-accel" "kvm" + set -- "${@}" "-accel" "${QEMU_ACCEL}" fi if [ "${QEMU_GDB}" = "1" ]; then