From: "Jörg Rödel" <joro@8bytes.org>
To: x86@kernel.org
Cc: Tom Lendacky <thomas.lendacky@amd.com>,
Michael Roth <michael.roth@amd.com>,
linux-kernel@vger.kernel.org, Joerg Roedel <joerg.roedel@amd.com>
Subject: [PATCH] x86/coco/sev: Make SEV_STATUS available via SYSFS
Date: Tue, 23 Jun 2026 09:38:20 +0200 [thread overview]
Message-ID: <20260623073820.1479769-1-joro@8bytes.org> (raw)
From: Joerg Roedel <joerg.roedel@amd.com>
Current user-space tooling which needs access to the SEV_STATUS MSR is
using the MSR module. The use of this module poses a security risk in
any trusted execution environment and is generally discouraged.
Instead, provide an file in SYSFS in the /sys/devices/system/cpu/sev/
directory to provide the value of the SEV_STATUS MSR to user-space.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
Documentation/ABI/testing/sysfs-devices-system-cpu | 4 ++++
arch/x86/coco/sev/core.c | 8 ++++++++
2 files changed, 12 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu
index 82d10d556cc8..f7908ade4be8 100644
--- a/Documentation/ABI/testing/sysfs-devices-system-cpu
+++ b/Documentation/ABI/testing/sysfs-devices-system-cpu
@@ -690,6 +690,7 @@ Description: Umwait control
What: /sys/devices/system/cpu/sev
/sys/devices/system/cpu/sev/vmpl
+ /sys/devices/system/cpu/sev/sev_status
Date: May 2024
Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
Description: Secure Encrypted Virtualization (SEV) information
@@ -699,6 +700,9 @@ Description: Secure Encrypted Virtualization (SEV) information
vmpl: Reports the Virtual Machine Privilege Level (VMPL) at which
the SEV-SNP guest is running.
+ sev_status: Reports the value of the SEV_STATUS MSR which
+ enumerates the enabled features of an SEV-SNP
+ environment.
What: /sys/devices/system/cpu/svm
Date: August 2019
diff --git a/arch/x86/coco/sev/core.c b/arch/x86/coco/sev/core.c
index 7ed3da998489..557c1f230cb9 100644
--- a/arch/x86/coco/sev/core.c
+++ b/arch/x86/coco/sev/core.c
@@ -1435,10 +1435,18 @@ static ssize_t vmpl_show(struct kobject *kobj,
return sysfs_emit(buf, "%d\n", snp_vmpl);
}
+static ssize_t sev_status_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ return sysfs_emit(buf, "0x%llx\n", sev_status);
+}
+
static struct kobj_attribute vmpl_attr = __ATTR_RO(vmpl);
+static struct kobj_attribute sev_status_attr = __ATTR_RO(sev_status);
static struct attribute *vmpl_attrs[] = {
&vmpl_attr.attr,
+ &sev_status_attr.attr,
NULL
};
--
2.53.0
next reply other threads:[~2026-06-23 7:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-23 7:38 Jörg Rödel [this message]
2026-07-12 0:52 ` Borislav Petkov
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=20260623073820.1479769-1-joro@8bytes.org \
--to=joro@8bytes.org \
--cc=joerg.roedel@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.roth@amd.com \
--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
all inboxes | Powered by JetHome®