Implement virt-what-cvm for s390x
related: RHEL-50659
This commit is contained in:
parent
e793509c34
commit
30ecff2b9e
@ -0,0 +1,66 @@
|
||||
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
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: virt-what
|
||||
Version: 1.25
|
||||
Release: 8%{?dist}
|
||||
Release: 9%{?dist}
|
||||
Summary: Detect if we are running in a virtual machine
|
||||
License: GPLv2+
|
||||
|
||||
@ -31,6 +31,7 @@ Patch0014: 0014-virt-what-cvm-drop-TPM-logic-for-detecting-SNP-on-Hy.patch
|
||||
Patch0015: 0015-virt-what-cvm-rename-azure-hcl-fact-to-hyperv-hcl.patch
|
||||
Patch0016: 0016-Add-virt-what-cvm.pod-to-EXTRA_DIST.patch
|
||||
Patch0017: 0017-Fix-CVM-detection-on-Azure-with-TDX.patch
|
||||
Patch0018: 0018-Add-support-for-detecting-protected-virtualization-o.patch
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: git
|
||||
@ -138,6 +139,10 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Aug 05 2024 Richard W.M. Jones <rjones@redhat.com> - 1.25-9
|
||||
- Implement virt-what-cvm for s390x
|
||||
related: RHEL-50659
|
||||
|
||||
* Tue Jul 30 2024 Richard W.M. Jones <rjones@redhat.com> - 1.25-8
|
||||
- Add virt-what-cvm tool
|
||||
resolves: RHEL-50659
|
||||
|
Loading…
Reference in New Issue
Block a user