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-27 07:24:28 +0000 |
commit | eebcbe19b73673292dd949aa2ab2265c19909878 (patch) | |
tree | 6a6415779efb0228b29fdaf62659f1631e063192 /scripts/runqemu | |
parent | 135d09454c1bfc7c52cdeacfc0bb9638452c664f (diff) | |
download | poky-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/runqemu')
-rwxr-xr-x | scripts/runqemu | 31 |
1 files changed, 21 insertions, 10 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="" | |||
71 | TCPSERIAL_PORTNUM="" | 72 | TCPSERIAL_PORTNUM="" |
72 | KVM_ENABLED="no" | 73 | KVM_ENABLED="no" |
73 | KVM_ACTIVE="no" | 74 | KVM_ACTIVE="no" |
75 | VHOST_ENABLED="no" | ||
76 | VHOST_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 |
296 | fi | 307 | fi |
297 | 308 | ||