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
22 lines
409 B
C
22 lines
409 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* Copyright (C) 2021-2022 Intel Corporation */
|
|
#ifndef _ASM_X86_TDX_H
|
|
#define _ASM_X86_TDX_H
|
|
|
|
#include <linux/init.h>
|
|
|
|
#define TDX_CPUID_LEAF_ID 0x21
|
|
#define TDX_IDENT "IntelTDX "
|
|
|
|
#ifdef CONFIG_INTEL_TDX_GUEST
|
|
|
|
void __init tdx_early_init(void);
|
|
|
|
#else
|
|
|
|
static inline void tdx_early_init(void) { };
|
|
|
|
#endif /* CONFIG_INTEL_TDX_GUEST */
|
|
|
|
#endif /* _ASM_X86_TDX_H */
|