On Tue, Jun 01, 2021 at 02:14:17PM -0700, Kuppuswamy Sathyanarayanan wrote:
diff --git a/include/linux/protected_guest.h b/include/linux/protected_guest.h
index 6855d5b3e244..bb4b1a06b21f 100644
--- a/include/linux/protected_guest.h
+++ b/include/linux/protected_guest.h
@@ -2,7 +2,9 @@
#ifndef _LINUX_PROTECTED_GUEST_H
#define _LINUX_PROTECTED_GUEST_H 1
-#include <linux/mem_encrypt.h>
+#include <asm/processor.h>
+#include <asm/tdx.h>
+#include <asm/sev.h>
/* Protected Guest Feature Flags (leave 0-0xff for arch specific flags) */
@@ -20,23 +22,18 @@
#define VM_DISABLE_UNCORE_SUPPORT 0x105
#if defined(CONFIG_INTEL_TDX_GUEST) || defined(CONFIG_AMD_MEM_ENCRYPT)
-
-#include <asm/tdx.h>
-
static inline bool protected_guest_has(unsigned long flag)
{
if (is_tdx_guest())
return tdx_protected_guest_has(flag);
- else if (mem_encrypt_active())
- return amd_protected_guest_has(flag);
+ else if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
+ return sev_protected_guest_has(flag);
return false;
}
#else
-
static inline bool protected_guest_has(unsigned long flag) { return false; }
-
#endif
-#endif
+#endif /* _LINUX_PROTECTED_GUEST_H */