Re: [PATCH v1 03/11] x86/cpufeatures: Add TDX Guest CPU feature

From: Tom Lendacky
Date: Mon Jun 07 2021 - 10:32:36 EST


On 6/1/21 9:21 PM, Kuppuswamy Sathyanarayanan wrote:
> Add CPU feature detection for Trusted Domain Extensions support.
> TDX feature adds capabilities to keep guest register state and
> memory isolated from hypervisor.
>
> For TDX guest platforms, executing CPUID(0x21, 0) will return
> following values in EAX, EBX, ECX and EDX.
>
> EAX: Maximum sub-leaf number: 0
> EBX/EDX/ECX: Vendor string:
>
> EBX = "Inte"
> EDX = "lTDX"
> ECX = " "
>
> So when above condition is true, set X86_FEATURE_TDX_GUEST
> feature cap bit
>
> Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>
> Reviewed-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
> Reviewed-by: Tony Luck <tony.luck@xxxxxxxxx>
> ---

...

> /*
> * Manage page tables very early on.
> @@ -491,6 +492,8 @@ asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data)
>
> kasan_early_init();
>
> + tdx_early_init();
> +

Just a real minor nit, but does this have to be after kasan_early_init()?
If not, keeping the SME/SEV/TDX calls "together" might read clearer. So
just moving it up before kasan_early_init() will group them.

Thanks,
Tom