Re: [PATCH v5 04/12] x86/tdx: Add protected guest support for TDX guest

Dave Hansen
2021-08-04T22:03:39Z

On 8/4/21 2:59 PM, Sean Christopherson wrote:
>> +#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)"?

Even better: cpu_feature_enabled(X86_FEATURE_TDX_GUEST). That gets you
both static patching *and* compile-time optimization if you hook
X86_FEATURE_TDX_GUEST into disabled-features.h.