[PATCH] x86/coco: Use IS_ENABLED() in amd_cc_platform_has()
From: Thorsten Blum
Date: Fri Nov 06 2026 - 04:20:06 EST
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.
Signed-off-by: Thorsten Blum <blum@xxxxxxxxxx>
---
arch/x86/coco/core.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/arch/x86/coco/core.c b/arch/x86/coco/core.c
index 989ca9f72ba3..418ec77bbe3a 100644
--- a/arch/x86/coco/core.c
+++ b/arch/x86/coco/core.c
@@ -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)