diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2013-09-27 10:22:55 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2013-09-27 10:22:55 +0200 |
commit | 155587481e392e4261038364e2761aab27f597ed (patch) | |
tree | efc95aa3facbcb9eed170bbff0cb7cde3ad9fe82 /docs/misc | |
parent | 0dcfb88fb838ad6f8558f2952feb2f09dc34470f (diff) | |
download | xen-155587481e392e4261038364e2761aab27f597ed.tar.gz xen-155587481e392e4261038364e2761aab27f597ed.tar.bz2 xen-155587481e392e4261038364e2761aab27f597ed.zip |
x86/microcode: Scan the initramfs payload for microcode blob
The Linux kernel is able to update the microcode during early bootup
via inspection of the initramfs blob to see if there is an cpio image
with certain microcode files. Linux is able to function with two (or
more) cpio archives in the initrd b/c it unpacks all of the cpio
archives.
The format of the early initramfs is nicely documented in Linux's
Documentation/x86/early-microcode.txt:
Early load microcode
====================
By Fenghua Yu <fenghua.yu@intel.com>
Kernel can update microcode in early phase of boot time. Loading microcode early
can fix CPU issues before they are observed during kernel boot time.
Microcode is stored in an initrd file. The microcode is read from the initrd
file and loaded to CPUs during boot time.
The format of the combined initrd image is microcode in cpio format followed by
the initrd image (maybe compressed). Kernel parses the combined initrd image
during boot time. The microcode file in cpio name space is:
kernel/x86/microcode/GenuineIntel.bin
During BSP boot (before SMP starts), if the kernel finds the microcode file in
the initrd file, it parses the microcode and saves matching microcode in memory.
If matching microcode is found, it will be uploaded in BSP and later on in all
APs.
The cached microcode patch is applied when CPUs resume from a sleep state.
There are two legacy user space interfaces to load microcode, either through
/dev/cpu/microcode or through /sys/devices/system/cpu/microcode/reload file
in sysfs.
In addition to these two legacy methods, the early loading method described
here is the third method with which microcode can be uploaded to a system's
CPUs.
The following example script shows how to generate a new combined initrd file in
/boot/initrd-3.5.0.ucode.img with original microcode microcode.bin and
original initrd image /boot/initrd-3.5.0.img.
mkdir initrd
cd initrd
mkdir kernel
mkdir kernel/x86
mkdir kernel/x86/microcode
cp ../microcode.bin kernel/x86/microcode/GenuineIntel.bin
find .|cpio -oc >../ucode.cpio
cd ..
cat ucode.cpio /boot/initrd-3.5.0.img >/boot/initrd-3.5.0.ucode.img
As such this code inspects the initrd to see if the microcode
signatures are present and if so updates the hypervisor.
The option to turn this scan on/off is gated by the 'ucode'
parameter. The options are now:
'scan' Scan for the microcode in any multiboot payload.
<index> Attempt to load microcode blob (not the cpio archive
format) from the multiboot payload number.
This option alters slightly the 'ucode' parameter by only allowing
either parameter:
ucode=[<index>|scan]
Implementation wise the ucode_blob is defined as __initdata.
That is OK from the viewpoint of suspend/resume as the the underlaying
architecture microcode (microcode_intel or microcode_amd) end up saving
the blob in 'struct ucode_cpu_info' which is a per-cpu data
structure (see ucode_cpu_info). They end up saving it when doing the
pre-SMP (for CPU0) and SMP (for the rest) microcode loading.
Naturally if one does a hypercall to update the microcode and it is
newer, then the old per-cpu data is replaced.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'docs/misc')
-rw-r--r-- | docs/misc/xen-command-line.markdown | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown index 56c9729803..dc724738dd 100644 --- a/docs/misc/xen-command-line.markdown +++ b/docs/misc/xen-command-line.markdown @@ -897,10 +897,12 @@ pages) must also be specified via the tbuf\_size parameter. > `= unstable | skewed` ### ucode -> `= <integer>` +> `= [<integer> | scan]` + +Specify how and where to find CPU microcode update blob. -Specify the CPU microcode update blob module index. When positive, this -specifies the n-th module (in the GrUB entry, zero based) to be used +'integer' specifies the CPU microcode update blob module index. When positive, +this specifies the n-th module (in the GrUB entry, zero based) to be used for updating CPU micrcode. When negative, counting starts at the end of the modules in the GrUB entry (so with the blob commonly being last, one could specify `ucode=-1`). Note that the value of zero is not valid @@ -910,6 +912,12 @@ when used with xen.efi (there the concept of modules doesn't exist, and the blob gets specified via the `ucode=<filename>` config file/section entry; see [EFI configuration file description](efi.html)). +'scan' instructs the hypervisor to scan the multiboot images for an cpio +image that contains microcode. Depending on the platform the blob with the +microcode in the cpio name space must be: + - on Intel: kernel/x86/microcode/GenuineIntel.bin + - on AMD : kernel/x86/microcode/AuthenticAMD.bin + ### unrestricted\_guest > `= <boolean>` |