b24a43
#! /bin/bash -efu
b24a43
b24a43
# Trigger microcode reload with additional check for BDW-EP that can have
b24a43
# microcode reloaded only in case kernel has specific patches.
b24a43
#
b24a43
# SPDX-License-Identifier: CC0-1.0
b24a43
b24a43
CHECK_CAVEATS=/usr/libexec/microcode_ctl/check_caveats
b24a43
IGNORE_HYPERVISOR="/etc/microcode_ctl/ignore-hypervisor-flag"
b24a43
b24a43
[ -e "$IGNORE_HYPERVISOR" ] || {
b24a43
	if grep -q '^flags[[:space:]]*:.* hypervisor\( .*\)\?$' /proc/cpuinfo
b24a43
	then
b24a43
		exit 0
b24a43
	fi
b24a43
}
b24a43
b24a43
"$CHECK_CAVEATS" -m > /dev/null || exit 0
b24a43
b24a43
echo 2>/dev/null 1 > /sys/devices/system/cpu/microcode/reload || :
b24a43
b24a43
exit 0