[PATCH v2 7/7] qemu_capabilities: Report Hyper-V Enlightenments in domcapabilities

Michal Privoznik mprivozn at redhat.com
Thu Jan 5 08:35:01 UTC 2023


Inside of qemuCaps (for the corresponding accelerator) we have
full host CPU expansion stored, among with supported Hyper-V
Enlightenments. To report them in the domain capabilities, we
just have to pick those starting with "hv-" and see if we know
them.

You may notice that neither of our domaincapsdata test shows any
enlightenment. This is because the test works by parsing
corresponding qemucapabilitiesdata/caps_*.xml file and none of
these store the full host CPU expansion (hostCPU.fullQEMU)
because that is runtime piece of information and not formatted
into virQEMUCaps XML.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1717611
Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_capabilities.c                  | 11 +++++++++++
 .../domaincapsdata/qemu_8.0.0-q35.x86_64.xml  | 19 ++++++++++++++++++-
 .../domaincapsdata/qemu_8.0.0-tcg.x86_64.xml  | 19 ++++++++++++++++++-
 tests/domaincapsdata/qemu_8.0.0.x86_64.xml    | 19 ++++++++++++++++++-
 4 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 93585f5af1..b557c737f0 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -6821,6 +6821,16 @@ virQEMUCapsFillDomainFeatureSGXCaps(virQEMUCaps *qemuCaps,
     virQEMUCapsSGXInfoCopy(&domCaps->sgx, qemuCaps->sgxCapabilities);
 }
 
+
+static void
+virQEMUCapsFillDomainFeatureHypervCaps(virQEMUCaps *qemuCaps,
+                                       virDomainCaps *domCaps)
+{
+    domCaps->hyperv = g_memdup(qemuCaps->hypervCapabilities,
+                               sizeof(virDomainCapsFeatureHyperv));
+}
+
+
 int
 virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps,
                           virArch hostarch,
@@ -6877,6 +6887,7 @@ virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps,
     virQEMUCapsFillDomainFeatureSEVCaps(qemuCaps, domCaps);
     virQEMUCapsFillDomainFeatureS390PVCaps(qemuCaps, domCaps);
     virQEMUCapsFillDomainFeatureSGXCaps(qemuCaps, domCaps);
+    virQEMUCapsFillDomainFeatureHypervCaps(qemuCaps, domCaps);
 
     return 0;
 }
diff --git a/tests/domaincapsdata/qemu_8.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_8.0.0-q35.x86_64.xml
index eb18b5c696..4170ae7a97 100644
--- a/tests/domaincapsdata/qemu_8.0.0-q35.x86_64.xml
+++ b/tests/domaincapsdata/qemu_8.0.0-q35.x86_64.xml
@@ -249,6 +249,23 @@
     <backup supported='yes'/>
     <sev supported='no'/>
     <sgx supported='no'/>
-    <hyperv supported='no'/>
+    <hyperv supported='yes'>
+      <enum name='features'>
+        <value>relaxed</value>
+        <value>vapic</value>
+        <value>spinlocks</value>
+        <value>vpindex</value>
+        <value>runtime</value>
+        <value>synic</value>
+        <value>stimer</value>
+        <value>reset</value>
+        <value>vendor_id</value>
+        <value>frequencies</value>
+        <value>reenlightenment</value>
+        <value>tlbflush</value>
+        <value>ipi</value>
+        <value>avic</value>
+      </enum>
+    </hyperv>
   </features>
 </domainCapabilities>
diff --git a/tests/domaincapsdata/qemu_8.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_8.0.0-tcg.x86_64.xml
index 471a92693f..3b52eba64f 100644
--- a/tests/domaincapsdata/qemu_8.0.0-tcg.x86_64.xml
+++ b/tests/domaincapsdata/qemu_8.0.0-tcg.x86_64.xml
@@ -248,6 +248,23 @@
     <backup supported='yes'/>
     <sev supported='no'/>
     <sgx supported='no'/>
-    <hyperv supported='no'/>
+    <hyperv supported='yes'>
+      <enum name='features'>
+        <value>relaxed</value>
+        <value>vapic</value>
+        <value>spinlocks</value>
+        <value>vpindex</value>
+        <value>runtime</value>
+        <value>synic</value>
+        <value>stimer</value>
+        <value>reset</value>
+        <value>vendor_id</value>
+        <value>frequencies</value>
+        <value>reenlightenment</value>
+        <value>tlbflush</value>
+        <value>ipi</value>
+        <value>avic</value>
+      </enum>
+    </hyperv>
   </features>
 </domainCapabilities>
diff --git a/tests/domaincapsdata/qemu_8.0.0.x86_64.xml b/tests/domaincapsdata/qemu_8.0.0.x86_64.xml
index 436ca212a8..fac8033f76 100644
--- a/tests/domaincapsdata/qemu_8.0.0.x86_64.xml
+++ b/tests/domaincapsdata/qemu_8.0.0.x86_64.xml
@@ -249,6 +249,23 @@
     <backup supported='yes'/>
     <sev supported='no'/>
     <sgx supported='no'/>
-    <hyperv supported='no'/>
+    <hyperv supported='yes'>
+      <enum name='features'>
+        <value>relaxed</value>
+        <value>vapic</value>
+        <value>spinlocks</value>
+        <value>vpindex</value>
+        <value>runtime</value>
+        <value>synic</value>
+        <value>stimer</value>
+        <value>reset</value>
+        <value>vendor_id</value>
+        <value>frequencies</value>
+        <value>reenlightenment</value>
+        <value>tlbflush</value>
+        <value>ipi</value>
+        <value>avic</value>
+      </enum>
+    </hyperv>
   </features>
 </domainCapabilities>
-- 
2.38.2



More information about the libvir-list mailing list