Re: [RFC v1 03/26] x86/cpufeatures: Add is_tdx_guest() interface

From: Kuppuswamy, Sathyanarayanan
Date: Thu Apr 01 2021 - 17:15:58 EST




On 4/1/21 2:08 PM, Dave Hansen wrote:
On 2/5/21 3:38 PM, Kuppuswamy Sathyanarayanan wrote:
+bool is_tdx_guest(void)
+{
+ return static_cpu_has(X86_FEATURE_TDX_GUEST);
+}

Why do you need is_tdx_guest() as opposed to calling
cpu_feature_enabled(X86_FEATURE_TDX_GUEST) everywhere?

is_tdx_guest() is also implemented/used in compressed
code (which uses native_cpuid calls). I don't think
we can use cpu_feature_enabled(X86_FEATURE_TDX_GUEST) in
compressed code right? Also is_tdx_guest() looks easy
to read and use.


--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer