From 07579f0c4f0ac8766fe061954b3f886c5ab114ec Mon Sep 17 00:00:00 2001 From: Kroese Date: Mon, 25 Dec 2023 06:03:08 +0100 Subject: [PATCH] fix: CPU features (#265) --- src/cpu.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/cpu.sh b/src/cpu.sh index 92fbc8e..d3a4d3c 100644 --- a/src/cpu.sh +++ b/src/cpu.sh @@ -2,7 +2,9 @@ set -Eeuo pipefail # Docker environment variables + : ${CPU_MODEL:='host'} +: ${CPU_FEATURES:='+ssse3,+sse4.1,+sse4.2'} KVM_ERR="" KVM_OPTS="" @@ -21,14 +23,20 @@ if [[ "$ARCH" == "amd64" && "$KVM" != [Nn]* ]]; then error "KVM acceleration not detected $KVM_ERR, this will cause a major loss of performance." error "See the FAQ on how to enable it, or skip this error by setting KVM=N (not recommended)." [[ "$DEBUG" != [Yy1]* ]] && exit 88 - [[ "$CPU_MODEL" == "host"* ]] && CPU_MODEL="max" + [[ "$CPU_MODEL" == "host"* ]] && CPU_MODEL="max,$CPU_FEATURES" else KVM_OPTS=",accel=kvm -enable-kvm" fi else - [[ "$CPU_MODEL" == "host"* ]] && CPU_MODEL="max" + if [[ "$CPU_MODEL" == "host"* ]]; then + if [[ "$ARCH" == "amd64" ]]; then + CPU_MODEL="max,$CPU_FEATURES" + else + CPU_MODEL="qemu64,$CPU_FEATURES" + fi + fi fi