mirror of
https://github.com/AuxXxilium/arv-v-dsm.git
synced 2024-11-23 23:10:58 +07:00
feat: CPU flags (#586)
This commit is contained in:
parent
1e13258bc9
commit
0c74201eb4
@ -3,8 +3,8 @@ set -Eeuo pipefail
|
|||||||
|
|
||||||
DEF_OPTS="-nodefaults -boot strict=on"
|
DEF_OPTS="-nodefaults -boot strict=on"
|
||||||
RAM_OPTS=$(echo "-m $RAM_SIZE" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g')
|
RAM_OPTS=$(echo "-m $RAM_SIZE" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g')
|
||||||
CPU_OPTS="-cpu $CPU_MODEL -smp $CPU_CORES,sockets=1,dies=1,cores=$CPU_CORES,threads=1"
|
CPU_OPTS="-cpu $CPU_FLAGS -smp $CPU_CORES,sockets=1,dies=1,cores=$CPU_CORES,threads=1"
|
||||||
MAC_OPTS="-machine type=q35,usb=off,dump-guest-core=off,hpet=off${KVM_OPTS}"
|
MAC_OPTS="-machine type=q35,usb=off,vmport=off,dump-guest-core=off,hpet=off${KVM_OPTS}"
|
||||||
DEV_OPTS="-device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4"
|
DEV_OPTS="-device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4"
|
||||||
DEV_OPTS="$DEV_OPTS -object rng-random,id=objrng0,filename=/dev/urandom"
|
DEV_OPTS="$DEV_OPTS -object rng-random,id=objrng0,filename=/dev/urandom"
|
||||||
DEV_OPTS="$DEV_OPTS -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c"
|
DEV_OPTS="$DEV_OPTS -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c"
|
||||||
|
19
src/proc.sh
19
src/proc.sh
@ -5,8 +5,8 @@ set -Eeuo pipefail
|
|||||||
|
|
||||||
: "${KVM:="Y"}"
|
: "${KVM:="Y"}"
|
||||||
: "${HOST_CPU:=""}"
|
: "${HOST_CPU:=""}"
|
||||||
|
: "${CPU_FLAGS:=""}"
|
||||||
: "${CPU_MODEL:="host"}"
|
: "${CPU_MODEL:="host"}"
|
||||||
: "${CPU_FEATURES:="+ssse3,+sse4.1,+sse4.2"}"
|
|
||||||
|
|
||||||
[ "$ARCH" != "amd64" ] && KVM="N"
|
[ "$ARCH" != "amd64" ] && KVM="N"
|
||||||
|
|
||||||
@ -37,6 +37,7 @@ fi
|
|||||||
|
|
||||||
if [[ "$KVM" != [Nn]* ]]; then
|
if [[ "$KVM" != [Nn]* ]]; then
|
||||||
|
|
||||||
|
CPU_FEATURES="kvm=on"
|
||||||
KVM_OPTS=",accel=kvm -enable-kvm"
|
KVM_OPTS=",accel=kvm -enable-kvm"
|
||||||
|
|
||||||
if ! grep -qE '^flags.* (sse4_2)' /proc/cpuinfo; then
|
if ! grep -qE '^flags.* (sse4_2)' /proc/cpuinfo; then
|
||||||
@ -48,15 +49,23 @@ if [[ "$KVM" != [Nn]* ]]; then
|
|||||||
else
|
else
|
||||||
|
|
||||||
KVM_OPTS=""
|
KVM_OPTS=""
|
||||||
|
CPU_FEATURES="+ssse3,+sse4.1,+sse4.2"
|
||||||
|
|
||||||
|
if [[ "${CPU_MODEL,,}" == "host"* ]]; then
|
||||||
|
|
||||||
if [[ "$CPU_MODEL" == "host"* ]]; then
|
|
||||||
if [[ "$ARCH" == "amd64" ]]; then
|
if [[ "$ARCH" == "amd64" ]]; then
|
||||||
CPU_MODEL="max,$CPU_FEATURES"
|
CPU_MODEL="max"
|
||||||
else
|
else
|
||||||
CPU_MODEL="qemu64,$CPU_FEATURES"
|
CPU_MODEL="qemu64"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$CPU_FLAGS" ]; then
|
||||||
|
CPU_FLAGS="$CPU_MODEL,$CPU_FEATURES"
|
||||||
|
else
|
||||||
|
CPU_FLAGS="$CPU_MODEL,$CPU_FEATURES,$CPU_FLAGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$HOST_CPU" ]; then
|
if [ -z "$HOST_CPU" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user