Microcode

CPU microcode is a form of firmware that controls the processor's internals. This document Article description::describes various ways to update a CPU's microcode in Gentoo.

In modern x86 processors, the microcode often handles execution of complex and highly specialized instructions. Parts of the microcode also act as firmware for the processor's embedded controllers, and it is even used to fix or to mitigate processor design/implementation errata/bugs. Given the complexity of modern processors, a CPU may have over a hundred such errata.

Recent processors have the ability to patch their microcode via microcode updates. Active microcode updates are stored in volatile memory and thus 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 update is 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 the shipped microcode version depends on motherboard/BIOS vendor.

The kernel itself can also perform a microcode update from firmware binary blobs, during boot. This way allows patching the microcode with a newer update than the one provided by the BIOS/EFI.

Because Gentoo is about customization there is a choice of ways to update a CPU's microcode. Please choose the workflow which best suits the affected system.

Preconditions
Ensure the correct package to provide microcode updates for the current processor is installed: and/or.

It may be necessary to tell Portage to accpt the relevant licence before installing these packages:

Install and/or :

The only way to load this microcode into the CPU is through the kernel, so the necessary kernel options must be enabled. 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):

Dracut
Dracut is an initramfs infrastructure, it can be used to load microcode at boot.

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, in order to avoid passing   parameter each time on the command-line:

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.