verbose=no
timeout=10m
accel=kvm:tcg
+cpu=
+machine=
+
+# Both libguestfs and virt-manager choose cpu=host when we think that
+# KVM is available, and default otherwise. Although testing for KVM
+# is hairy, I found that on aarch64 it can fail unless we choose
+# cpu=host for KVM.
+if test -r /dev/kvm; then
+ cpu=host
+fi
-# Default machine type depends on arch. You can override this using
-# -m|--machine option.
+# Default machine and CPU type depends on arch. You can override this
+# using -m|--machine and --cpu options.
case "$canonical_arch" in
- arm*|aarch*) machine=virt ;;
- # On non-ARM let qemu pick the default.
- *) machine= ;;
+ arm*)
+ machine=virt ;;
+ aarch*)
+ if [ "$cpu" = "" ]; then cpu=cortex-a57; fi
+ machine=virt ;;
esac
# Handle command line parsing.
echo "Options:"
echo " --help Display this help"
echo " --accel=[kvm|tcg] Force KVM or software emulation"
+ echo " --cpu=cpu Set CPU"
echo " -i|--initrd=initrd Set location of initramfs"
echo " -k|--kernel=vmlinuz Set location of kernel"
echo " -m|--machine=machine Set machine type"
-o i:k:m:q:t:vV \
--long help \
--long accel: \
+ --long cpu: \
--long initrd: \
--long kernel: \
--long machine: \
accel="$2"
shift 2
;;
+ --cpu)
+ cpu="$2"
+ shift 2
+ ;;
-i|--initrd)
initrd="$2"
shift 2
argv[$((i++))]="-nodefaults"
argv[$((i++))]="-machine"
argv[$((i++))]="$machine${machine:+,}accel=$accel"
+if [ "$cpu" != "" ]; then
+ argv[$((i++))]="-cpu"
+ argv[$((i++))]="$cpu"
+fi
argv[$((i++))]="-no-reboot"
argv[$((i++))]="-serial"
argv[$((i++))]="file:$test_output"
force software emulation. C<kvm>, which means to force KVM and fail
if KVM is unavailable.
+=item B<--cpu>=CPU
+
+Set the qemu I<--cpu> option. If not set then a suitable default is
+picked depending on the architecture and whether KVM is available.
+You can also use I<--cpu=> to let qemu pick the default.
+
=item B<-i> INITRD
=item B<--initrd>=INITRD