From a96a6108ff463a8000d7ea063796b7fb13c452e4 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Wed, 28 Apr 2021 14:10:30 +0200 Subject: [PATCH] Update randomx_boost.sh - Support builtin MSR, see #2283 - Added detection of AMD EPYC CPUs --- scripts/randomx_boost.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/scripts/randomx_boost.sh b/scripts/randomx_boost.sh index 4f4c8145e..f74b34b23 100755 --- a/scripts/randomx_boost.sh +++ b/scripts/randomx_boost.sh @@ -1,28 +1,34 @@ #!/bin/bash -modprobe msr allow_writes=on +MSR_FILE=/sys/module/msr/parameters/allow_writes -if cat /proc/cpuinfo | grep "AMD Ryzen" > /dev/null; +if test -e "$MSR_FILE"; then + echo on > $MSR_FILE +else + modprobe msr allow_writes=on +fi + +if cat /proc/cpuinfo | grep -E 'AMD Ryzen|AMD EPYC' > /dev/null; then if cat /proc/cpuinfo | grep "cpu family[[:space:]]:[[:space:]]25" > /dev/null; then - echo "Detected Ryzen (Zen3)" + echo "Detected Zen3 CPU" wrmsr -a 0xc0011020 0x4480000000000 wrmsr -a 0xc0011021 0x1c000200000040 wrmsr -a 0xc0011022 0xc000000401500000 wrmsr -a 0xc001102b 0x2000cc14 - echo "MSR register values for Ryzen (Zen3) applied" + echo "MSR register values for Zen3 applied" else - echo "Detected Ryzen (Zen1/Zen2)" + echo "Detected Zen1/Zen2 CPU" wrmsr -a 0xc0011020 0 wrmsr -a 0xc0011021 0x40 wrmsr -a 0xc0011022 0x1510000 wrmsr -a 0xc001102b 0x2000cc16 - echo "MSR register values for Ryzen (Zen1/Zen2) applied" + echo "MSR register values for Zen1/Zen2 applied" fi elif cat /proc/cpuinfo | grep "Intel" > /dev/null; then - echo "Detected Intel" + echo "Detected Intel CPU" wrmsr -a 0x1a4 0xf echo "MSR register values for Intel applied" else