x86/tdx: Detect running as a TDX guest in early boot
In preparation of extending cc_platform_has() API to support TDX guest, use CPUID instruction to detect support for TDX guests in the early boot code (via tdx_early_init()). Since copy_bootdata() is the first user of cc_platform_has() API, detect the TDX guest status before it. Define a synthetic feature flag (X86_FEATURE_TDX_GUEST) and set this bit in a valid TDX guest platform. Signed-off-by:Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Signed-off-by:
Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by:
Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by:
Andi Kleen <ak@linux.intel.com> Reviewed-by:
Tony Luck <tony.luck@intel.com> Reviewed-by:
Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by:
Borislav Petkov <bp@suse.de> Reviewed-by:
Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/20220405232939.73860-2-kirill.shutemov@linux.intel.com
Showing
- arch/x86/Kconfig 12 additions, 0 deletionsarch/x86/Kconfig
- arch/x86/coco/Makefile 2 additions, 0 deletionsarch/x86/coco/Makefile
- arch/x86/coco/tdx/Makefile 3 additions, 0 deletionsarch/x86/coco/tdx/Makefile
- arch/x86/coco/tdx/tdx.c 22 additions, 0 deletionsarch/x86/coco/tdx/tdx.c
- arch/x86/include/asm/cpufeatures.h 1 addition, 0 deletionsarch/x86/include/asm/cpufeatures.h
- arch/x86/include/asm/disabled-features.h 7 additions, 1 deletionarch/x86/include/asm/disabled-features.h
- arch/x86/include/asm/tdx.h 21 additions, 0 deletionsarch/x86/include/asm/tdx.h
- arch/x86/kernel/head64.c 4 additions, 0 deletionsarch/x86/kernel/head64.c
arch/x86/coco/tdx/Makefile
0 → 100644
arch/x86/coco/tdx/tdx.c
0 → 100644
arch/x86/include/asm/tdx.h
0 → 100644