arch/run: unify accelerator detection

Use the same mechanism as search_qemu_binary().

The simplified [ "$HOST" = "$ARCH_NAME" ] check will mishandle a case if
you compile for $arch on $arch then try to run it with $other_arch/run,
but that isn't really worth checking.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Message-Id: <20170629142824.13666-1-rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/arm/run b/arm/run
index 6fc9bb6..fd280ee 100755
--- a/arm/run
+++ b/arm/run
@@ -10,26 +10,8 @@
 fi
 processor="$PROCESSOR"
 
-if [ -c /dev/kvm ]; then
-	if [ "$HOST" = "arm" ] && [ "$ARCH" = "arm" ]; then
-		kvm_available=yes
-	elif [ "$HOST" = "aarch64" ]; then
-		kvm_available=yes
-	fi
-fi
-
-if [ "$ACCEL" = "kvm" ] && [ "$kvm_available" != "yes" ]; then
-	echo "KVM is needed, but not available on this host"
-	exit 2
-fi
-
-if [ -z "$ACCEL" ]; then
-	if [ "$kvm_available" = "yes" ]; then
-		ACCEL="kvm"
-	else
-		ACCEL="tcg"
-	fi
-fi
+ACCEL=$(get_qemu_accelerator) ||
+	exit $?
 
 qemu=$(search_qemu_binary) ||
 	exit $?