]> www.infradead.org Git - users/dwmw2/linux.git/commit
x86/kexec: Pass bitmask for CR4 bits to preserve from kernel C code
authorDavid Woodhouse <dwmw@amazon.co.uk>
Mon, 17 Mar 2025 11:35:12 +0000 (11:35 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Mon, 17 Mar 2025 11:35:12 +0000 (11:35 +0000)
commit087845ebb269426862e5034faab73467ca5f8b2c
treebcce81f1911c626887d26c126a20691f749b3f9b
parentae28f15a0c6a7913dd0049924ee6826ed173677a
x86/kexec: Pass bitmask for CR4 bits to preserve from kernel C code

The relocate_kernel() function masks out all but PAE and LA57 bits from
the CR4 register... and also the MCE bit for TDX guests, where disabling
MCE may not be permitted.

The conditional disabling of CR4_MCE is currently implemented by the use
of ALTERNATIVE() in the assembler code.

In order to allow a future patch to move relocate_kernel() to a data
section and avoid objtool having opinions about it, eliminate the use
of ALTERNATIVE() by passing the bitmask in from C code.

Suggested-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
arch/x86/include/asm/kexec.h
arch/x86/kernel/machine_kexec_64.c
arch/x86/kernel/relocate_kernel_64.S