HEX
Server: Apache/2.2.15 (CentOS)
System: Linux ip-10-0-2-146.eu-west-1.compute.internal 2.6.32-754.35.1.el6.centos.plus.x86_64 #1 SMP Sat Nov 7 11:33:42 UTC 2020 x86_64
User: root (0)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: //proc/26757/root/usr/libexec/microcode_ctl/reload_microcode
#! /bin/bash -efu

# Trigger microcode reload with additional check for BDW-EP that can have
# microcode reloaded only in case kernel has specific patches.
#
# SPDX-License-Identifier: CC0-1.0

get_model_string()
{
	/usr/bin/printf "%s %02x-%02x-%02x" \
		$(/bin/sed -rn '1,/^$/{
			s/^vendor_id[[:space:]]*: (.*)$/\1/p;
			s/^cpu family[[:space:]]*: (.*)$/\1/p;
			s/^model[[:space:]]*: (.*)$/\1/p;
			s/^stepping[[:space:]]*: (.*)$/\1/p;
		}' /proc/cpuinfo)
}

CFG_BDW=intel-06-4f-01
CFG_SNB=intel-06-2d-07
CFG_SKL_SP=intel-06-55-04
CFG_SKL_UY=intel-06-4e-03
CFG_SKL_HS=intel-06-5e-03
CHECK_CAVEATS=/usr/libexec/microcode_ctl/check_caveats
MC_FILE=/lib/firmware/microcode.dat

model="$(get_model_string)"

# Broadwell-EP/EX check
if [ "x${model}" = "xGenuineIntel 06-4f-01" ]; then
	cc_out=$("$CHECK_CAVEATS" -m -c "$CFG_BDW") || exit 1

	# Check that the configuration hasn't been skipped
	ok_cfgs=$(printf "%s" "$cc_out" | sed -n 's/^ok_cfgs //p')

	[ "x$ok_cfgs" = "x$CFG_BDW" ] || exit 1

	MC_FILE=/lib/firmware/microcode-06-4f-01.dat
fi

# Sandy Bridge-E/EN/EP check
if [ "x${model}" = "xGenuineIntel 06-2d-07" ]; then
	cc_out=$("$CHECK_CAVEATS" -m -c "$CFG_SNB" || :)

	# Check that the configuration hasn't been skipped
	ok_cfgs=$(printf "%s" "$cc_out" | sed -n 's/^ok_cfgs //p')

	# Contrary to BDW caveat, we have a fallback in microcode.dat
	[ "x$ok_cfgs" != "x$CFG_SNB" ] || {
		MC_FILE=/lib/firmware/microcode-06-2d-07.dat
	}
fi

# Skylake-SP/W/X check
if [ "x${model}" = "xGenuineIntel 06-55-04" ]; then
	cc_out=$("$CHECK_CAVEATS" -m -c "$CFG_SKL_SP" || :)

	# Check that the configuration hasn't been skipped
	ok_cfgs=$(printf "%s" "$cc_out" | sed -n 's/^ok_cfgs //p')

	# Contrary to BDW caveat, we have a fallback in microcode.dat
	[ "x$ok_cfgs" != "x$CFG_SKL_SP" ] || {
		MC_FILE=/lib/firmware/microcode-06-55-04.dat
	}
fi

# Skylake-U/Y check
if [ "x${model}" = "xGenuineIntel 06-4e-03" ]; then
	cc_out=$("$CHECK_CAVEATS" -m -c "$CFG_SKL_UY" || :)

	# Check that the configuration hasn't been skipped
	ok_cfgs=$(printf "%s" "$cc_out" | sed -n 's/^ok_cfgs //p')

	# Contrary to BDW caveat, we have a fallback in microcode.dat
	[ "x$ok_cfgs" != "x$CFG_SKL_UY" ] || {
		MC_FILE=/lib/firmware/microcode-06-4e-03.dat
	}
fi

# Skylake-H/S/Xeon E3 v5 check
if [ "x${model}" = "xGenuineIntel 06-5e-03" ]; then
	cc_out=$("$CHECK_CAVEATS" -m -c "$CFG_SKL_HS" || :)

	# Check that the configuration hasn't been skipped
	ok_cfgs=$(printf "%s" "$cc_out" | sed -n 's/^ok_cfgs //p')

	# Contrary to BDW caveat, we have a fallback in microcode.dat
	[ "x$ok_cfgs" != "x$CFG_SKL_HS" ] || {
		MC_FILE=/lib/firmware/microcode-06-5e-03.dat
	}
fi

/sbin/microcode_ctl -Qu -f "$MC_FILE"