qemu: limit cores to 4 in qemu-vexpress (!1797)

qemu-system-vexpress supports 1-4 cores, this clamps the smp core count
to 4 on host machines with more cores.
This commit is contained in:
Martijn Braam 2019-07-01 13:02:33 +02:00 committed by Oliver Smith
parent d604ebd8fe
commit 75411694ff
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -184,6 +184,8 @@ def command_qemu(args, arch, device, img_path, spice_enabled):
raise RuntimeError("DTB file not found: " + dtb_image)
command += ["-dtb", dtb_image]
smp = os.cpu_count()
if arch == "x86_64":
command += ["-serial", "stdio"]
command += ["-drive", "file=" + img_path + ",format=raw"]
@ -193,6 +195,7 @@ def command_qemu(args, arch, device, img_path, spice_enabled):
command += ["-M", "vexpress-a9"]
command += ["-sd", img_path]
command += ["-device", "virtio-net-device,netdev=net0"]
smp = min(smp, 4)
elif arch == "aarch64":
command += ["-M", "virt"]
@ -209,7 +212,7 @@ def command_qemu(args, arch, device, img_path, spice_enabled):
else:
raise RuntimeError("Architecture {} not supported by this command yet.".format(arch))
command += ["-smp", str(os.cpu_count())]
command += ["-smp", str(smp)]
# Kernel Virtual Machine (KVM) support
native = True