€•îlŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ&/translations/zh_CN/arch/x86/microcode”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/zh_TW/arch/x86/microcode”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/it_IT/arch/x86/microcode”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/ja_JP/arch/x86/microcode”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/ko_KR/arch/x86/microcode”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/sp_SP/arch/x86/microcode”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…””}”hh£sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1h¡hhhžhhŸŒ@/var/lib/git/docbuild/linux/Documentation/arch/x86/microcode.rst”h KubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒThe Linux Microcode Loader”h]”hŒThe Linux Microcode Loader”…””}”(hh»hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hh¶hžhhŸh³h KubhŒ field_list”“”)”}”(hhh]”hŒfield”“”)”}”(hhh]”(hŒ field_name”“”)”}”(hŒAuthors”h]”hŒAuthors”…””}”(hhÕhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÓhhÐhŸh³h KubhŒ field_body”“”)”}”(hŒe- Fenghua Yu - Borislav Petkov - Ashok Raj ”h]”hŒ bullet_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hŒ!Fenghua Yu ”h]”hŒ paragraph”“”)”}”(hhòh]”(hŒ Fenghua Yu <”…””}”(hhöhžhhŸNh NubhŒ reference”“”)”}”(hŒfenghua.yu@intel.com”h]”hŒfenghua.yu@intel.com”…””}”(hhÿhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:fenghua.yu@intel.com”uh1hýhhöubhŒ>”…””}”(hhöhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Khhðubah}”(h]”h ]”h"]”h$]”h&]”uh1hîhhëubhï)”}”(hŒBorislav Petkov ”h]”hõ)”}”(hj!h]”(hŒBorislav Petkov <”…””}”(hj#hžhhŸNh Nubhþ)”}”(hŒ bp@suse.de”h]”hŒ bp@suse.de”…””}”(hj*hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:bp@suse.de”uh1hýhj#ubhŒ>”…””}”(hj#hžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Khjubah}”(h]”h ]”h"]”h$]”h&]”uh1hîhhëubhï)”}”(hŒ Ashok Raj ”h]”hõ)”}”(hŒAshok Raj ”h]”(hŒ Ashok Raj <”…””}”(hjNhžhhŸNh Nubhþ)”}”(hŒashok.raj@intel.com”h]”hŒashok.raj@intel.com”…””}”(hjVhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:ashok.raj@intel.com”uh1hýhjNubhŒ>”…””}”(hjNhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K hjJubah}”(h]”h ]”h"]”h$]”h&]”uh1hîhhëubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1héhŸh³h Khhåubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhhÐubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÎhŸh³h KhhËhžhubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhh¶hžhhŸh³h Kubhõ)”}”(hXThe kernel has a x86 microcode loading facility which is supposed to provide microcode loading methods in the OS. Potential use cases are updating the microcode on platforms beyond the OEM End-Of-Life support, and updating the microcode on long-running systems without rebooting.”h]”hXThe kernel has a x86 microcode loading facility which is supposed to provide microcode loading methods in the OS. Potential use cases are updating the microcode on platforms beyond the OEM End-Of-Life support, and updating the microcode on long-running systems without rebooting.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K hh¶hžhubhõ)”}”(hŒ*The loader supports three loading methods:”h]”hŒ*The loader supports three loading methods:”…””}”(hjžhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Khh¶hžhubhµ)”}”(hhh]”(hº)”}”(hŒEarly load microcode”h]”hŒEarly load microcode”…””}”(hj¯hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hj¬hžhhŸh³h Kubhõ)”}”(hŒ”The kernel can update microcode very early during boot. Loading microcode early can fix CPU issues before they are observed during kernel boot time.”h]”hŒ”The kernel can update microcode very early during boot. Loading microcode early can fix CPU issues before they are observed during kernel boot time.”…””}”(hj½hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Khj¬hžhubhõ)”}”(hŒiThe microcode is stored in an initrd file. During boot, it is read from it and loaded into the CPU cores.”h]”hŒiThe microcode is stored in an initrd file. During boot, it is read from it and loaded into the CPU cores.”…””}”(hjËhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Khj¬hžhubhõ)”}”(hŒ¿The format of the combined initrd image is microcode in (uncompressed) cpio format followed by the (possibly compressed) initrd image. The loader parses the combined initrd image during boot.”h]”hŒ¿The format of the combined initrd image is microcode in (uncompressed) cpio format followed by the (possibly compressed) initrd image. The loader parses the combined initrd image during boot.”…””}”(hjÙhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Khj¬hžhubhõ)”}”(hŒ+The microcode files in cpio name space are:”h]”hŒ+The microcode files in cpio name space are:”…””}”(hjçhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K hj¬hžhubhŒdefinition_list”“”)”}”(hhh]”(hŒdefinition_list_item”“”)”}”(hŒ/on Intel: kernel/x86/microcode/GenuineIntel.bin”h]”(hŒterm”“”)”}”(hŒ on Intel:”h]”hŒ on Intel:”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhŸh³h K"hjüubhŒ definition”“”)”}”(hhh]”hõ)”}”(hŒ%kernel/x86/microcode/GenuineIntel.bin”h]”hŒ%kernel/x86/microcode/GenuineIntel.bin”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K#hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjüubeh}”(h]”h ]”h"]”h$]”h&]”uh1júhŸh³h K"hj÷ubjû)”}”(hŒ0on AMD : kernel/x86/microcode/AuthenticAMD.bin ”h]”(j)”}”(hŒ on AMD :”h]”hŒ on AMD :”…””}”(hj3hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhŸh³h K%hj/ubj)”}”(hhh]”hõ)”}”(hŒ%kernel/x86/microcode/AuthenticAMD.bin”h]”hŒ%kernel/x86/microcode/AuthenticAMD.bin”…””}”(hjDhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K%hjAubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj/ubeh}”(h]”h ]”h"]”h$]”h&]”uh1júhŸh³h K%hj÷hžhubeh}”(h]”h ]”h"]”h$]”h&]”uh1jõhj¬hžhhŸh³h Nubhõ)”}”(hŒßDuring BSP (BootStrapping Processor) boot (pre-SMP), the kernel scans the microcode file in the initrd. If microcode matching the CPU is found, it will be applied in the BSP and later on in all APs (Application Processors).”h]”hŒßDuring BSP (BootStrapping Processor) boot (pre-SMP), the kernel scans the microcode file in the initrd. If microcode matching the CPU is found, it will be applied in the BSP and later on in all APs (Application Processors).”…””}”(hjdhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K'hj¬hžhubhõ)”}”(hŒ”The loader also saves the matching microcode for the CPU in memory. Thus, the cached microcode patch is applied when CPUs resume from a sleep state.”h]”hŒ”The loader also saves the matching microcode for the CPU in memory. Thus, the cached microcode patch is applied when CPUs resume from a sleep state.”…””}”(hjrhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K,hj¬hžhubhõ)”}”(hŒõHere's a crude example how to prepare an initrd with microcode (this is normally done automatically by the distribution, when recreating the initrd, so you don't really have to do it yourself. It is documented here for future reference only). ::”h]”hŒöHere’s a crude example how to prepare an initrd with microcode (this is normally done automatically by the distribution, when recreating the initrd, so you don’t really have to do it yourself. It is documented here for future reference only).”…””}”(hj€hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K0hj¬hžhubhŒ literal_block”“”)”}”(hX@#!/bin/bash if [ -z "$1" ]; then echo "You need to supply an initrd file" exit 1 fi INITRD="$1" DSTDIR=kernel/x86/microcode TMPDIR=/tmp/initrd rm -rf $TMPDIR mkdir $TMPDIR cd $TMPDIR mkdir -p $DSTDIR if [ -d /lib/firmware/amd-ucode ]; then cat /lib/firmware/amd-ucode/microcode_amd*.bin > $DSTDIR/AuthenticAMD.bin fi if [ -d /lib/firmware/intel-ucode ]; then cat /lib/firmware/intel-ucode/* > $DSTDIR/GenuineIntel.bin fi find . | cpio -o -H newc >../ucode.cpio cd .. mv $INITRD $INITRD.orig cat ucode.cpio $INITRD.orig > $INITRD rm -rf $TMPDIR”h]”hX@#!/bin/bash if [ -z "$1" ]; then echo "You need to supply an initrd file" exit 1 fi INITRD="$1" DSTDIR=kernel/x86/microcode TMPDIR=/tmp/initrd rm -rf $TMPDIR mkdir $TMPDIR cd $TMPDIR mkdir -p $DSTDIR if [ -d /lib/firmware/amd-ucode ]; then cat /lib/firmware/amd-ucode/microcode_amd*.bin > $DSTDIR/AuthenticAMD.bin fi if [ -d /lib/firmware/intel-ucode ]; then cat /lib/firmware/intel-ucode/* > $DSTDIR/GenuineIntel.bin fi find . | cpio -o -H newc >../ucode.cpio cd .. mv $INITRD $INITRD.orig cat ucode.cpio $INITRD.orig > $INITRD rm -rf $TMPDIR”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”h±h²uh1jŽhŸh³h K6hj¬hžhubhõ)”}”(hŒÖThe system needs to have the microcode packages installed into /lib/firmware or you need to fixup the paths above if yours are somewhere else and/or you've downloaded them directly from the processor vendor's site.”h]”hŒÚThe system needs to have the microcode packages installed into /lib/firmware or you need to fixup the paths above if yours are somewhere else and/or you’ve downloaded them directly from the processor vendor’s site.”…””}”(hjžhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h KXhj¬hžhubeh}”(h]”Œearly-load-microcode”ah ]”h"]”Œearly load microcode”ah$]”h&]”uh1h´hh¶hžhhŸh³h Kubhµ)”}”(hhh]”(hº)”}”(hŒ Late loading”h]”hŒ Late loading”…””}”(hj·hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hj´hžhhŸh³h K^ubhõ)”}”(hŒHYou simply install the microcode packages your distro supplies and run::”h]”hŒGYou simply install the microcode packages your distro supplies and run:”…””}”(hjÅhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K`hj´hžhubj)”}”(hŒ3# echo 1 > /sys/devices/system/cpu/microcode/reload”h]”hŒ3# echo 1 > /sys/devices/system/cpu/microcode/reload”…””}”hjÓsbah}”(h]”h ]”h"]”h$]”h&]”h±h²uh1jŽhŸh³h Kchj´hžhubhõ)”}”(hŒas root.”h]”hŒas root.”…””}”(hjáhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Kehj´hžhubhõ)”}”(hŒšThe loading mechanism looks for microcode blobs in /lib/firmware/{intel-ucode,amd-ucode}. The default distro installation packages already put them there.”h]”hŒšThe loading mechanism looks for microcode blobs in /lib/firmware/{intel-ucode,amd-ucode}. The default distro installation packages already put them there.”…””}”(hjïhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Kghj´hžhubhõ)”}”(hŒ:Since kernel 5.19, late loading is not enabled by default.”h]”hŒ:Since kernel 5.19, late loading is not enabled by default.”…””}”(hjýhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Kkhj´hžhubhõ)”}”(hŒ7The /dev/cpu/microcode method has been removed in 5.19.”h]”hŒ7The /dev/cpu/microcode method has been removed in 5.19.”…””}”(hj hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Kmhj´hžhubeh}”(h]”Œ late-loading”ah ]”h"]”Œ late loading”ah$]”h&]”uh1h´hh¶hžhhŸh³h K^ubhµ)”}”(hhh]”(hº)”}”(hŒWhy is late loading dangerous?”h]”hŒWhy is late loading dangerous?”…””}”(hj$hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hj!hžhhŸh³h Kpubhµ)”}”(hhh]”(hº)”}”(hŒSynchronizing all CPUs”h]”hŒSynchronizing all CPUs”…””}”(hj5hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hj2hžhhŸh³h Ksubhõ)”}”(hŒæThe microcode engine which receives the microcode update is shared between the two logical threads in a SMT system. Therefore, when the update is executed on one SMT thread of the core, the sibling "automatically" gets the update.”h]”hŒêThe microcode engine which receives the microcode update is shared between the two logical threads in a SMT system. Therefore, when the update is executed on one SMT thread of the core, the sibling “automatically†gets the update.”…””}”(hjChžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Kuhj2hžhubhõ)”}”(hXsSince the microcode can "simulate" MSRs too, while the microcode update is in progress, those simulated MSRs transiently cease to exist. This can result in unpredictable results if the SMT sibling thread happens to be in the middle of an access to such an MSR. The usual observation is that such MSR accesses cause #GPs to be raised to signal that former are not present.”h]”hXwSince the microcode can “simulate†MSRs too, while the microcode update is in progress, those simulated MSRs transiently cease to exist. This can result in unpredictable results if the SMT sibling thread happens to be in the middle of an access to such an MSR. The usual observation is that such MSR accesses cause #GPs to be raised to signal that former are not present.”…””}”(hjQhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Kzhj2hžhubhõ)”}”(hŒàThe disappearing MSRs are just one common issue which is being observed. Any other instruction that's being patched and gets concurrently executed by the other SMT sibling, can also result in similar, unpredictable behavior.”h]”hŒâThe disappearing MSRs are just one common issue which is being observed. Any other instruction that’s being patched and gets concurrently executed by the other SMT sibling, can also result in similar, unpredictable behavior.”…””}”(hj_hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Khj2hžhubhõ)”}”(hŒÑTo eliminate this case, a stop_machine()-based CPU synchronization was introduced as a way to guarantee that all logical CPUs will not execute any code but just wait in a spin loop, polling an atomic variable.”h]”hŒÑTo eliminate this case, a stop_machine()-based CPU synchronization was introduced as a way to guarantee that all logical CPUs will not execute any code but just wait in a spin loop, polling an atomic variable.”…””}”(hjmhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K†hj2hžhubhõ)”}”(hXWhile this took care of device or external interrupts, IPIs including LVT ones, such as CMCI etc, it cannot address other special interrupts that can't be shut off. Those are Machine Check (#MC), System Management (#SMI) and Non-Maskable interrupts (#NMI).”h]”hXWhile this took care of device or external interrupts, IPIs including LVT ones, such as CMCI etc, it cannot address other special interrupts that can’t be shut off. Those are Machine Check (#MC), System Management (#SMI) and Non-Maskable interrupts (#NMI).”…””}”(hj{hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h KŠhj2hžhubeh}”(h]”Œsynchronizing-all-cpus”ah ]”h"]”Œsynchronizing all cpus”ah$]”h&]”uh1h´hj!hžhhŸh³h Ksubhµ)”}”(hhh]”(hº)”}”(hŒMachine Checks”h]”hŒMachine Checks”…””}”(hj”hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hj‘hžhhŸh³h Kubhõ)”}”(hŒøMachine Checks (#MC) are non-maskable. There are two kinds of MCEs. Fatal un-recoverable MCEs and recoverable MCEs. While un-recoverable errors are fatal, recoverable errors can also happen in kernel context are also treated as fatal by the kernel.”h]”hŒøMachine Checks (#MC) are non-maskable. There are two kinds of MCEs. Fatal un-recoverable MCEs and recoverable MCEs. While un-recoverable errors are fatal, recoverable errors can also happen in kernel context are also treated as fatal by the kernel.”…””}”(hj¢hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K’hj‘hžhubhõ)”}”(hXwOn certain Intel machines, MCEs are also broadcast to all threads in a system. If one thread is in the middle of executing WRMSR, a MCE will be taken at the end of the flow. Either way, they will wait for the thread performing the wrmsr(0x79) to rendezvous in the MCE handler and shutdown eventually if any of the threads in the system fail to check in to the MCE rendezvous.”h]”hXwOn certain Intel machines, MCEs are also broadcast to all threads in a system. If one thread is in the middle of executing WRMSR, a MCE will be taken at the end of the flow. Either way, they will wait for the thread performing the wrmsr(0x79) to rendezvous in the MCE handler and shutdown eventually if any of the threads in the system fail to check in to the MCE rendezvous.”…””}”(hj°hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K—hj‘hžhubhõ)”}”(hXTo be paranoid and get predictable behavior, the OS can choose to set MCG_STATUS.MCIP. Since MCEs can be at most one in a system, if an MCE was signaled, the above condition will promote to a system reset automatically. OS can turn off MCIP at the end of the update for that core.”h]”hXTo be paranoid and get predictable behavior, the OS can choose to set MCG_STATUS.MCIP. Since MCEs can be at most one in a system, if an MCE was signaled, the above condition will promote to a system reset automatically. OS can turn off MCIP at the end of the update for that core.”…””}”(hj¾hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Kžhj‘hžhubeh}”(h]”Œmachine-checks”ah ]”h"]”Œmachine checks”ah$]”h&]”uh1h´hj!hžhhŸh³h Kubhµ)”}”(hhh]”(hº)”}”(hŒSystem Management Interrupt”h]”hŒSystem Management Interrupt”…””}”(hj×hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hjÔhžhhŸh³h K¥ubhõ)”}”(hX%SMIs are also broadcast to all CPUs in the platform. Microcode update requests exclusive access to the core before writing to MSR 0x79. So if it does happen such that, one thread is in WRMSR flow, and the 2nd got an SMI, that thread will be stopped in the first instruction in the SMI handler.”h]”hX%SMIs are also broadcast to all CPUs in the platform. Microcode update requests exclusive access to the core before writing to MSR 0x79. So if it does happen such that, one thread is in WRMSR flow, and the 2nd got an SMI, that thread will be stopped in the first instruction in the SMI handler.”…””}”(hjåhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K§hjÔhžhubhõ)”}”(hŒÜSince the secondary thread is stopped in the first instruction in SMI, there is very little chance that it would be in the middle of executing an instruction being patched. Plus OS has no way to stop SMIs from happening.”h]”hŒÜSince the secondary thread is stopped in the first instruction in SMI, there is very little chance that it would be in the middle of executing an instruction being patched. Plus OS has no way to stop SMIs from happening.”…””}”(hjóhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K­hjÔhžhubeh}”(h]”Œsystem-management-interrupt”ah ]”h"]”Œsystem management interrupt”ah$]”h&]”uh1h´hj!hžhhŸh³h K¥ubhµ)”}”(hhh]”(hº)”}”(hŒNon-Maskable Interrupts”h]”hŒNon-Maskable Interrupts”…””}”(hj hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hj hžhhŸh³h K³ubhõ)”}”(hŒ”When thread0 of a core is doing the microcode update, if thread1 is pulled into NMI, that can cause unpredictable behavior due to the reasons above.”h]”hŒ”When thread0 of a core is doing the microcode update, if thread1 is pulled into NMI, that can cause unpredictable behavior due to the reasons above.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Kµhj hžhubhõ)”}”(hŒHOS can choose a variety of methods to avoid running into this situation.”h]”hŒHOS can choose a variety of methods to avoid running into this situation.”…””}”(hj(hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K¹hj hžhubeh}”(h]”Œnon-maskable-interrupts”ah ]”h"]”Œnon-maskable interrupts”ah$]”h&]”uh1h´hj!hžhhŸh³h K³ubhµ)”}”(hhh]”(hº)”}”(hŒ+Is the microcode suitable for late loading?”h]”hŒ+Is the microcode suitable for late loading?”…””}”(hjAhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hj>hžhhŸh³h K½ubhõ)”}”(hŒ»Late loading is done when the system is fully operational and running real workloads. Late loading behavior depends on what the base patch on the CPU is before upgrading to the new patch.”h]”hŒ»Late loading is done when the system is fully operational and running real workloads. Late loading behavior depends on what the base patch on the CPU is before upgrading to the new patch.”…””}”(hjOhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K¿hj>hžhubhõ)”}”(hŒThis is true for Intel CPUs.”h]”hŒThis is true for Intel CPUs.”…””}”(hj]hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h KÃhj>hžhubhõ)”}”(hŒRConsider, for example, a CPU has patch level 1 and the update is to patch level 3.”h]”hŒRConsider, for example, a CPU has patch level 1 and the update is to patch level 3.”…””}”(hjkhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h KÅhj>hžhubhõ)”}”(hŒSBetween patch1 and patch3, patch2 might have deprecated a software-visible feature.”h]”hŒSBetween patch1 and patch3, patch2 might have deprecated a software-visible feature.”…””}”(hjyhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h KÈhj>hžhubhõ)”}”(hŒ³This is unacceptable if software is even potentially using that feature. For instance, say MSR_X is no longer available after an update, accessing that MSR will cause a #GP fault.”h]”hŒ³This is unacceptable if software is even potentially using that feature. For instance, say MSR_X is no longer available after an update, accessing that MSR will cause a #GP fault.”…””}”(hj‡hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h KËhj>hžhubhõ)”}”(hŒ±Basically there is no way to declare a new microcode update suitable for late-loading. This is another one of the problems that caused late loading to be not enabled by default.”h]”hŒ±Basically there is no way to declare a new microcode update suitable for late-loading. This is another one of the problems that caused late loading to be not enabled by default.”…””}”(hj•hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h KÏhj>hžhubeh}”(h]”Œ*is-the-microcode-suitable-for-late-loading”ah ]”h"]”Œ+is the microcode suitable for late loading?”ah$]”h&]”uh1h´hj!hžhhŸh³h K½ubeh}”(h]”Œwhy-is-late-loading-dangerous”ah ]”h"]”Œwhy is late loading dangerous?”ah$]”h&]”uh1h´hh¶hžhhŸh³h Kpubhµ)”}”(hhh]”(hº)”}”(hŒBuiltin microcode”h]”hŒBuiltin microcode”…””}”(hj¶hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hj³hžhhŸh³h KÔubhõ)”}”(hŒ§The loader supports also loading of a builtin microcode supplied through the regular builtin firmware method CONFIG_EXTRA_FIRMWARE. Only 64-bit is currently supported.”h]”hŒ§The loader supports also loading of a builtin microcode supplied through the regular builtin firmware method CONFIG_EXTRA_FIRMWARE. Only 64-bit is currently supported.”…””}”(hjÄhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h KÖhj³hžhubhõ)”}”(hŒHere's an example::”h]”hŒHere’s an example:”…””}”(hjÒhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h KÚhj³hžhubj)”}”(hŒyCONFIG_EXTRA_FIRMWARE="intel-ucode/06-3a-09 amd-ucode/microcode_amd_fam15h.bin" CONFIG_EXTRA_FIRMWARE_DIR="/lib/firmware"”h]”hŒyCONFIG_EXTRA_FIRMWARE="intel-ucode/06-3a-09 amd-ucode/microcode_amd_fam15h.bin" CONFIG_EXTRA_FIRMWARE_DIR="/lib/firmware"”…””}”hjàsbah}”(h]”h ]”h"]”h$]”h&]”h±h²uh1jŽhŸh³h KÜhj³hžhubhõ)”}”(hŒEThis basically means, you have the following tree structure locally::”h]”hŒDThis basically means, you have the following tree structure locally:”…””}”(hjîhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Kßhj³hžhubj)”}”(hŒn/lib/firmware/ |-- amd-ucode ... | |-- microcode_amd_fam15h.bin ... |-- intel-ucode ... | |-- 06-3a-09 ...”h]”hŒn/lib/firmware/ |-- amd-ucode ... | |-- microcode_amd_fam15h.bin ... |-- intel-ucode ... | |-- 06-3a-09 ...”…””}”hjüsbah}”(h]”h ]”h"]”h$]”h&]”h±h²uh1jŽhŸh³h Káhj³hžhubhõ)”}”(hŒ‹so that the build system can find those files and integrate them into the final kernel image. The early loader finds them and applies them.”h]”hŒ‹so that the build system can find those files and integrate them into the final kernel image. The early loader finds them and applies them.”…””}”(hj hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Këhj³hžhubhõ)”}”(hŒ¡Needless to say, this method is not the most flexible one because it requires rebuilding the kernel each time updated microcode from the CPU vendor is available.”h]”hŒ¡Needless to say, this method is not the most flexible one because it requires rebuilding the kernel each time updated microcode from the CPU vendor is available.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Kîhj³hžhubeh}”(h]”Œbuiltin-microcode”ah ]”h"]”Œbuiltin microcode”ah$]”h&]”uh1h´hh¶hžhhŸh³h KÔubeh}”(h]”Œthe-linux-microcode-loader”ah ]”h"]”Œthe linux microcode loader”ah$]”h&]”uh1h´hhhžhhŸh³h Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”h³uh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(h¹NŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jYŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”h³Œ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(j3j0j±j®jjj°j­jŽj‹jÑjÎjjj;j8j¨j¥j+j(uŒ nametypes”}”(j3‰j±‰j‰j°‰jމjщj‰j;‰j¨‰j+‰uh}”(j0h¶j®j¬jj´j­j!j‹j2jÎj‘jjÔj8j j¥j>j(j³uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nhžhub.