mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-02-18 00:30:47 +01:00
t-runner: Make -enable-kvm param optional
This commit is contained in:
parent
f3f6ebc417
commit
8e6df3ab0b
@ -226,16 +226,19 @@ static char *const qemu_envp[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static void check_virtualization(void)
|
static bool check_virtualization(void)
|
||||||
{
|
{
|
||||||
#if defined(__GNUC__) && (defined(__i386__) || defined(__amd64__))
|
#if defined(__GNUC__) && (defined(__i386__) || defined(__amd64__))
|
||||||
uint32_t ecx;
|
uint32_t ecx;
|
||||||
|
|
||||||
__asm__ __volatile__("cpuid" : "=c" (ecx) : "a" (1) : "memory");
|
__asm__ __volatile__("cpuid" : "=c" (ecx) : "a" (1) : "memory");
|
||||||
|
|
||||||
if (!!(ecx & (1 << 5)))
|
if (!!(ecx & (1 << 5))) {
|
||||||
printf("Found support for Virtual Machine eXtensions\n");
|
printf("Found support for Virtual Machine eXtensions\n");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void start_qemu(void)
|
static void start_qemu(void)
|
||||||
@ -244,8 +247,9 @@ static void start_qemu(void)
|
|||||||
char cmdline[CMDLINE_MAX];
|
char cmdline[CMDLINE_MAX];
|
||||||
char **argv;
|
char **argv;
|
||||||
int i, pos;
|
int i, pos;
|
||||||
|
bool has_virt;
|
||||||
|
|
||||||
check_virtualization();
|
has_virt = check_virtualization();
|
||||||
|
|
||||||
if (!getcwd(cwd, sizeof(cwd)))
|
if (!getcwd(cwd, sizeof(cwd)))
|
||||||
strcat(cwd, "/");
|
strcat(cwd, "/");
|
||||||
@ -285,6 +289,8 @@ static void start_qemu(void)
|
|||||||
argv[pos++] = (char *) kernel_image;
|
argv[pos++] = (char *) kernel_image;
|
||||||
argv[pos++] = "-append";
|
argv[pos++] = "-append";
|
||||||
argv[pos++] = (char *) cmdline;
|
argv[pos++] = (char *) cmdline;
|
||||||
|
|
||||||
|
if (has_virt)
|
||||||
argv[pos++] = "-enable-kvm";
|
argv[pos++] = "-enable-kvm";
|
||||||
|
|
||||||
argv[pos] = NULL;
|
argv[pos] = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user