[libvirt] [PATCH v2 5/5] qemu: add support for Hyper-V Enlightened VMCS

Vitaly Kuznetsov vkuznets at redhat.com
Wed Nov 14 16:27:51 UTC 2018


Qemu 3.1 supports Hyper-V Enlightened VMCS feature which significantly
speeds up nested Hyper-V on KVM environments.

Signed-off-by: Vitaly Kuznetsov <vkuznets at redhat.com>
---
 docs/news.xml                           | 9 +++++++++
 src/qemu/qemu_command.c                 | 2 +-
 src/qemu/qemu_parse_command.c           | 2 +-
 src/qemu/qemu_process.c                 | 2 +-
 tests/qemuxml2argvdata/hyperv-off.xml   | 1 +
 tests/qemuxml2argvdata/hyperv.args      | 2 +-
 tests/qemuxml2argvdata/hyperv.xml       | 1 +
 tests/qemuxml2xmloutdata/hyperv-off.xml | 1 +
 tests/qemuxml2xmloutdata/hyperv.xml     | 1 +
 9 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/docs/news.xml b/docs/news.xml
index c826380a92..dc10cfe69b 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -44,6 +44,15 @@
           for Windows guests.
         </description>
       </change>
+      <change>
+        <summary>
+          qemu: Add Hyper-V Enlightened VMCS support
+        </summary>
+        <description>
+          The QEMU driver now has support for Hyper-V Enlightened VMCS
+          enlightenment for Hyper-V guests.
+        </description>
+      </change>
     </section>
     <section title="Improvements">
     </section>
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 27e77f7d66..d543ada2a1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6883,6 +6883,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
             case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
             case VIR_DOMAIN_HYPERV_TLBFLUSH:
             case VIR_DOMAIN_HYPERV_IPI:
+            case VIR_DOMAIN_HYPERV_EVMCS:
                 if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
                     virBufferAsprintf(&buf, ",hv_%s",
                                       virDomainHypervTypeToString(i));
@@ -6900,7 +6901,6 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
                                       def->hyperv_vendor_id);
                 break;
 
-            case VIR_DOMAIN_HYPERV_EVMCS:
             /* coverity[dead_error_begin] */
             case VIR_DOMAIN_HYPERV_LAST:
                 break;
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
index a1f8369919..d91fc8d901 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -1540,6 +1540,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
             case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
             case VIR_DOMAIN_HYPERV_TLBFLUSH:
             case VIR_DOMAIN_HYPERV_IPI:
+            case VIR_DOMAIN_HYPERV_EVMCS:
                 if (value) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                    _("HyperV feature '%s' should not "
@@ -1580,7 +1581,6 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
 
                 break;
 
-            case VIR_DOMAIN_HYPERV_EVMCS:
             case VIR_DOMAIN_HYPERV_LAST:
                 break;
             }
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ed8bcf7f76..ebe8e244ae 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3954,12 +3954,12 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
         case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
         case VIR_DOMAIN_HYPERV_TLBFLUSH:
         case VIR_DOMAIN_HYPERV_IPI:
+        case VIR_DOMAIN_HYPERV_EVMCS:
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("host doesn't support hyperv '%s' feature"),
                            virDomainHypervTypeToString(i));
             return -1;
 
-        case VIR_DOMAIN_HYPERV_EVMCS:
         /* coverity[dead_error_begin] */
         case VIR_DOMAIN_HYPERV_VENDOR_ID:
         case VIR_DOMAIN_HYPERV_LAST:
diff --git a/tests/qemuxml2argvdata/hyperv-off.xml b/tests/qemuxml2argvdata/hyperv-off.xml
index e51cca45b5..59c1e17ccd 100644
--- a/tests/qemuxml2argvdata/hyperv-off.xml
+++ b/tests/qemuxml2argvdata/hyperv-off.xml
@@ -24,6 +24,7 @@
       <reenlightenment state='off'/>
       <tlbflush state='off'/>
       <ipi state='off'/>
+      <evmcs state='off'/>
     </hyperv>
   </features>
   <clock offset='utc'/>
diff --git a/tests/qemuxml2argvdata/hyperv.args b/tests/qemuxml2argvdata/hyperv.args
index 0800e4f79d..5d59788e14 100644
--- a/tests/qemuxml2argvdata/hyperv.args
+++ b/tests/qemuxml2argvdata/hyperv.args
@@ -10,7 +10,7 @@ QEMU_AUDIO_DRV=none \
 -machine pc,accel=tcg,usb=off,dump-guest-core=off \
 -cpu 'qemu32,hv_relaxed,hv_vapic,hv_spinlocks=0x2fff,hv_vpindex,hv_runtime,\
 hv_synic,hv_stimer,hv_reset,hv_vendor_id=KVM Hv,hv_frequencies,\
-hv_reenlightenment,hv_tlbflush,hv_ipi' \
+hv_reenlightenment,hv_tlbflush,hv_ipi,hv_evmcs' \
 -m 214 \
 -smp 6,sockets=6,cores=1,threads=1 \
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/hyperv.xml b/tests/qemuxml2argvdata/hyperv.xml
index 05c7d478f7..c6feaed528 100644
--- a/tests/qemuxml2argvdata/hyperv.xml
+++ b/tests/qemuxml2argvdata/hyperv.xml
@@ -24,6 +24,7 @@
       <reenlightenment state='on'/>
       <tlbflush state='on'/>
       <ipi state='on'/>
+      <evmcs state='on'/>
     </hyperv>
   </features>
   <clock offset='utc'/>
diff --git a/tests/qemuxml2xmloutdata/hyperv-off.xml b/tests/qemuxml2xmloutdata/hyperv-off.xml
index 2282b763b5..1b7d82b14a 100644
--- a/tests/qemuxml2xmloutdata/hyperv-off.xml
+++ b/tests/qemuxml2xmloutdata/hyperv-off.xml
@@ -24,6 +24,7 @@
       <reenlightenment state='off'/>
       <tlbflush state='off'/>
       <ipi state='off'/>
+      <evmcs state='off'/>
     </hyperv>
   </features>
   <clock offset='utc'/>
diff --git a/tests/qemuxml2xmloutdata/hyperv.xml b/tests/qemuxml2xmloutdata/hyperv.xml
index 97f387c172..5510d3dfad 100644
--- a/tests/qemuxml2xmloutdata/hyperv.xml
+++ b/tests/qemuxml2xmloutdata/hyperv.xml
@@ -24,6 +24,7 @@
       <reenlightenment state='on'/>
       <tlbflush state='on'/>
       <ipi state='on'/>
+      <evmcs state='on'/>
     </hyperv>
   </features>
   <clock offset='utc'/>
-- 
2.17.2




More information about the libvir-list mailing list