From cd157f07578f35732ac4de40714ad35d84335507 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 2 Jul 2014 19:11:08 +0100 Subject: [PATCH] Add --accel flag to select KVM or software emulation. It translates directly to the qemu -machine accel=... parameter. --- qemu-sanity-check.in | 9 ++++++++- qemu-sanity-check.pod.in | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/qemu-sanity-check.in b/qemu-sanity-check.in index 848c62f..5bb5b29 100644 --- a/qemu-sanity-check.in +++ b/qemu-sanity-check.in @@ -25,6 +25,7 @@ arch="$(uname -m)" canonical_arch="$(uname -m | sed 's/i[456]86/i386/')" timeout=10m +accel=kvm:tcg # Handle command line parsing. @@ -32,6 +33,7 @@ function usage { echo "qemu-sanity-check [options]" echo "Options:" echo " --help Display this help" + echo " --accel=[kvm|tcg] Force KVM or software emulation" echo " -i|--initrd=initrd Set location of initramfs" echo " -k|--kernel=vmlinuz Set location of kernel" echo " -q|--qemu=qemu Set location of qemu/KVM binary" @@ -43,6 +45,7 @@ function usage { TEMP=$(getopt \ -o i:k:q:t:V \ --long help \ + --long accel: \ --long initrd: \ --long kernel: \ --long qemu: \ @@ -57,6 +60,10 @@ while true; do --help) usage ;; + --accel) + accel="$2" + shift 2 + ;; -i|--initrd) initrd="$2" shift 2 @@ -137,7 +144,7 @@ argv[$((i++))]="-nographic" argv[$((i++))]="-nodefconfig" argv[$((i++))]="-nodefaults" argv[$((i++))]="-machine" -argv[$((i++))]="accel=kvm:tcg" +argv[$((i++))]="accel=$accel" argv[$((i++))]="-no-reboot" argv[$((i++))]="-serial" argv[$((i++))]="file:$test_output" diff --git a/qemu-sanity-check.pod.in b/qemu-sanity-check.pod.in index cff28a4..47d6d43 100644 --- a/qemu-sanity-check.pod.in +++ b/qemu-sanity-check.pod.in @@ -61,6 +61,23 @@ Initrd/initramfs (C) Display short help message and exit. +=item B<--accel>=kvm + +=item B<--accel>=tcg + +=item B<--accel>=kvm:tcg + +This sets the C<-machine accel=...> parameter which is passed to +qemu. + +If not set, then C is the default, which means to try to use +KVM (hardware-assisted virtualization), and fall back to software +emulation if KVM is not possible. + +Other typical values of this parameter are: C, which means to +force software emulation. C, which means to force KVM and fail +if KVM is unavailable. + =item B<-i> INITRD =item B<--initrd>=INITRD -- 1.8.3.1