Skip to content

Commit

Permalink
fix: CPU flags
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese committed Jan 21, 2024
1 parent 14cf747 commit b78ae02
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/proc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ set -Eeuo pipefail

: "${KVM:="Y"}"
: "${HOST_CPU:=""}"
: "${CPU_FLAGS:=""}"
: "${CPU_MODEL:="host"}"
: "${CPU_FEATURES:="+ssse3,+sse4.1,+sse4.2"}"

[ "$ARCH" != "amd64" ] && KVM="N"

Expand Down Expand Up @@ -37,6 +37,7 @@ fi

if [[ "$KVM" != [Nn]* ]]; then

CPU_FEATURES="kvm=on"
KVM_OPTS=",accel=kvm -enable-kvm"

if ! grep -qE '^flags.* (sse4_2)' /proc/cpuinfo; then
Expand All @@ -48,15 +49,23 @@ if [[ "$KVM" != [Nn]* ]]; then
else

KVM_OPTS=""
CPU_FEATURES="+ssse3,+sse4.1,+sse4.2"

if [[ "${CPU_MODEL,,}" == "host"* ]]; then

if [[ "$CPU_MODEL" == "host"* ]]; then
if [[ "$ARCH" == "amd64" ]]; then
CPU_MODEL="max,$CPU_FEATURES"
CPU_MODEL="max"
else
CPU_MODEL="qemu64,$CPU_FEATURES"
CPU_MODEL="qemu64"
fi

fi
fi

if [ -z "$CPU_FLAGS" ]; then
CPU_FLAGS="$CPU_MODEL,$CPU_FEATURES"
else
CPU_FLAGS="$CPU_MODEL,$CPU_FEATURES,$CPU_FLAGS"
fi

if [ -z "$HOST_CPU" ]; then
Expand Down

0 comments on commit b78ae02

Please sign in to comment.