Microcode

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

Introduction
Modern processors are complex devices that can have bugs. Furthermore, instead of executing x86 instructions directly, modern x86 processors contain internal code that implements support for the x86 instruction set. The internal code is called microcode. Microcode can be updated to fix or mitigate CPU bugs.

And because Gentoo is about choices there there isn't just one way to update a CPU's microcode. Please choose the workflow which suits your setup.

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
Basically you provide the microcode as the first initramfs (aka initrd, in cpio format) to the kernel during boot. Grub (both legacy and grub2) lets you specify multiple cpio images separated by space in the initrd command.

GRUB2 supports loading an early microcode. If the microcode file is located in and named, it will be automatically detected when running grub-mkconfig. To declare a microcode file named differently, e.g. ucode.cpio, add this line to :

Regenerate the with:

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.