Linux Confidential Computing Development
 help / color / mirror / Atom feed
From: "Jörg Rödel" <joro@8bytes.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
Cc: hpa@zytor.com, Tom Lendacky <thomas.lendacky@amd.com>,
	joro@8bytes.org, linux-kernel@vger.kernel.org,
	linux-coco@lists.linux.dev, Joerg Roedel <joerg.roedel@amd.com>
Subject: [PATCH 1/3] x86/coco: Add CC_ATTR_GUEST_SEV
Date: Mon,  3 Aug 2026 14:58:25 +0200	[thread overview]
Message-ID: <20260803125827.718024-2-joro@8bytes.org> (raw)
In-Reply-To: <20260803125827.718024-1-joro@8bytes.org>

From: Joerg Roedel <joerg.roedel@amd.com>

Add a new attribute to the CC platform code to check whether the
kernel runs in an environment using SEV memory encryption. This will
be used to establish the an sev/ directory in SYSFS (which is
currently SEV-SNP-only).

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 arch/x86/coco/core.c        | 3 +++
 include/linux/cc_platform.h | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/arch/x86/coco/core.c b/arch/x86/coco/core.c
index 989ca9f72ba3..63c06c2ac409 100644
--- a/arch/x86/coco/core.c
+++ b/arch/x86/coco/core.c
@@ -95,6 +95,9 @@ static bool noinstr amd_cc_platform_has(enum cc_attr attr)
 		return (sev_status & MSR_AMD64_SEV_ENABLED) &&
 			!(sev_status & MSR_AMD64_SEV_ES_ENABLED);
 
+	case CC_ATTR_GUEST_SEV:
+		return sev_status & MSR_AMD64_SEV_ENABLED;
+
 	case CC_ATTR_GUEST_SEV_SNP:
 		return sev_status & MSR_AMD64_SEV_SNP_ENABLED;
 
diff --git a/include/linux/cc_platform.h b/include/linux/cc_platform.h
index 559353ad64ac..f87ee0652b04 100644
--- a/include/linux/cc_platform.h
+++ b/include/linux/cc_platform.h
@@ -73,6 +73,15 @@ enum cc_attr {
 	 */
 	CC_ATTR_GUEST_UNROLL_STRING_IO,
 
+	/**
+	 * @CC_ATTR_GUEST_SEV: Guest SEV is active.
+	 *
+	 * The platform/OS is running as a virtual machine guest and actively
+	 * using AMD SEV memory encryption. This is true for SEV, SEV-ES, and
+	 * SEV-SNP guests.
+	 */
+	CC_ATTR_GUEST_SEV,
+
 	/**
 	 * @CC_ATTR_GUEST_SEV_SNP: Guest SNP is active.
 	 *
-- 
2.53.0


  reply	other threads:[~2026-08-03 12:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 12:58 [PATCH 0/3 v2] x86/sev: Report MSR_AMD64_SEV in SYSFS Jörg Rödel
2026-08-03 12:58 ` Jörg Rödel [this message]
2026-08-03 12:58 ` [PATCH 2/3] x86/sev: Create /sys/devices/system/cpu/sev/ for all SEV guests Jörg Rödel
2026-08-03 12:58 ` [PATCH 3/3] x86/coco/sev: Make SEV_STATUS available via SYSFS Jörg Rödel

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=20260803125827.718024-2-joro@8bytes.org \
    --to=joro@8bytes.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=joerg.roedel@amd.com \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@kernel.org \
    --cc=thomas.lendacky@amd.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox