* [PATCH] x86/coco: Use IS_ENABLED() in amd_cc_platform_has()
@ 2026-11-06 9:13 Thorsten Blum
0 siblings, 0 replies; only message in thread
From: Thorsten Blum @ 2026-11-06 9:13 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin
Cc: Thorsten Blum, linux-kernel
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@kernel.org>
---
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)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-06 9:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-06 9:13 [PATCH] x86/coco: Use IS_ENABLED() in amd_cc_platform_has() Thorsten Blum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®