]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
x86/boot/32: Temporarily map initrd for microcode loading
authorThomas Gleixner <tglx@linutronix.de>
Tue, 17 Oct 2023 21:23:31 +0000 (23:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 9 Mar 2025 08:55:04 +0000 (09:55 +0100)
commitc92bd953243bfdca359b5c1b69c64bf62d4a46c8
tree98835b6cf99194e2e14d74bf2f99bdabb7998310
parentd4c860bb425d665cb2aa9c9f3e1c859aebf20f29
x86/boot/32: Temporarily map initrd for microcode loading

commit 4c585af7180c147062c636a927a2fc2b6a7072f5 upstream

Early microcode loading on 32-bit runs in physical address mode because
the initrd is not covered by the initial page tables. That results in
a horrible mess all over the microcode loader code.

Provide a temporary mapping for the initrd in the initial page tables by
appending it to the actual initial mapping starting with a new PGD or
PMD depending on the configured page table levels ([non-]PAE).

The page table entries are located after _brk_end so they are not
permanently using memory space. The mapping is invalidated right away in
i386_start_kernel() after the early microcode loader has run.

This prepares for removing the physical address mode oddities from all
over the microcode loader code, which in turn allows further cleanups.

Provide the map and unmap code and document the place where the
microcode loader needs to be invoked with a comment.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20231017211722.292291436@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/microcode.h
arch/x86/kernel/head32.c