Created
October 15, 2018 13:31
-
-
Save samcv/60b73ff4e6ce901d09f9a8025826cb4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# based on https://lists.freebsd.org/pipermail/freebsd-current/2018-June/069799.html | |
get_value () { | |
location="$1" | |
cpu="$2" | |
rdmsr --processor "$cpu" --decimal "$location" || exit "$?" | |
} | |
write_value () { | |
location="$1" | |
value="$2" | |
cpu="$3" | |
wrmsr --processor "$cpu" "$location" "$value" || exit "$?" | |
} | |
apply_fix () { | |
location="$1" | |
to_or="$2" | |
fix_no="$3" | |
exit_code=0 | |
for i in `seq 0 $(($(nproc)-1))`; do | |
cpu="$i" | |
current_value=$(get_value $location $cpu) | |
new_value=$(("$current_value" | "$to_or")) | |
write_value "$location" "$new_value" "$cpu" | |
if [[ $(get_value $location $cpu) != $new_value ]]; then | |
printf "May not have been set for fix %i Wrote value %X but value is now at %X\n" "$fix_no" $new_value $(get_value $location $cpu) | |
fi | |
done | |
} | |
## Comments are the errata numbers | |
# 1021 | |
apply_fix 0xc0011029 0x2000 1021 | |
# 1033 | |
apply_fix 0xc0011020 0x10 1033 | |
# 1049 | |
apply_fix 0xc0011028 0x10 1049 | |
# 1095 | |
apply_fix 0xc0011020 0x200000000000000 1095 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment