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

Vitaly Kuznetsov posted 5 patches 6 years ago
[libvirt] [PATCH v2 4/5] conf: add support for Hyper-V Enlightened VMCS
Posted by Vitaly Kuznetsov 6 years ago
Support Hyper-V Enlightened VMCS in domain config. Qemu support will
be implemented in the next patch, adding interim VIR_DOMAIN_HYPERV_EVMCS
cases to src/qemu/* for now.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 docs/formatdomain.html.in     | 7 +++++++
 docs/schemas/domaincommon.rng | 5 +++++
 src/conf/domain_conf.c        | 4 ++++
 src/conf/domain_conf.h        | 1 +
 src/cpu/cpu_x86.c             | 3 +++
 src/cpu/cpu_x86_data.h        | 1 +
 src/qemu/qemu_command.c       | 1 +
 src/qemu/qemu_parse_command.c | 1 +
 src/qemu/qemu_process.c       | 1 +
 9 files changed, 24 insertions(+)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 7592f13a84..1b1518f465 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1982,6 +1982,7 @@
     &lt;reenlightenment state='on'/&gt;
     &lt;tlbflush state='on'/&gt;
     &lt;ipi state='on'/&gt;
+    &lt;evmcs state='on'/&gt;
   &lt;/hyperv&gt;
   &lt;kvm&gt;
     &lt;hidden state='on'/&gt;
@@ -2128,6 +2129,12 @@
           <td>on, off</td>
           <td><span class="since">4.10.0 (QEMU 3.1)</span></td>
         </tr>
+        <tr>
+          <td>evmcs</td>
+          <td>Enable Enlightened VMCS</td>
+          <td>on, off</td>
+          <td><span class="since">4.10.0 (QEMU 3.1)</span></td>
+        </tr>
       </table>
       </dd>
       <dt><code>pvspinlock</code></dt>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 26019b3279..ff57ce1015 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5774,6 +5774,11 @@
             <ref name="featurestate"/>
           </element>
         </optional>
+        <optional>
+          <element name="evmcs">
+            <ref name="featurestate"/>
+          </element>
+        </optional>
       </interleave>
     </element>
   </define>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 24876994c5..18d235872f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -174,6 +174,7 @@ VIR_ENUM_IMPL(virDomainHyperv, VIR_DOMAIN_HYPERV_LAST,
               "reenlightenment",
               "tlbflush",
               "ipi",
+              "evmcs",
 );
 
 VIR_ENUM_IMPL(virDomainKVM, VIR_DOMAIN_KVM_LAST,
@@ -19993,6 +19994,7 @@ virDomainDefParseXML(xmlDocPtr xml,
             case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
             case VIR_DOMAIN_HYPERV_TLBFLUSH:
             case VIR_DOMAIN_HYPERV_IPI:
+            case VIR_DOMAIN_HYPERV_EVMCS:
                 break;
 
             case VIR_DOMAIN_HYPERV_SPINLOCKS:
@@ -22188,6 +22190,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
             case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
             case VIR_DOMAIN_HYPERV_TLBFLUSH:
             case VIR_DOMAIN_HYPERV_IPI:
+            case VIR_DOMAIN_HYPERV_EVMCS:
                 if (src->hyperv_features[i] != dst->hyperv_features[i]) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                    _("State of HyperV enlightenment "
@@ -27953,6 +27956,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
                     case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
                     case VIR_DOMAIN_HYPERV_TLBFLUSH:
                     case VIR_DOMAIN_HYPERV_IPI:
+                    case VIR_DOMAIN_HYPERV_EVMCS:
                         break;
 
                     case VIR_DOMAIN_HYPERV_SPINLOCKS:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9eea75548d..061185e779 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1796,6 +1796,7 @@ typedef enum {
     VIR_DOMAIN_HYPERV_REENLIGHTENMENT,
     VIR_DOMAIN_HYPERV_TLBFLUSH,
     VIR_DOMAIN_HYPERV_IPI,
+    VIR_DOMAIN_HYPERV_EVMCS,
 
     VIR_DOMAIN_HYPERV_LAST
 } virDomainHyperv;
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 33252e927e..ebfa74fccd 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -116,6 +116,8 @@ KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_TLBFLUSH,
                 0x40000004, 0x00000004);
 KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_IPI,
                 0x40000004, 0x00000400);
+KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_EVMCS,
+                0x40000004, 0x00004000);
 
 static virCPUx86Feature x86_kvm_features[] =
 {
@@ -140,6 +142,7 @@ static virCPUx86Feature x86_kvm_features[] =
     KVM_FEATURE(VIR_CPU_x86_KVM_HV_REENLIGHTENMENT),
     KVM_FEATURE(VIR_CPU_x86_KVM_HV_TLBFLUSH),
     KVM_FEATURE(VIR_CPU_x86_KVM_HV_IPI),
+    KVM_FEATURE(VIR_CPU_x86_KVM_HV_EVMCS),
 };
 
 typedef struct _virCPUx86Model virCPUx86Model;
diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h
index 8c51d88e1a..f52bba821f 100644
--- a/src/cpu/cpu_x86_data.h
+++ b/src/cpu/cpu_x86_data.h
@@ -66,6 +66,7 @@ struct _virCPUx86CPUID {
 # define VIR_CPU_x86_KVM_HV_REENLIGHTENMENT "__kvm_hv_reenlightenment"
 # define VIR_CPU_x86_KVM_HV_TLBFLUSH  "__kvm_hv_tlbflush"
 # define VIR_CPU_x86_KVM_HV_IPI       "__kvm_hv_ipi"
+# define VIR_CPU_x86_KVM_HV_EVMCS     "__kvm_hv_evmcs"
 
 
 # define VIR_CPU_X86_DATA_INIT { 0 }
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6fc8deff00..27e77f7d66 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6900,6 +6900,7 @@ 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 a15f4d1121..a1f8369919 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -1580,6 +1580,7 @@ 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 85e2f7046b..ed8bcf7f76 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3959,6 +3959,7 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
                            virDomainHypervTypeToString(i));
             return -1;
 
+        case VIR_DOMAIN_HYPERV_EVMCS:
         /* coverity[dead_error_begin] */
         case VIR_DOMAIN_HYPERV_VENDOR_ID:
         case VIR_DOMAIN_HYPERV_LAST:
-- 
2.17.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 4/5] conf: add support for Hyper-V Enlightened VMCS
Posted by Andrea Bolognani 6 years ago
On Wed, 2018-11-14 at 17:27 +0100, Vitaly Kuznetsov wrote:
> Support Hyper-V Enlightened VMCS in domain config. Qemu support will

s/Qemu/QEMU/

With that fixed,

  Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list