diff mbox

[kvm-unit-tests,4/7] run/arm: introduce usingkvm var and use it

Message ID 1435931327-8073-5-git-send-email-alex.bennee@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Bennée July 3, 2015, 1:48 p.m. UTC
This makes it easier to force KVM off in later patches.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 arm/run | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Andrew Jones July 6, 2015, 1:02 p.m. UTC | #1
On Fri, Jul 03, 2015 at 02:48:44PM +0100, Alex Bennée wrote:
> This makes it easier to force KVM off in later patches.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  arm/run | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/arm/run b/arm/run
> index 6b42a2e..493ce0d 100755
> --- a/arm/run
> +++ b/arm/run
> @@ -8,6 +8,16 @@ fi
>  source config.mak
>  processor="$PROCESSOR"
>  
> +# Default to using KVM if available and on the right ARM host
> +usingkvm=0
> +if [ -c /dev/kvm ]; then
> +	if [ "$HOST" = "arm" ] && [ "$ARCH" = "arm" ]; then
> +		usingkvm=1
> +	elif [ "$HOST" = "aarch64" ]; then
> +		usingkvm=1
> +	fi
> +fi
> +
>  qemu="${QEMU:-qemu-system-$ARCH_NAME}"
>  qpath=$(which $qemu 2>/dev/null)
>  
> @@ -39,7 +49,7 @@ 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 = 1 ] && [ "$ARCH" = "arm64" ]; then
>  	processor="host"
>  fi

Looks good.

>  
> -- 
> 2.4.5
> 
> --
> 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
--
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
diff mbox

Patch

diff --git a/arm/run b/arm/run
index 6b42a2e..493ce0d 100755
--- a/arm/run
+++ b/arm/run
@@ -8,6 +8,16 @@  fi
 source config.mak
 processor="$PROCESSOR"
 
+# Default to using KVM if available and on the right ARM host
+usingkvm=0
+if [ -c /dev/kvm ]; then
+	if [ "$HOST" = "arm" ] && [ "$ARCH" = "arm" ]; then
+		usingkvm=1
+	elif [ "$HOST" = "aarch64" ]; then
+		usingkvm=1
+	fi
+fi
+
 qemu="${QEMU:-qemu-system-$ARCH_NAME}"
 qpath=$(which $qemu 2>/dev/null)
 
@@ -39,7 +49,7 @@  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 = 1 ] && [ "$ARCH" = "arm64" ]; then
 	processor="host"
 fi