From d00387cf23727d775a099265169f364c27140e4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C=E8=A7=82=E5=AF=9F=E6=97=A5=E5=BF=97?= Date: Sun, 19 Oct 2025 13:44:33 +0800 Subject: [PATCH] feat: custom cpu model --- config.example.toml | 1 + src/config.py | 1 + src/qemu.py | 8 ++++---- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config.example.toml b/config.example.toml index db89050..b145686 100644 --- a/config.example.toml +++ b/config.example.toml @@ -14,6 +14,7 @@ enable = false # For Linux users, run `sudo kvm-ok` to check if KVM supported enableHardwareAcceleration = false memorySize = "512M" +cpuModel = "Cascadelake-Server-v5" # Waiting time for wrapper-manager to start timeout = 80 diff --git a/src/config.py b/src/config.py index a472e50..fe34540 100644 --- a/src/config.py +++ b/src/config.py @@ -17,6 +17,7 @@ class LocalInstance(BaseModel): enable: bool = False enableHardwareAcceleration: bool = True memorySize: str = "512M" + cpuModel: str = "Cascadelake-Server-v5" timeout: int = 30 diff --git a/src/qemu.py b/src/qemu.py index e9312ad..86a4fcf 100644 --- a/src/qemu.py +++ b/src/qemu.py @@ -10,10 +10,10 @@ from creart import it from src.config import Config from src.logger import GlobalLogger -ARGUMENTS = ["qemu-system-x86_64", "-machine q35", "-cpu Skylake-Server-v5", f"-m {it(Config).localInstance.memorySize}", - "-display none", "-hda assets/wrapper-manager.qcow2", "-device virtio-net-pci,netdev=net0", - "-netdev user,id=net0,hostfwd=tcp:127.0.0.1:32767-:32767"] -HWACCEL_WIN = "-accel whpx,kernel-irqchip=off" +ARGUMENTS = ["qemu-system-x86_64", "-machine q35", f"-cpu {it(Config).localInstance.cpuModel}", + f"-m {it(Config).localInstance.memorySize}", "-display none", "-hda assets/wrapper-manager.qcow2", + "-device virtio-net-pci,netdev=net0", "-netdev user,id=net0,hostfwd=tcp:127.0.0.1:32767-:32767"] +HWACCEL_WIN = "-accel whpx" HWACCEL_LINUX = "-accel kvm"