Skip to contentSkip to conversation

x86/coco: Use IS_ENABLED() in amd_cc_platform_has()

PATCH New Thorsten Blum 1 participant 1 message Nov 6 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/coco: Use IS_ENABLED() in amd_cc_platform_has()

Use IS_ENABLED() to add compile-time coverage to amd_cc_platform_has() independent of CONFIG_AMD_MEM_ENCRYPT.

Since amd_cc_platform_vtom() is now always referenced, remove the __maybe_unused annotation.

No functional change.

---
 arch/x86/coco/core.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
arch/x86/coco/core.c +3 -5
index 989ca9f72ba3..418ec77bbe3a 100644
@@ -44,7 +44,7 @@ static bool noinstr intel_cc_platform_has(enum cc_attr attr)
  * the other levels of SME/SEV functionality, including C-bit
  * based SEV-SNP, are not enabled.
  */
-static __maybe_unused __always_inline bool amd_cc_platform_vtom(enum cc_attr attr)
+static __always_inline bool amd_cc_platform_vtom(enum cc_attr attr)
 {
 	switch (attr) {
 	case CC_ATTR_GUEST_MEM_ENCRYPT:
@@ -69,7 +69,8 @@ static __maybe_unused __always_inline bool amd_cc_platform_vtom(enum cc_attr att
  */
 static bool noinstr amd_cc_platform_has(enum cc_attr attr)
 {
-#ifdef CONFIG_AMD_MEM_ENCRYPT
+	if (!IS_ENABLED(CONFIG_AMD_MEM_ENCRYPT))
+		return false;
 
 	if (sev_status & MSR_AMD64_SNP_VTOM)
 		return amd_cc_platform_vtom(attr);
@@ -110,9 +111,6 @@ static bool noinstr amd_cc_platform_has(enum cc_attr attr)
 	default:
 		return false;
 	}
-#else
-	return false;
-#endif
 }
 
 bool noinstr cc_platform_has(enum cc_attr attr)