Re: [PATCH v5 04/12] x86/tdx: Add protected guest support for TDX guest
From: Sean Christopherson
Date: Wed Aug 04 2021 - 18:03:42 EST
On Wed, Aug 04, 2021, Kuppuswamy Sathyanarayanan wrote:
> TDX architecture provides a way for VM guests to be highly secure and
> isolated (from untrusted VMM). To achieve this requirement, we can't
> completely trust any data coming from VMM. TDX guest fixes this issue
> by hardening the IO drivers against the attack from the VMM. Since we
> have a requirement to modify the generic drivers, we need to use the
> generic prot_guest_has() API to add TDX specific code in generic
> drivers.
>
> So add TDX guest support in prot_guest_has() API.
>
> Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>
> ---
...
> diff --git a/arch/x86/include/asm/protected_guest.h b/arch/x86/include/asm/protected_guest.h
> index b4a267dddf93..c67bf13c8ad3 100644
> --- a/arch/x86/include/asm/protected_guest.h
> +++ b/arch/x86/include/asm/protected_guest.h
> @@ -12,12 +12,17 @@
>
> #include <linux/mem_encrypt.h>
>
> +#include <asm/processor.h>
> +#include <asm/tdx.h>
> +
> #ifndef __ASSEMBLY__
>
> static inline bool prot_guest_has(unsigned int attr)
> {
> if (sme_me_mask)
> return amd_prot_guest_has(attr);
> + else if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
Why not "boot_cpu_has(X86_FEATURE_TDX_GUEST)"?