mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 01:19:23 +01:00
test-runner: Fix the has_virt flag usage
Use the same machine type regardless of has_virt: q35 with accelerators list set to kvm:tcg, this will use KVM if available and fall back to TCG if not available so there's no point checking has_virt. We can't reliably know if KVM is usable anyway: even if the CPU has the virtualization extensions, the support might not be enabled in the QEMU build or there may be no kernel module or we may be calling a different qemu executable than the one supporting KVM. Set CPU type to "host" if KVM available and "max" otherwise because "host" is not supported without KVM. We actually want to emulate the host CPU as closely as possible so that host executables can run even if optimized for the specific CPU. "max" seems to be the new way (since Feb only) to request "host" cpu without KVM. It seems that the idea is for "max" to become same as "host" if KVM is enabled so at some point we will want to switch to using "max" in both cases. The "level=9" flag seems to have been an error, there's no CPU with cpuid max level of 9 and I can't see the purpose of setting the cpuid level other than the host cpu's level. -enable-kvm is redundant with accel=kvm:tcg in current qemu. Again I'm not able to test this patch on a cpu that would be affected by it but I hope this fixes some situations which are currently broken anyway.
This commit is contained in:
parent
a74c34024a
commit
7b45ad220d
@ -213,7 +213,7 @@ static void prepare_sandbox(void)
|
||||
|
||||
static char *const qemu_argv[] = {
|
||||
"",
|
||||
"-machine", "",
|
||||
"-machine", "type=q35,accel=kvm:tcg",
|
||||
"-nodefaults",
|
||||
"-nodefconfig",
|
||||
"-no-user-config",
|
||||
@ -315,21 +315,12 @@ static void start_qemu(void)
|
||||
|
||||
argv[0] = (char *) qemu_binary;
|
||||
|
||||
if (has_virt)
|
||||
argv[2] = "type=q35,accel=kvm:tcg";
|
||||
else
|
||||
argv[2] = "type=q35";
|
||||
|
||||
argv[pos++] = "-kernel";
|
||||
argv[pos++] = (char *) kernel_image;
|
||||
argv[pos++] = "-append";
|
||||
argv[pos++] = (char *) cmdline;
|
||||
|
||||
if (has_virt) {
|
||||
argv[pos++] = "-cpu";
|
||||
argv[pos++] = "host,level=9";
|
||||
argv[pos++] = "-enable-kvm";
|
||||
}
|
||||
argv[pos++] = "-cpu";
|
||||
argv[pos++] = has_virt ? "host" : "max";
|
||||
|
||||
argv[pos] = NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user