67 lines
1.6 KiB
Diff
67 lines
1.6 KiB
Diff
From d1cedcffeeff58f33aa467d62c0347ce7073aa4e Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
|
Date: Fri, 2 Aug 2024 16:07:46 +0100
|
|
Subject: [PATCH] Add support for detecting protected virtualization on s390x
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
(cherry picked from commit 037689fbe95e403b050c1eb736ebc8fdc2e601a5)
|
|
---
|
|
virt-what-cvm.c | 21 ++++++++++++++++++++-
|
|
virt-what-cvm.pod | 5 +++++
|
|
2 files changed, 25 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/virt-what-cvm.c b/virt-what-cvm.c
|
|
index 0daa6ac35..320df478b 100644
|
|
--- a/virt-what-cvm.c
|
|
+++ b/virt-what-cvm.c
|
|
@@ -295,7 +295,26 @@ cpu_sig (void)
|
|
cpu_sig_intel ();
|
|
}
|
|
|
|
-#else /* !x86_64 */
|
|
+#elif defined(__s390x__)
|
|
+
|
|
+#define SYSFS_PROT_VIRT "/sys/firmware/uv/prot_virt_guest"
|
|
+
|
|
+static void
|
|
+cpu_sig (void)
|
|
+{
|
|
+ int fd = open("/sys/firmware/uv/prot_virt_guest", O_RDONLY);
|
|
+ char c;
|
|
+ if (fd < 0)
|
|
+ return;
|
|
+
|
|
+ if (read(fd, &c, 1) == 1 && c == '1')
|
|
+ puts("s390-protvirt");
|
|
+
|
|
+ close(fd);
|
|
+}
|
|
+
|
|
+
|
|
+#else /* ! x86_64 && ! s390x */
|
|
|
|
static void
|
|
cpu_sig (void)
|
|
diff --git a/virt-what-cvm.pod b/virt-what-cvm.pod
|
|
index 70213abd7..00e21cb70 100644
|
|
--- a/virt-what-cvm.pod
|
|
+++ b/virt-what-cvm.pod
|
|
@@ -60,6 +60,11 @@ paired with B<amd-sev-snp>.
|
|
|
|
Status: tested on Microsoft Azure SEV-SNP & TDX CVM
|
|
|
|
+=item B<s390x-protvirt>
|
|
+
|
|
+This is a confidential guest running on s390x with the
|
|
+Protected Virtualization (Secure Execution) technology
|
|
+
|
|
=back
|
|
|
|
=head1 EXIT STATUS
|
|
--
|
|
2.43.0
|
|
|