Blame README.md

Packit Service c9fe53
# Intel Processor Microcode Package for Linux
Packit Service c9fe53
Packit Service c9fe53
## About
Packit Service c9fe53
Packit Service c9fe53
The Intel Processor Microcode Update (MCU) Package provides a mechanism to release updates for security advisories and functional issues, including errata. In addition, MCUs are responsible for starting the SGX enclave (on processors that support the SGX feature), implementing complex behaviors (such as assists), and more. The preferred method to apply MCUs is using the system BIOS. For a subset of Intel's processors, the MCU can also be updated at runtime using the operating system. The Intel Microcode Package shared here contains updates for those processors that support OS loading of MCUs.
Packit Service c9fe53
Packit Service c9fe53
## Why update the microcode?
Packit Service c9fe53
Updating your microcode can help to mitigate certain potential security vulnerabilities in CPUs as well as address certain functional issues that could, for example, result in unpredictable system behavior such as hangs, crashes, unexpected reboots, data errors, etc. To learn more about applying MCUs to an Intel processor, see [Microcode Update Guidance](https://software.intel.com/security-software-guidance/insights/microcode-update-guidance).
Packit Service c9fe53
Packit Service c9fe53
## Loading microcode updates
Packit Service c9fe53
Packit Service c9fe53
This package is provided for Linux distributors for inclusion in their OS releases. Intel recommends obtaining the latest MCUs using the OS vendor update mechanism. A good starting point is [OS and Software Vendor](https://software.intel.com/security-software-guidance/insights/guidance-system-administrators-mitigate-transient-execution-side-channel-issues). Expert users can update their microcode directly outside the OS vendor mechanism. However, this method is complex and could result in errors if performed incorrectly. Such errors could include but are not limited to system freezes, inability to boot, performance impacts, logical processors loading different updates, and some updates not taking effect. As a result, this method should be attempted by expert users only.
Packit Service c9fe53
Packit Service c9fe53
MCUs are best loaded from the BIOS. Certain MCUs must only be applied from the BIOS. Such MCUs are never packaged in this package since they are not appropriate for OS distribution. An OEM may receive microcode update packages that are a superset of what is contained in this package for inclusion in a BIOS.
Packit Service c9fe53
Packit Service c9fe53
OS vendors may choose to provide an MCU that the kernel can consume for early loading. For example, Linux can apply an MCU very early in the kernel boot sequence. In situations where a BIOS update isn't available, early loading is the next best alternative to updating processor microcode. **Microcode states are reset on a power reset, hence its required that the MCU be loaded every time during boot process.**
Packit Service c9fe53
Packit Service c9fe53
## Recommendation
Packit Service c9fe53
Packit Service c9fe53
Using the initrd method to load an MCU is recommended as this method will load the MCU at the earliest time for the most coverage. Systems that cannot tolerate downtime may use the late-load method to update a running system without a reboot.
Packit Service c9fe53
Packit Service c9fe53
## About Processor Signature, Family, Model, Stepping and Platform ID
Packit Service c9fe53
Packit Service c9fe53
The Processor Signature is a number identifying the model and version of an Intel processor. It can be obtained using the *CPUID instruction*, via the command *lscpu*, or from the content of */proc/cpuinfo*. It's usually presented as 3 fields: Family, Model, and Stepping.
Packit Service c9fe53
Packit Service c9fe53
For example, if a processor returns a value of "0x000906eb" from the *CPUID instruction*:
Packit Service c9fe53
Packit Service c9fe53
| Reserved | Extended Family | Extended Model | Reserved | Processor Type | Family Code | Model Number | Stepping ID |
Packit Service c9fe53
|:---------|:----------------|:---------------|:---------|:---------------|:------------|:-------------|:------------|
Packit Service c9fe53
| 31:28    | 27:20           | 19:16          | 15:14    | 13:12          | 11:8        | 7:4          | 3:0         |
Packit Service c9fe53
| xxxx     | 00000000b       | 1001b          | xx       | 00b            | 0110b       | 1110b        | 1011b       |
Packit Service c9fe53
Packit Service c9fe53
Packit Service c9fe53
The corresponding Linux formatted file name will be "06-9e-0b", where:  
Packit Service c9fe53
- Extended Family + Family  = 0x06  
Packit Service c9fe53
- Extended Model + Model Number = 0x9e  
Packit Service c9fe53
- Stepping ID  = 0xb
Packit Service c9fe53
Packit Service c9fe53
A processor may be implemented for multiple platform types. Intel processors have a 3bit Platform ID field in MSR(17H) that specifies the platform type for up to 8 types. An MCU file for a specified processor model may support multiple platforms. The Platform ID(s) supported by an MCU is an 8bit mask where each set bit indicates a platform type that the MCU supports. The Platform ID of a processor can be read in Linux using rdmsr from [msr-tools](https://github.com/intel/msr-tools).
Packit Service c9fe53
Packit Service c9fe53
## Microcode update instructions
Packit Service c9fe53
Packit Service c9fe53
The [intel-ucode](https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/tree/master/intel-ucode) directory contains binary MCU files named in the `family-model-stepping` format. This file format is supported by most modern Linux distributions. It's generally located in the /lib/firmware directory and can be updated through the microcode reload interface following the late-load update instructions below.
Packit Service c9fe53
Packit Service c9fe53
### Early-load update
Packit Service c9fe53
To update early loading initrd, consult your Linux distribution on how to package MCU files for early loading. Some distributions use `update-initramfs` or `dracut`. Use the OS vendors recommended method to help ensure that the MCU file is updated for early loading before attempting the late-load procedure below.
Packit Service c9fe53
Packit Service c9fe53
### Late-load update
Packit Service c9fe53
To update the intel-ucode package to the system:
Packit Service c9fe53
1. Ensure the existence of `/sys/devices/system/cpu/microcode/reload`
Packit Service c9fe53
2. Download the latest microcode firmware
`$ git clone https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files.git` or
`$ wget https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/archive/master.zip`
Packit Service c9fe53
3. Copy `intel-ucode` directory to `/lib/firmware`, overwriting the files in /lib/firmware/intel-ucode/
Packit Service c9fe53
4. Write the reload interface to 1 to reload the microcode files, e.g.
Packit Service c9fe53
  `$ echo 1 > /sys/devices/system/cpu/microcode/reload`
Packit Service c9fe53
  Microcode updates will be applied automatically without rebooting the system.
Packit Service c9fe53
5. Update an existing initramfs so that next time it gets loaded via kernel:
Packit Service c9fe53
`$ sudo update-initramfs -u`
Packit Service c9fe53
`$ sudo reboot`
Packit Service c9fe53
6. Verify that the microcode was updated on boot or reloaded by echo command:
Packit Service c9fe53
`$ dmesg | grep microcode` or
Packit Service c9fe53
`$ cat /proc/cpuinfo | grep microcode | sort | uniq`
Packit Service c9fe53
Packit Service c9fe53
If you are using the OS vendor method to apply an MCU, the above steps may have been done automatically during the update process.
Packit Service c9fe53
Packit Service c9fe53
The [intel-ucode-with-caveats](https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/tree/master/intel-ucode-with-caveats) directory contains MCUs that need special handling. The BDX-ML MCU is provided in this directory because it requires special commits in the Linux kernel otherwise updating it might result in unexpected system behavior. OS vendors must ensure that the late loader patches (provided in [linux-kernel-patches](https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/tree/master/linux-kernel-patches)) are included in the distribution before packaging the BDX-ML MCU for late-loading.
Packit Service c9fe53
Packit Service c9fe53
The [linux-kernel-patches](https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/tree/master/linux-kernel-patches) directory consists of kernel patches that address various issues related to applying MCUs.
Packit Service c9fe53
Packit Service c9fe53
## Notes
Packit Service c9fe53
Packit Service c9fe53
* You can only update to a higher MCU version (downgrade is not possible with the provided instructions)
Packit Service c9fe53
* To calculate Family-Model-Stepping, use Linux command:
Packit Service c9fe53
`$ printf "%x\n" <number_to_convert_to_hex>`
Packit Service c9fe53
* There are multiple ways to check the MCU version number BEFORE update. After cloning this Intel Microcode update repo , run the following:
Packit Service c9fe53
  - `$ iucode_tool -l intel-ucode | grep -wF sig` ([iucode_tool](https://gitlab.com/iucode-tool/iucode-tool/-/wikis/home) package is required)
Packit Service c9fe53
  - `$ od -t x4 <Family-Model-Stepping>` will read the first 16 bytes of the microcode binary header specified in \<Family\-Model\-Stepping\>. The third block is the microcode version. For example:
Packit Service c9fe53
`$ od -t x4 06-55-04`
Packit Service c9fe53
`0000000 00000001 *02000065* 09052019 00050654`
Packit Service c9fe53
Packit Service c9fe53
## License
Packit Service c9fe53
Packit Service c9fe53
See the [license](https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/blob/master/license) file for details.
Packit Service c9fe53
Packit Service c9fe53
## Security Policy
Packit Service c9fe53
Packit Service c9fe53
See the [security.md](https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/blob/master/security.md) file for details.
Packit Service c9fe53
Packit Service c9fe53
## Release Note
Packit Service c9fe53
Packit Service c9fe53
See the [releasenote.md](https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/blob/master/releasenote.md) file for details.
Packit Service c9fe53
Packit Service c9fe53
## Disclaimers 
Packit Service c9fe53
Packit Service c9fe53
Intel technologies’ features and benefits depend on system configuration and may require enabled hardware, software, or service activation. Performance varies depending on system configuration. Check with your system manufacturer or retailer or learn more at [www.intel.com](https://www.intel.com).
Packit Service c9fe53
Packit Service c9fe53
No product or component can be absolutely secure.
Packit Service c9fe53
Packit Service c9fe53
All information provided here is subject to change without notice. Contact your Intel representative to obtain the latest Intel product specifications and roadmaps.
Packit Service c9fe53
Packit Service c9fe53
The products and services described may contain defects or errors known as errata which may cause deviations from published specifications. Current characterized errata are available on request.
Packit Service c9fe53
Packit Service c9fe53
Intel provides these materials as-is, with no express or implied warranties.
Packit Service c9fe53
Packit Service c9fe53
© Intel Corporation.  Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries.
Packit Service c9fe53
Packit Service c9fe53
*Other names and brands may be claimed as the property of others.