From d30e889094e87ac93225ae701e36189c1d9816db Mon Sep 17 00:00:00 2001 From: Kroese Date: Mon, 5 Feb 2024 07:07:53 +0100 Subject: [PATCH] fix: Custom CPU model --- src/proc.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/proc.sh b/src/proc.sh index 854affee..3080e8b5 100644 --- a/src/proc.sh +++ b/src/proc.sh @@ -5,8 +5,8 @@ set -Eeuo pipefail : "${KVM:="Y"}" : "${CPU_FLAGS:=""}" +: "${CPU_MODEL:=""}" : "${DEF_MODEL:="qemu64"}" -: "${CPU_MODEL:="$DEF_MODEL"}" [ "$ARCH" != "amd64" ] && KVM="N" @@ -37,7 +37,7 @@ fi if [[ "$KVM" != [Nn]* ]]; then - if [[ "$CPU_MODEL" == "$DEF_MODEL" ]]; then + if [ -z "$CPU_MODEL" ]; then CPU_MODEL="host" fi @@ -52,11 +52,16 @@ else WIN_FEATURES="+hypervisor,hv_passthrough" if [[ "$ARCH" == "amd64" ]]; then - if [[ "$CPU_MODEL" == "$DEF_MODEL" ]]; then + KVM_OPTS=" -accel tcg,thread=multi" + fi + + if [ -z "$CPU_MODEL" ]; then + if [[ "$ARCH" == "amd64" ]]; then CPU_MODEL="max" + CPU_FEATURES="$CPU_FEATURES,migratable=no" + else + CPU_MODEL="$DEF_MODEL" fi - KVM_OPTS=" -accel tcg,thread=multi" - CPU_FEATURES="$CPU_FEATURES,migratable=no" fi CPU_FEATURES="$CPU_FEATURES,+ssse3,+sse4.1,+sse4.2"