summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2015-10-22 10:18:37 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-27 07:24:28 +0000
commiteebcbe19b73673292dd949aa2ab2265c19909878 (patch)
tree6a6415779efb0228b29fdaf62659f1631e063192 /scripts
parent135d09454c1bfc7c52cdeacfc0bb9638452c664f (diff)
downloadpoky-eebcbe19b73673292dd949aa2ab2265c19909878.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] (From OE-Core rev: 7f5f8f87a4180a2b05188047c6a05da5571f94e2) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/runqemu31
-rwxr-xr-xscripts/runqemu-internal6
2 files changed, 26 insertions, 11 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 5989507a21..e01d276f7b 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -33,6 +33,7 @@ usage() {
33 echo " nographic - disables video console" 33 echo " nographic - disables video console"
34 echo " serial - enables a serial console on /dev/ttyS0" 34 echo " serial - enables a serial console on /dev/ttyS0"
35 echo " kvm - enables KVM when running qemux86/qemux86-64 (VT-capable CPU required)" 35 echo " kvm - enables KVM when running qemux86/qemux86-64 (VT-capable CPU required)"
36 echo " kvm-vhost - enables KVM with vhost support when running qemux86/qemux86-64 (VT-capable CPU required)"
36 echo " publicvnc - enable a VNC server open to all hosts" 37 echo " publicvnc - enable a VNC server open to all hosts"
37 echo " qemuparams=\"xyz\" - specify custom parameters to QEMU" 38 echo " qemuparams=\"xyz\" - specify custom parameters to QEMU"
38 echo " bootparams=\"xyz\" - specify custom kernel parameters during boot" 39 echo " bootparams=\"xyz\" - specify custom kernel parameters during boot"
@@ -71,6 +72,8 @@ SERIALSTDIO=""
71TCPSERIAL_PORTNUM="" 72TCPSERIAL_PORTNUM=""
72KVM_ENABLED="no" 73KVM_ENABLED="no"
73KVM_ACTIVE="no" 74KVM_ACTIVE="no"
75VHOST_ENABLED="no"
76VHOST_ACTIVE="no"
74 77
75# Determine whether the file is a kernel or QEMU image, and set the 78# Determine whether the file is a kernel or QEMU image, and set the
76# appropriate variables 79# appropriate variables
@@ -170,6 +173,11 @@ while true; do
170 KVM_ENABLED="yes" 173 KVM_ENABLED="yes"
171 KVM_CAPABLE=`grep -q 'vmx\|svm' /proc/cpuinfo && echo 1` 174 KVM_CAPABLE=`grep -q 'vmx\|svm' /proc/cpuinfo && echo 1`
172 ;; 175 ;;
176 "kvm-vhost")
177 KVM_ENABLED="yes"
178 KVM_CAPABLE=`grep -q 'vmx\|svm' /proc/cpuinfo && echo 1`
179 VHOST_ENABLED="yes"
180 ;;
173 "slirp") 181 "slirp")
174 SLIRP_ENABLED="yes" 182 SLIRP_ENABLED="yes"
175 ;; 183 ;;
@@ -270,12 +278,6 @@ if [ "x$KVM_ENABLED" = "xyes" ]; then
270 echo "$YOCTO_KVM_WIKI"; 278 echo "$YOCTO_KVM_WIKI";
271 exit 1; 279 exit 1;
272 fi 280 fi
273 if [ ! -e /dev/vhost-net ]; then
274 echo "Missing virtio net device. Have you inserted vhost-net module?"
275 echo "For further help see:"
276 echo "$YOCTO_PARAVIRT_KVM_WIKI";
277 exit 1;
278 fi
279 if [ -w /dev/kvm -a -r /dev/kvm ]; then 281 if [ -w /dev/kvm -a -r /dev/kvm ]; then
280 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm" 282 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm"
281 KVM_ACTIVE="yes" 283 KVM_ACTIVE="yes"
@@ -285,13 +287,22 @@ if [ "x$KVM_ENABLED" = "xyes" ]; then
285 echo "$YOCTO_KVM_WIKI"; 287 echo "$YOCTO_KVM_WIKI";
286 exit 1; 288 exit 1;
287 fi 289 fi
288 if [ ! -w /dev/vhost-net -o ! -r /dev/vhost-net ]; then 290 if [ "x$VHOST_ENABLED" = "xyes" ]; then
289 if [ "$SLIRP_ENABLED" != "yes" ] ; then 291 if [ ! -e /dev/vhost-net ]; then
292 echo "Missing virtio net device. Have you inserted vhost-net module?"
293 echo "For further help see:"
294 echo "$YOCTO_PARAVIRT_KVM_WIKI";
295 exit 1;
296 fi
297
298 if [ -w /dev/vhost-net -a -r /dev/vhost-net ]; then
299 VHOST_ACTIVE="yes"
300 else
290 echo "You have no rights on /dev/vhost-net." 301 echo "You have no rights on /dev/vhost-net."
291 echo "Please change the ownership of this file as described at:" 302 echo "Please change the ownership of this file as described at:"
292 echo "$YOCTO_PARAVIRT_KVM_WIKI"; 303 echo "$YOCTO_KVM_WIKI";
293 exit 1; 304 exit 1;
294 fi 305 fi
295 fi 306 fi
296fi 307fi
297 308
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
index 13840b3023..38ea965bdf 100755
--- a/scripts/runqemu-internal
+++ b/scripts/runqemu-internal
@@ -267,7 +267,11 @@ else
267 KERNEL_NETWORK_CMD="ip=192.168.7.$n2::192.168.7.$n1:255.255.255.0" 267 KERNEL_NETWORK_CMD="ip=192.168.7.$n2::192.168.7.$n1:255.255.255.0"
268 QEMU_TAP_CMD="-net tap,vlan=0,ifname=$TAP,script=no,downscript=no" 268 QEMU_TAP_CMD="-net tap,vlan=0,ifname=$TAP,script=no,downscript=no"
269 if [ "$KVM_ACTIVE" = "yes" ]; then 269 if [ "$KVM_ACTIVE" = "yes" ]; then
270 QEMU_NETWORK_CMD="-net nic,model=virtio $QEMU_TAP_CMD,vhost=on" 270 if [ "$VHOST_ACTIVE" = "yes" ]; then
271 QEMU_NETWORK_CMD="-net nic,model=virtio $QEMU_TAP_CMD,vhost=on"
272 else
273 QEMU_NETWORK_CMD="-net nic,model=virtio $QEMU_TAP_CMD"
274 fi
271 DROOT="/dev/vda" 275 DROOT="/dev/vda"
272 ROOTFS_OPTIONS="-drive file=$ROOTFS,if=virtio,format=raw" 276 ROOTFS_OPTIONS="-drive file=$ROOTFS,if=virtio,format=raw"
273 else 277 else