]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Add availability of s390-pv in domain capabilities
authorBoris Fiuczynski <fiuczy@linux.ibm.com>
Fri, 16 Jul 2021 09:44:32 +0000 (11:44 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Wed, 21 Jul 2021 11:30:30 +0000 (13:30 +0200)
Adding availability of s390-pv in domain capabilities and adjust tests.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
12 files changed:
docs/schemas/domaincaps.rng
src/conf/domain_capabilities.c
src/conf/domain_capabilities.h
src/qemu/qemu_capabilities.c
tests/domaincapsdata/qemu_2.11.0.s390x.xml
tests/domaincapsdata/qemu_2.12.0.s390x.xml
tests/domaincapsdata/qemu_3.0.0.s390x.xml
tests/domaincapsdata/qemu_4.0.0.s390x.xml
tests/domaincapsdata/qemu_4.2.0.s390x.xml
tests/domaincapsdata/qemu_5.2.0.s390x.xml
tests/domaincapsdata/qemu_6.0.0.s390x.xml
tests/domaincapsmock.c

index 69d7824e7c9dc507ae0e31d2715a666292153db1..8b5267f74141cbe2af568df4b3512dbe75a24f6c 100644 (file)
       <optional>
         <ref name="backup"/>
       </optional>
+      <optional>
+        <ref name="s390-pv"/>
+      </optional>
       <optional>
         <ref name="sev"/>
       </optional>
     </element>
   </define>
 
+  <define name="s390-pv">
+    <element name="s390-pv">
+      <ref name="supported"/>
+    </element>
+  </define>
+
   <define name="sev">
     <element name="sev">
       <ref name="supported"/>
index 73139d0ec6cde6e592e3197df7d8292042d37eb8..22f0963326f5d7042fea6a2e733705830cc4c94a 100644 (file)
@@ -42,6 +42,7 @@ VIR_ENUM_IMPL(virDomainCapsFeature,
               "genid",
               "backingStoreInput",
               "backup",
+              "s390-pv",
 );
 
 static virClass *virDomainCapsClass;
index a3765832c1fd56c2d68b618c23b739427ed28081..d44acdcd01a91a0988a815e0bac77b82b5b15d34 100644 (file)
@@ -186,6 +186,7 @@ typedef enum {
     VIR_DOMAIN_CAPS_FEATURE_GENID,
     VIR_DOMAIN_CAPS_FEATURE_BACKING_STORE_INPUT,
     VIR_DOMAIN_CAPS_FEATURE_BACKUP,
+    VIR_DOMAIN_CAPS_FEATURE_S390_PV,
 
     VIR_DOMAIN_CAPS_FEATURE_LAST
 } virDomainCapsFeature;
index 6f2572215b001284ff35e256bf304d27e9cfb158..6cea8c2eca3c0e2f80bf3e74a54296fde9978074 100644 (file)
@@ -6340,6 +6340,21 @@ virQEMUCapsFillDomainFeatureSEVCaps(virQEMUCaps *qemuCaps,
 }
 
 
+static void
+virQEMUCapsFillDomainFeatureS390PVCaps(virQEMUCaps *qemuCaps,
+                                       virDomainCaps *domCaps)
+{
+    if (ARCH_IS_S390(qemuCaps->arch)) {
+        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT) &&
+            virQEMUCapsGet(qemuCaps, QEMU_CAPS_S390_PV_GUEST) &&
+            virQEMUCapsGetKVMSupportsSecureGuest(qemuCaps))
+            domCaps->features[VIR_DOMAIN_CAPS_FEATURE_S390_PV] = VIR_TRISTATE_BOOL_YES;
+        else
+            domCaps->features[VIR_DOMAIN_CAPS_FEATURE_S390_PV] = VIR_TRISTATE_BOOL_NO;
+    }
+}
+
+
 int
 virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps,
                           virArch hostarch,
@@ -6388,6 +6403,7 @@ virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps,
     virQEMUCapsFillDomainDeviceFSCaps(qemuCaps, filesystem);
     virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps);
     virQEMUCapsFillDomainFeatureSEVCaps(qemuCaps, domCaps);
+    virQEMUCapsFillDomainFeatureS390PVCaps(qemuCaps, domCaps);
 
     return 0;
 }
index 9593fa17b742976651694da7d99cd3fd08637473..a52e436538c04548f2db9a1abdfd0f10e8a56494 100644 (file)
     <genid supported='no'/>
     <backingStoreInput supported='no'/>
     <backup supported='no'/>
+    <s390-pv supported='no'/>
     <sev supported='no'/>
   </features>
 </domainCapabilities>
index f5851b9e238289c2acc62b3badba1c05f04ab29c..f289a4893cb31e4f93a704f42164787368f1624b 100644 (file)
     <genid supported='no'/>
     <backingStoreInput supported='no'/>
     <backup supported='no'/>
+    <s390-pv supported='no'/>
     <sev supported='no'/>
   </features>
 </domainCapabilities>
index c298d6bf7197ba107070b56160e6a493f2a44f52..2aa34677c03467fb38fa428d0212f60e3fa5a0a0 100644 (file)
     <genid supported='no'/>
     <backingStoreInput supported='no'/>
     <backup supported='no'/>
+    <s390-pv supported='no'/>
     <sev supported='no'/>
   </features>
 </domainCapabilities>
index f1f4151635d640a766a40409249b35d1349f84a6..ede04824e9970dae0fcf993bc8e54fe75ac0137a 100644 (file)
     <genid supported='no'/>
     <backingStoreInput supported='no'/>
     <backup supported='no'/>
+    <s390-pv supported='no'/>
     <sev supported='no'/>
   </features>
 </domainCapabilities>
index febda17e6c09ccade166e693aa933dc7b6243cba..f344b289b27187625ef9bbc71f8bdc3c846fee53 100644 (file)
     <genid supported='no'/>
     <backingStoreInput supported='yes'/>
     <backup supported='no'/>
+    <s390-pv supported='no'/>
     <sev supported='no'/>
   </features>
 </domainCapabilities>
index 2d389c4c8951594210dad5424e60328810f345a3..c30de65f887c4b660ff5ceae37352297a38d54de 100644 (file)
     <genid supported='no'/>
     <backingStoreInput supported='yes'/>
     <backup supported='no'/>
+    <s390-pv supported='no'/>
     <sev supported='no'/>
   </features>
 </domainCapabilities>
index 49663bbdd3a2cf038a2bbf5d7c38e2ee2414c4c0..d6d8262a346bd4d8fa3a7aa05884ad0a68b142fb 100644 (file)
     <genid supported='no'/>
     <backingStoreInput supported='yes'/>
     <backup supported='no'/>
+    <s390-pv supported='yes'/>
     <sev supported='no'/>
   </features>
 </domainCapabilities>
index b03f75199bdeafaf8119941e48d9d0d427733684..7b02c0e8902215a4cddcdeb2d692398913ce0845 100644 (file)
@@ -17,6 +17,8 @@
 #include <config.h>
 
 #include "virhostcpu.h"
+#include "virmock.h"
+#include "qemu/qemu_capabilities.h"
 
 int
 virHostCPUGetKVMMaxVCPUs(void)
@@ -29,3 +31,18 @@ virHostCPUGetMicrocodeVersion(virArch hostArch G_GNUC_UNUSED)
 {
     return 0;
 }
+
+static bool (*real_virQEMUCapsGetKVMSupportsSecureGuest)(virQEMUCaps *qemuCaps);
+
+bool
+virQEMUCapsGetKVMSupportsSecureGuest(virQEMUCaps *qemuCaps)
+{
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT) &&
+        virQEMUCapsGet(qemuCaps, QEMU_CAPS_S390_PV_GUEST))
+        return true;
+
+    if (!real_virQEMUCapsGetKVMSupportsSecureGuest)
+        VIR_MOCK_REAL_INIT(virQEMUCapsGetKVMSupportsSecureGuest);
+
+    return real_virQEMUCapsGetKVMSupportsSecureGuest(qemuCaps);
+}