diff options
author | Aníbal Limón <anibal.limon@linux.intel.com> | 2015-10-22 10:18:37 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-10-24 12:19:41 +0100 |
commit | 7f5f8f87a4180a2b05188047c6a05da5571f94e2 (patch) | |
tree | a47aee4da1dfa4b2b862d010ce798a949a78438c /scripts | |
parent | 48d78232299735da99137491ae4cbe8faaae3dfb (diff) | |
download | openembedded-core-contrib-7f5f8f87a4180a2b05188047c6a05da5571f94e2.tar.gz |
runqemu: Enable support for kvm without vhost in x86 and x86_64
KVM can be used without vhost so add a new option to runqemu for
use kvm with vhost.
Example,
runqemu qemux86 core-image-minimal kvm # kvm without vhost
runqemu qemux86 core-image-minimal kvm-vhost # kvm with vhost
[YOCTO #7443]
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/runqemu | 31 | ||||
-rwxr-xr-x | scripts/runqemu-internal | 6 |
2 files changed, 26 insertions, 11 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index 5989507a21b..e01d276f7b4 100755 --- a/scripts/runqemu +++ b/scripts/runqemu @@ -33,6 +33,7 @@ usage() { echo " nographic - disables video console" echo " serial - enables a serial console on /dev/ttyS0" echo " kvm - enables KVM when running qemux86/qemux86-64 (VT-capable CPU required)" + echo " kvm-vhost - enables KVM with vhost support when running qemux86/qemux86-64 (VT-capable CPU required)" echo " publicvnc - enable a VNC server open to all hosts" echo " qemuparams=\"xyz\" - specify custom parameters to QEMU" echo " bootparams=\"xyz\" - specify custom kernel parameters during boot" @@ -71,6 +72,8 @@ SERIALSTDIO="" TCPSERIAL_PORTNUM="" KVM_ENABLED="no" KVM_ACTIVE="no" +VHOST_ENABLED="no" +VHOST_ACTIVE="no" # Determine whether the file is a kernel or QEMU image, and set the # appropriate variables @@ -170,6 +173,11 @@ while true; do KVM_ENABLED="yes" KVM_CAPABLE=`grep -q 'vmx\|svm' /proc/cpuinfo && echo 1` ;; + "kvm-vhost") + KVM_ENABLED="yes" + KVM_CAPABLE=`grep -q 'vmx\|svm' /proc/cpuinfo && echo 1` + VHOST_ENABLED="yes" + ;; "slirp") SLIRP_ENABLED="yes" ;; @@ -270,12 +278,6 @@ if [ "x$KVM_ENABLED" = "xyes" ]; then echo "$YOCTO_KVM_WIKI"; exit 1; fi - if [ ! -e /dev/vhost-net ]; then - echo "Missing virtio net device. Have you inserted vhost-net module?" - echo "For further help see:" - echo "$YOCTO_PARAVIRT_KVM_WIKI"; - exit 1; - fi if [ -w /dev/kvm -a -r /dev/kvm ]; then SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm" KVM_ACTIVE="yes" @@ -285,13 +287,22 @@ if [ "x$KVM_ENABLED" = "xyes" ]; then echo "$YOCTO_KVM_WIKI"; exit 1; fi - if [ ! -w /dev/vhost-net -o ! -r /dev/vhost-net ]; then - if [ "$SLIRP_ENABLED" != "yes" ] ; then + if [ "x$VHOST_ENABLED" = "xyes" ]; then + if [ ! -e /dev/vhost-net ]; then + echo "Missing virtio net device. Have you inserted vhost-net module?" + echo "For further help see:" + echo "$YOCTO_PARAVIRT_KVM_WIKI"; + exit 1; + fi + + if [ -w /dev/vhost-net -a -r /dev/vhost-net ]; then + VHOST_ACTIVE="yes" + else echo "You have no rights on /dev/vhost-net." echo "Please change the ownership of this file as described at:" - echo "$YOCTO_PARAVIRT_KVM_WIKI"; + echo "$YOCTO_KVM_WIKI"; exit 1; - fi + fi fi fi diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal index 13840b30235..38ea965bdf8 100755 --- a/scripts/runqemu-internal +++ b/scripts/runqemu-internal @@ -267,7 +267,11 @@ else KERNEL_NETWORK_CMD="ip=192.168.7.$n2::192.168.7.$n1:255.255.255.0" QEMU_TAP_CMD="-net tap,vlan=0,ifname=$TAP,script=no,downscript=no" if [ "$KVM_ACTIVE" = "yes" ]; then - QEMU_NETWORK_CMD="-net nic,model=virtio $QEMU_TAP_CMD,vhost=on" + if [ "$VHOST_ACTIVE" = "yes" ]; then + QEMU_NETWORK_CMD="-net nic,model=virtio $QEMU_TAP_CMD,vhost=on" + else + QEMU_NETWORK_CMD="-net nic,model=virtio $QEMU_TAP_CMD" + fi DROOT="/dev/vda" ROOTFS_OPTIONS="-drive file=$ROOTFS,if=virtio,format=raw" else |