linux/arch/x86/boot/compressed
Kirill A. Shutemov 9cf3060640 x86/boot: Set CR0.NE early and keep it set during the boot
TDX guest requires CR0.NE to be set. Clearing the bit triggers #GP(0).

If CR0.NE is 0, the MS-DOS compatibility mode for handling floating-point
exceptions is selected. In this mode, the software exception handler for
floating-point exceptions is invoked externally using the processor’s
FERR#, INTR, and IGNNE# pins.

Using FERR# and IGNNE# to handle floating-point exception is deprecated.
CR0.NE=0 also limits newer processors to operate with one logical
processor active.

Kernel uses CR0_STATE constant to initialize CR0. It has NE bit set.
But during early boot kernel has more ad-hoc approach to setting bit
in the register. During some of this ad-hoc manipulation, CR0.NE is
cleared. This causes a #GP in TDX guests and makes it die in early boot.

Make CR0 initialization consistent, deriving the initial value of CR0
from CR0_STATE. Since CR0_STATE always has CR0.NE=1, this ensures that
CR0.NE is never 0 and avoids the #GP.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20220405232939.73860-23-kirill.shutemov@linux.intel.com
2022-04-07 08:27:53 -07:00
..
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
acpi.c x86/boot: Fix -Wint-to-pointer-cast build warning 2020-05-04 15:22:16 +02:00
cmdline.c x86/boot: Build the command line parsing code unconditionally 2019-02-01 11:51:01 +01:00
cpuflags.c x86/sev-es: Check required CPU features for SEV-ES 2020-09-10 21:49:25 +02:00
early_serial_console.c x86, boot: Don't compile early_serial_console.c when !CONFIG_EARLY_PRINTK 2014-08-17 14:58:24 -07:00
efi_thunk_64.S - Get rid of all the .fixup sections because this generates 2022-01-12 16:31:19 -08:00
error.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
error.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
head_32.S x86: clean up symbol aliasing 2022-02-22 16:21:34 +00:00
head_64.S x86/boot: Set CR0.NE early and keep it set during the boot 2022-04-07 08:27:53 -07:00
ident_map_64.c - Remove all uses of TIF_IA32 and TIF_X32 and reclaim the two bits in the end 2020-12-14 13:45:26 -08:00
idt_64.c x86/boot/compressed/64: Cleanup exception handling before booting kernel 2021-03-18 16:44:36 +01:00
idt_handlers_64.S x86/boot/compressed/64: Setup a GHCB-based VC Exception handler 2020-09-07 19:45:25 +02:00
kaslr.c x86/boot/compressed: Avoid duplicate malloc() implementations 2021-10-27 11:07:59 +02:00
kernel_info.S x86/boot: Introduce setup_indirect 2019-11-12 16:21:15 +01:00
Makefile x86/boot: Port I/O: Add decompression-time support for TDX 2022-04-07 08:27:52 -07:00
mem_encrypt.S x86: Prepare asm files for straight-line-speculation 2021-12-08 12:25:37 +01:00
misc.c x86/boot: Port I/O: Allow to hook up alternative helpers 2022-04-07 08:27:52 -07:00
misc.h x86/boot: Port I/O: Allow to hook up alternative helpers 2022-04-07 08:27:52 -07:00
mkpiggy.c x86/boot: Remove run-time relocations from head_{32,64}.S 2020-08-14 12:52:35 +02:00
pgtable_64.c lib/string: Move helper functions out of string.c 2021-09-25 08:20:49 -07:00
pgtable.h x86/boot/compressed/64: Set EFER.LME=1 in 32-bit trampoline before returning to long mode 2019-01-29 21:58:59 +01:00
sev.c x86/sev: Shorten GHCB terminate macro names 2021-11-15 20:31:16 +01:00
string.c x86/boot: Provide KASAN compatible aliases for string routines 2019-05-24 08:44:16 +02:00
tdcall.S x86/boot: Port I/O: Add decompression-time support for TDX 2022-04-07 08:27:52 -07:00
tdx.c x86/boot: Port I/O: Add decompression-time support for TDX 2022-04-07 08:27:52 -07:00
tdx.h x86/tdx: Detect TDX at early kernel decompression time 2022-04-07 08:27:51 -07:00
vmlinux.lds.S x86/boot/compressed: Add missing debugging sections to output 2020-09-01 10:03:18 +02:00