On Fri, Oct 08 2021 at 22:37, Kuppuswamy Sathyanarayanan wrote:
-static bool __maybe_unused intel_cc_platform_has(enum cc_attr attr)This function is only called when is_tdx_guest() is true. So
+static bool intel_cc_platform_has(enum cc_attr attr)
{
#ifdef CONFIG_INTEL_TDX_GUEST
- return false;
+ switch (attr) {
+ case CC_ATTR_GUEST_TDX:
+ return is_tdx_guest();
is_tdx_guest() has to be called again to make sure?
Agree. I will remove it.
Also the ifdeffery can just go away simply because the compiler will
discard this function when CONFIG_INTEL_TDX_GUEST=n due to:
+#ifdef CONFIG_INTEL_TDX_GUESTThanks,
+
+bool is_tdx_guest(void);
+void __init tdx_early_init(void);
+
+#else
+
+static inline bool is_tdx_guest(void) { return false; }
+static inline void tdx_early_init(void) { };
+
+#endif /* CONFIG_INTEL_TDX_GUEST */
tglx