Skip to content

kvm arm32-on-arm64

I'm trying to run debvm armhf images on an arm64 host with KVM acceleration.

Currently the logic behind activating KVM seems incorrect, and we'd need to use qemu-system-aarch64 -cpu host,aarch64=off instead of qemu-system-arm (https://wiki.debian.org/Arm64Qemu).

Here's a crude proof-of-concept that enables KVM acceleration in that configuration:

--- /usr/bin/debvm-run.dist	2025-06-26 19:04:56.000000000 +0200
+++ /usr/bin/debvm-run	2025-10-15 13:27:44.506494970 +0200
@@ -380,6 +380,7 @@
 		MACHINE="type=q35"
 	;;
 	arm)
+		QEMU=qemu-system-aarch64
 		CPU=max
 		MACHINE="type=virt,highmem=off"
 		MAX_SMP=8
@@ -435,7 +436,7 @@
 		"$@"
 fi
 
-ENABLE_KVM=no
+ENABLE_KVM=yes
 if test "$ARCHITECTURE" = "$KERNELARCH"; then
 	ENABLE_KVM=yes
 	case "$VMARCH:$KERNELARCH" in
@@ -456,7 +457,7 @@
 	# While kvm will fall back gracefully, only override CPU when we expect
 	# kvm to work.
 	if test -w /dev/kvm; then
-		CPU=max
+		CPU=host,aarch64=off
 		# kvm: "max" will become "host", intended.
 		# tcg: "max" will actually work, "host" would not.
 	fi

I am not sure if that's something debvm-run wants to support, and I have trouble understanding the test "$ARCHITECTURE" = "$KERNELARCH" bit which evaluates to test arm64 = arm here; otherwise I'm available to propose a mergeable patch :)

Edited by Sylvain Beucler
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information