Microcode

This document Article description::describes various ways how to update a CPU's microcode in Gentoo.

Introduction
The microcode is a form of firmware that controls the processor's internals. In modern x86 processors the microcode often handles execution of complex and highly specialized instructions. Parts of microcode also act as firmware for processor's embedded controllers. Furthermore, the microcode can be used to fix or mitigate processor design and implementation errata/bugs. Given the complexity of modern processors, a processor may have over one hundred of such errata.

Recent processors have ability to patch their microcode via microcode updates. Microcode updates are stored in volatile memory and thus they have to be applied during each system boot.

A BIOS/EFI can perform a microcode update early in the boot process. This kind of microcode updates are provided by BIOS/EFI and thus their version depends on the installed BIOS/EFI version. BIOS/EFI firmware can be upgraded via a BIOS update but still, the shipped microcode version depends on motherboard/BIOS vendor.

The kernel itself can also perform a microcode update from given firmware binary blobs during boot. This way it is possible to patch the microcode with a newer microcode update than the one provided by the BIOS/EFI.

Because Gentoo is about choices there is not one way to update a CPU's microcode. Please choose the workflow which best suits the affected system.

Preconditions
Ensure you have installed the package which is providing microcode updates for your processor. Install and/or :

Any way to load microcode into the CPU must go through the kernel. Thus the respective options need to be enabled in the kernel configuration. Depending on the make of the CPU installed on the system, choose AMD or Intel microcode loading support (it does not hurt to choose both):

Genkernel
When using, ensure the package containing microcode updates for the processor(s) have been installed (see below). Be sure to call with the   option:

To generate a new initramfs with microcode included, call:

Be sure to instruct the bootloader to load the newly generated initramfs.

It is recommended is updated to contains the following code:

so that you don't need to remember to pass the  parameter all the time.

The manual way


Early microcode loading
For early microcode leading, microcode is provided as the first initramfs (aka initrd, in cpio format) to the kernel during boot. Grub (both legacy and grub2) permits specifying multiple cpio images separated by space in the initrd command.

GRUB2 supports loading an early microcode. If the microcode file is named after one of the following:, , , , , or , it will be automatically detected when running. To declare a microcode file named differently, e.g. ucode.cpio, add this line to :

Regenerate the with:

The output above is similar to what should be seen, minus the initramfs if one is not used by the system, when microcode is loaded through GRUB.

Late microcode loading
To manually instruct the kernel to reload microcodes, do

and watch for any errors. This loading mechanism looks for microcode blobs in.

Specifics


AMD specifics
AMD microcodes are bundled in the package. A more lengthy guide is found in the AMD microcode article.

Intel specifics
Intel microcodes are bundled in the package. Detailed instructions can be found in the Intel microcode article.

External resources

 * Reverse Engineering x86 Processor Microcode Paper describing microcode in common x86 processors.