From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: Re: [kvm-unit-tests PATCH v3 3/3] arm/run: introduce usingkvm var and use it Date: Wed, 8 Jul 2015 17:37:32 +0200 Message-ID: <20150708153732.GA3198@hawk.localdomain> References: <1436369020-22489-1-git-send-email-alex.bennee@linaro.org> <1436369020-22489-4-git-send-email-alex.bennee@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org To: Alex =?iso-8859-1?Q?Benn=E9e?= Return-path: Received: from mx1.redhat.com ([209.132.183.28]:54784 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754659AbbGHPhg (ORCPT ); Wed, 8 Jul 2015 11:37:36 -0400 Content-Disposition: inline In-Reply-To: <1436369020-22489-4-git-send-email-alex.bennee@linaro.org> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Jul 08, 2015 at 04:23:40PM +0100, Alex Benn=E9e wrote: > This makes the script a little cleaner by only checking for KVM suppo= rt > in one place. If KVM isn't available we can fall back to TCG emulatio= n > and echo the fact to the screen rather than let QEMU complain. >=20 > Signed-off-by: Alex Benn=E9e >=20 > --- > v2 > - rm redundant M=3D statement > v3 > - make usingkvm use "yes" > - merge patches 3/4 into one > --- > arm/run | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) >=20 > diff --git a/arm/run b/arm/run > index 6b42a2e..cf6e902 100755 > --- a/arm/run > +++ b/arm/run > @@ -8,6 +8,15 @@ fi > source config.mak > processor=3D"$PROCESSOR" > =20 > +# Default to using KVM if available and on the right ARM host > +if [ -c /dev/kvm ]; then > + if [ "$HOST" =3D "arm" ] && [ "$ARCH" =3D "arm" ]; then > + usingkvm=3Dyes > + elif [ "$HOST" =3D "aarch64" ]; then > + usingkvm=3Dyes > + fi > +fi > + > qemu=3D"${QEMU:-qemu-system-$ARCH_NAME}" > qpath=3D$(which $qemu 2>/dev/null) > =20 > @@ -22,6 +31,12 @@ if ! $qemu -machine '?' 2>&1 | grep 'ARM Virtual M= achine' > /dev/null; then > fi > =20 > M=3D'-machine virt' > +if [ "$usingkvm" =3D "yes" ]; then > + M+=3D",accel=3Dkvm" double quotes here > +else > + echo "Running with TCG" > + M+=3D',accel=3Dtcg' single here > +fi but it doesn't matter > =20 > if ! $qemu $M -device '?' 2>&1 | grep virtconsole > /dev/null; then > echo "$qpath doesn't support virtio-console for chr-testdev. Exitin= g." > @@ -34,12 +49,11 @@ if $qemu $M -chardev testdev,id=3Did -initrd . 2>= &1 \ > exit 2 > fi > =20 > -M=3D'-machine virt,accel=3Dkvm:tcg' > chr_testdev=3D'-device virtio-serial-device' > chr_testdev+=3D' -device virtconsole,chardev=3Dctd -chardev testdev,= id=3Dctd' > =20 > # arm64 must use '-cpu host' with kvm > -if [ "$(arch)" =3D "aarch64" ] && [ "$ARCH" =3D "arm64" ] && [ -c /d= ev/kvm ]; then > +if [ "$usingkvm" =3D "yes" ] && [ "$ARCH" =3D "arm64" ]; then > processor=3D"host" > fi > =20 > --=20 > 2.4.5 Reviewed-by: Andrew Jones Thanks, drew >=20 > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html