From a0a03828fbc49db9f0926cee87d53d627d69bac2 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 6 Apr 2015 20:45:39 -0700 Subject: [PATCH] tools: Add fallback if KVM support is not available --- tools/test-runner.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/test-runner.c b/tools/test-runner.c index 407a985bc..163b61095 100644 --- a/tools/test-runner.c +++ b/tools/test-runner.c @@ -195,7 +195,7 @@ static char *const qemu_argv[] = { "-no-user-config", "-monitor", "none", "-display", "none", - "-machine", "type=q35,accel=kvm", + "-machine", "type=q35,accel=kvm:tcg", "-m", "192M", "-nographic", "-vga", "none", @@ -215,6 +215,16 @@ static char *const qemu_envp[] = { NULL }; +static void check_virtualization(void) +{ + uint32_t ecx; + + __asm__ __volatile__("cpuid" : "=c" (ecx) : "a" (1) : "memory"); + + if (!!(ecx & (1 << 5))) + printf("Found support for Virtual Machine eXtensions\n"); +} + static void start_qemu(void) { char cwd[PATH_MAX], initcmd[PATH_MAX], testargs[PATH_MAX]; @@ -222,6 +232,8 @@ static void start_qemu(void) char **argv; int i, pos; + check_virtualization(); + if (!getcwd(cwd, sizeof(cwd))) strcat(cwd, "/"); -- 2.47.3