From cfb19b10c635d9fbd8587fad6d95aef2e377e830 Mon Sep 17 00:00:00 2001 From: Tk-Glitch Date: Tue, 30 Mar 2021 17:08:19 +0200 Subject: [PATCH] Add support for versioned x86-64 optimizations and zen3 from Graysky's CPU opts patchset (depends on GCC11) --- customization.cfg | 9 +++++++-- linux-tkg-config/prepare | 26 ++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/customization.cfg b/customization.cfg index 5113c5b..c854a0d 100644 --- a/customization.cfg +++ b/customization.cfg @@ -138,12 +138,17 @@ _zenify="true" _compileroptlevel="1" # CPU compiler optimizations - Defaults to prompt at kernel config if left empty -# AMD CPUs : "k8" "k8sse3" "k10" "barcelona" "bobcat" "jaguar" "bulldozer" "piledriver" "steamroller" "excavator" "zen" "zen2" +# AMD CPUs : "k8" "k8sse3" "k10" "barcelona" "bobcat" "jaguar" "bulldozer" "piledriver" "steamroller" "excavator" "zen" "zen2" "zen3" (zen3 opt support depends on GCC11) # Intel CPUs : "mpsc"(P4 & older Netburst based Xeon) "atom" "core2" "nehalem" "westmere" "silvermont" "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylakex" "cannonlake" "icelake" "goldmont" "goldmontplus" "cascadelake" "cooperlake" "tigerlake" # Other options : -# - "generic" (to share the package between machines with different CPUs) # - "native_amd" (use compiler autodetection - Selecting your arch manually in the list above is recommended instead of this option) # - "native_intel" (use compiler autodetection and will prompt for P6_NOPS - Selecting your arch manually in the list above is recommended instead of this option) +# - "generic" (kernel's default - to share the package between machines with different CPU µarch as long as they are x86-64) +# +# https://en.wikipedia.org/wiki/X86-64#Microarchitecture_Levels) +# - "generic_v2" (depends on GCC11 - to share the package between machines with different CPU µarch supporting at least x86-64-v2 +# - "generic_v3" (depends on GCC11 - to share the package between machines with different CPU µarch supporting at least x86-64-v3 +# - "generic_v4" (depends on GCC11 - to share the package between machines with different CPU µarch supporting at least x86-64-v4 _processor_opt="" # MuQSS only - Make IRQ threading compulsory (FORCE_IRQ_THREADING) - Default is "false" diff --git a/linux-tkg-config/prepare b/linux-tkg-config/prepare index c41ede6..e91e04d 100644 --- a/linux-tkg-config/prepare +++ b/linux-tkg-config/prepare @@ -654,12 +654,34 @@ CONFIG_DEBUG_INFO_BTF_MODULES=y\n echo "# CONFIG_MNATIVE_INTEL is not set" >> ./.config fi - if [ -n "$_processor_opt" ] && [ "$_processor_opt" != "generic" ]; then + if [ -n "$_processor_opt" ] && [[ "$_processor_opt" != generic* ]]; then sed -i -e 's/CONFIG_GENERIC_CPU=y/# CONFIG_GENERIC_CPU is not set/' ./.config + echo "# CONFIG_GENERIC_CPU2 is not set" >> ./.config + echo "# CONFIG_GENERIC_CPU3 is not set" >> ./.config + echo "# CONFIG_GENERIC_CPU4 is not set" >> ./.config + elif [ -n "$_processor_opt" ] && [ "$_processor_opt" = "genericv2" ]; then + sed -i -e 's/CONFIG_GENERIC_CPU=y/# CONFIG_GENERIC_CPU is not set/' ./.config + echo "CONFIG_GENERIC_CPU2=y" >> ./.config + echo "# CONFIG_GENERIC_CPU3 is not set" >> ./.config + echo "# CONFIG_GENERIC_CPU4 is not set" >> ./.config + elif [ -n "$_processor_opt" ] && [ "$_processor_opt" = "genericv3" ]; then + sed -i -e 's/CONFIG_GENERIC_CPU=y/# CONFIG_GENERIC_CPU is not set/' ./.config + echo "# CONFIG_GENERIC_CPU2 is not set" >> ./.config + echo "CONFIG_GENERIC_CPU3=y" >> ./.config + echo "# CONFIG_GENERIC_CPU4 is not set" >> ./.config + elif [ -n "$_processor_opt" ] && [ "$_processor_opt" = "genericv4" ]; then + sed -i -e 's/CONFIG_GENERIC_CPU=y/# CONFIG_GENERIC_CPU is not set/' ./.config + echo "# CONFIG_GENERIC_CPU2 is not set" >> ./.config + echo "# CONFIG_GENERIC_CPU3 is not set" >> ./.config + echo "CONFIG_GENERIC_CPU4=y" >> ./.config + else + echo "# CONFIG_GENERIC_CPU2 is not set" >> ./.config + echo "# CONFIG_GENERIC_CPU3 is not set" >> ./.config + echo "# CONFIG_GENERIC_CPU4 is not set" >> ./.config fi _cpu_marchs=("k8" "k8sse3" "k10" "barcelona" "bobcat" "jaguar" "bulldozer" "piledriver") - _cpu_marchs+=("steamroller" "excavator" "zen" "zen2" "mpsc" "atom" "core2" "nehalem" "westmere") + _cpu_marchs+=("steamroller" "excavator" "zen" "zen2" "zen3" "mpsc" "atom" "core2" "nehalem" "westmere") _cpu_marchs+=("silvermont" "sandybridge" "ivybridge" "haswell" "broadwell" "skylake") _cpu_marchs+=("skylakex" "cannonlake" "icelake" "goldmont" "goldmontplus" "cascadelake") _cpu_marchs+=("cooperlake" "tigerlake" "native" "native_amd" "native_intel")