From 1b8c3a437be797a69b909752c527a994bae94a38 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 4 Feb 2024 15:03:17 +0100 Subject: [PATCH] feat: Enable L3 cache (#8) --- src/config.sh | 2 +- src/install.sh | 2 +- src/proc.sh | 34 ++++++++++++++++------------------ 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/config.sh b/src/config.sh index 38cd19c..4c9ad0c 100644 --- a/src/config.sh +++ b/src/config.sh @@ -11,7 +11,7 @@ MON_OPTS="-monitor $MONITOR" USB_OPTS="-device $USB -device usb-kbd -device usb-tablet" RAM_OPTS=$(echo "-m $RAM_SIZE" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g') CPU_OPTS="-cpu $CPU_FLAGS -smp $CPU_CORES,sockets=1,dies=1,cores=$CPU_CORES,threads=1" -MAC_OPTS="-machine type=${MACHINE},secure=off,gic-version=3,dump-guest-core=off${KVM_OPTS}" +MAC_OPTS="-machine type=${MACHINE},secure=off,dump-guest-core=off${KVM_OPTS}" 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 -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c" diff --git a/src/install.sh b/src/install.sh index fb97c55..35bf0a5 100644 --- a/src/install.sh +++ b/src/install.sh @@ -34,7 +34,7 @@ BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g') TMP="$STORAGE/${BASE%.*}.tmp" rm -f "$TMP" -MSG="Downloading $BASE ..." +MSG="Downloading $BASE..." info "$MSG" && html "$MSG" /run/progress.sh "$TMP" "Downloading $BASE ([P])..." & diff --git a/src/proc.sh b/src/proc.sh index d87a663..085fea8 100644 --- a/src/proc.sh +++ b/src/proc.sh @@ -5,8 +5,7 @@ set -Eeuo pipefail : "${KVM:="Y"}" : "${CPU_FLAGS:=""}" -: "${CPU_MODEL:="host"}" -: "${MODEL:="cortex-a53"}" +: "${CPU_MODEL:="cortex-a53"}" [[ "$ARCH" != "arm"* ]] && KVM="N" @@ -33,34 +32,33 @@ fi if [[ "$KVM" != [Nn]* ]]; then - CPU_FEATURES="kvm=on" + CPU_MODEL="host" KVM_OPTS=",accel=kvm -enable-kvm" - - if [[ "${BOOT_MODE,,}" == "windows" ]]; then - - [ -n "$CPU_FEATURES" ] && CPU_FEATURES="$CPU_FEATURES," - CPU_FEATURES="$CPU_FEATURES+hypervisor,+invtsc,l3-cache=on,migratable=no,hv_passthrough" - - fi + CPU_FEATURES="kvm=on,l3-cache=on,migratable=no" + WIN_FEATURES="+hypervisor,+invtsc,hv_passthrough" else KVM_OPTS="" - CPU_FEATURES="" + CPU_FEATURES="l3-cache=on" + WIN_FEATURES="+hypervisor,hv_passthrough" + + if [[ "$ARCH" == "arm"* ]]; then + CPU_MODEL="max" + CPU_FEATURES="$CPU_FEATURES,migratable=no" + fi if [[ "${BOOT_MODE,,}" == "windows" ]]; then MACHINE="$MACHINE,virtualization=on" fi - if [[ "${CPU_MODEL,,}" == "host"* ]]; then +fi - if [[ "$ARCH" == "arm"* ]]; then - CPU_MODEL="max" - else - CPU_MODEL="$MODEL" - fi +if [[ "${BOOT_MODE,,}" == "windows" ]]; then + + [ -n "$CPU_FEATURES" ] && CPU_FEATURES="$CPU_FEATURES," + CPU_FEATURES="$CPU_FEATURES${WIN_FEATURES}" - fi fi if [ -z "$CPU_FLAGS" ]; then