From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLCdk-0000wj-Up for qemu-devel@nongnu.org; Fri, 31 Jul 2015 11:54:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZLCdf-0005tQ-A2 for qemu-devel@nongnu.org; Fri, 31 Jul 2015 11:54:32 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:37229) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLCdf-0005tH-5F for qemu-devel@nongnu.org; Fri, 31 Jul 2015 11:54:27 -0400 Received: by wibud3 with SMTP id ud3so37562949wib.0 for ; Fri, 31 Jul 2015 08:54:26 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Fri, 31 Jul 2015 16:53:54 +0100 Message-Id: <1438358041-18021-5-git-send-email-alex.bennee@linaro.org> In-Reply-To: <1438358041-18021-1-git-send-email-alex.bennee@linaro.org> References: <1438358041-18021-1-git-send-email-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [kvm-unit-tests PATCH v5 04/11] arm/run: introduce usingkvm var and use it List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: mttcg@listserver.greensocs.com, mark.burton@greensocs.com, fred.konrad@greensocs.com Cc: peter.maydell@linaro.org, drjones@redhat.com, kvm@vger.kernel.org, a.spyridakis@virtualopensystems.com, claudio.fontana@huawei.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= This makes the script a little cleaner by only checking for KVM support in one place. If KVM isn't available we can fall back to TCG emulation and echo the fact to the screen rather than let QEMU complain. Signed-off-by: Alex Bennée Reviewed-by: Andrew Jones --- v2 - rm redundant M= statement v3 - make usingkvm use "yes" - merge patches 3/4 into one v4 - use single quotes consistently - add r-b tag --- arm/run | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/arm/run b/arm/run index 6b42a2e..6b3d558 100755 --- a/arm/run +++ b/arm/run @@ -8,6 +8,15 @@ fi source config.mak processor="$PROCESSOR" +# Default to using KVM if available and on the right ARM host +if [ -c /dev/kvm ]; then + if [ "$HOST" = "arm" ] && [ "$ARCH" = "arm" ]; then + usingkvm=yes + elif [ "$HOST" = "aarch64" ]; then + usingkvm=yes + fi +fi + qemu="${QEMU:-qemu-system-$ARCH_NAME}" qpath=$(which $qemu 2>/dev/null) @@ -22,6 +31,12 @@ if ! $qemu -machine '?' 2>&1 | grep 'ARM Virtual Machine' > /dev/null; then fi M='-machine virt' +if [ "$usingkvm" = "yes" ]; then + M+=',accel=kvm' +else + echo "Running with TCG" + M+=',accel=tcg' +fi if ! $qemu $M -device '?' 2>&1 | grep virtconsole > /dev/null; then echo "$qpath doesn't support virtio-console for chr-testdev. Exiting." @@ -34,12 +49,11 @@ if $qemu $M -chardev testdev,id=id -initrd . 2>&1 \ exit 2 fi -M='-machine virt,accel=kvm:tcg' chr_testdev='-device virtio-serial-device' chr_testdev+=' -device virtconsole,chardev=ctd -chardev testdev,id=ctd' # arm64 must use '-cpu host' with kvm -if [ "$(arch)" = "aarch64" ] && [ "$ARCH" = "arm64" ] && [ -c /dev/kvm ]; then +if [ "$usingkvm" = "yes" ] && [ "$ARCH" = "arm64" ]; then processor="host" fi -- 2.5.0