From patchwork Fri Jul 31 15:53:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 51786 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 9307222E88 for ; Fri, 31 Jul 2015 15:57:01 +0000 (UTC) Received: by wicmm11 with SMTP id mm11sf9728268wic.3 for ; Fri, 31 Jul 2015 08:57:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding:cc :subject:precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=ODxYctBFpB3S+fgaNCtP94w/piERa3aSm6olElp2KB0=; b=eK/OWavGVUMT8+EFBNlKfQFu/TLRzTJ7qoDNhWpV8/Sr9v63q8d2btTWzG7uqYROj3 MtiTGzdOGnLHQMGhjjuGR4vLEnpp8mwt1zpgOwnBF4KyQLDGY0jwV7NH5HAmpHFgBd7t p17P0e7RmbAjDOyKxXQQniUCbvINKkNqMzbprZRwYKxbu/HVLoU3D+bRZDTt2FOgXcip ZN/m5/porHSIo1bMQKlf+02pdLwaDjf/LJ/38TSgw+N6mHBy4U6C1wIkPVm6FSYvyz/p /chmTCp5HuW1tfRC8011uf8a6ZIQiIj0hstpXFYazQYth0O55rRLBQpw10d0g9vi56g2 9mMQ== X-Gm-Message-State: ALoCoQmhkV9XVn3O+qEecIBbMRGnAaD/HikuNVRHbacVIosg15MChQYNOZD/2LVtQfe8FVGW2HjZ X-Received: by 10.180.83.33 with SMTP id n1mr1382120wiy.4.1438358220844; Fri, 31 Jul 2015 08:57:00 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.3 with SMTP id ky3ls337713lab.70.gmail; Fri, 31 Jul 2015 08:57:00 -0700 (PDT) X-Received: by 10.112.38.106 with SMTP id f10mr3823874lbk.14.1438358220675; Fri, 31 Jul 2015 08:57:00 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id l6si4139199lbm.27.2015.07.31.08.57.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Jul 2015 08:57:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by lafd3 with SMTP id d3so46973726laf.1 for ; Fri, 31 Jul 2015 08:57:00 -0700 (PDT) X-Received: by 10.152.203.134 with SMTP id kq6mr3778578lac.106.1438358220588; Fri, 31 Jul 2015 08:57:00 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp473771lba; Fri, 31 Jul 2015 08:56:59 -0700 (PDT) X-Received: by 10.140.234.146 with SMTP id f140mr5630816qhc.83.1438358218140; Fri, 31 Jul 2015 08:56:58 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 80si6293631qhg.131.2015.07.31.08.56.57 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 31 Jul 2015 08:56:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:44880 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLCg5-0004vL-35 for patch@linaro.org; Fri, 31 Jul 2015 11:56:57 -0400 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) X-Received: by 10.194.10.165 with SMTP id j5mr7640935wjb.147.1438358066440; Fri, 31 Jul 2015 08:54:26 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id fo1sm5071676wib.24.2015.07.31.08.54.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Jul 2015 08:54:24 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 367E53E0D57; Fri, 31 Jul 2015 16:54:23 +0100 (BST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: mttcg@listserver.greensocs.com, mark.burton@greensocs.com, fred.konrad@greensocs.com Date: Fri, 31 Jul 2015 16:53:54 +0100 Message-Id: <1438358041-18021-5-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.5.0 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 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.212.180 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?= Subject: [Qemu-devel] [kvm-unit-tests PATCH v5 04/11] arm/run: introduce usingkvm var and use it X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: alex.bennee@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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