--- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -864,6 +864,27 @@ } } +#ifdef CONFIG_X86_64 +static bool __init x86_has_x86_64_v3(void) +{ + return boot_cpu_has(X86_FEATURE_CX16) && + boot_cpu_has(X86_FEATURE_LAHF_LM) && + boot_cpu_has(X86_FEATURE_POPCNT) && + boot_cpu_has(X86_FEATURE_XMM3) && + boot_cpu_has(X86_FEATURE_SSSE3) && + boot_cpu_has(X86_FEATURE_XMM4_1) && + boot_cpu_has(X86_FEATURE_XMM4_2) && + boot_cpu_has(X86_FEATURE_AVX) && + boot_cpu_has(X86_FEATURE_AVX2) && + boot_cpu_has(X86_FEATURE_BMI1) && + boot_cpu_has(X86_FEATURE_BMI2) && + boot_cpu_has(X86_FEATURE_F16C) && + boot_cpu_has(X86_FEATURE_FMA) && + boot_cpu_has(X86_FEATURE_MOVBE) && + boot_cpu_has(X86_FEATURE_ABM); +} +#endif + /* * Determine if we were loaded by an EFI loader. If so, then we have also been * passed the efi memmap, systab, etc., so we should use these data structures @@ -931,6 +952,10 @@ idt_setup_early_traps(); early_cpu_init(); +#ifdef CONFIG_X86_64 + if (!x86_has_x86_64_v3()) + panic("This kernel requires an x86_64-v3 CPU\n"); +#endif jump_label_init(); static_call_init(); early_ioremap_init();