All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thorsten Blum <blum@kernel.org>
To: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Cc: Thorsten Blum <blum@kernel.org>, linux-kernel@vger.kernel.org
Subject: [PATCH] x86/coco: Use IS_ENABLED() in amd_cc_platform_has()
Date: Fri,  6 Nov 2026 10:13:00 +0100	[thread overview]
Message-ID: <20261106091301.2838-2-blum@kernel.org> (raw)

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)

                 reply	other threads:[~2026-11-06  9:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261106091301.2838-2-blum@kernel.org \
    --to=blum@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.