render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 742667e7f0a55f3a8042840e2995982a003dc2fc Mon Sep 17 00:00:00 2001
Message-Id: <742667e7f0a55f3a8042840e2995982a003dc2fc@dist-git>
From: Andrea Bolognani <abologna@redhat.com>
Date: Tue, 4 Dec 2018 16:46:19 +0100
Subject: [PATCH] conf: Parse and format nested-hv feature
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit bfa2bd7e38f2777260b63200ef12804e13a7a5c2)

https://bugzilla.redhat.com/show_bug.cgi?id=1647822

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 docs/formatdomain.html.in                     | 12 ++++++++++++
 docs/schemas/domaincommon.rng                 |  5 +++++
 src/conf/domain_conf.c                        |  4 ++++
 src/conf/domain_conf.h                        |  1 +
 src/qemu/qemu_domain.c                        |  1 +
 tests/qemuxml2argvdata/pseries-features.xml   |  1 +
 tests/qemuxml2xmloutdata/pseries-features.xml |  1 +
 7 files changed, 25 insertions(+)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 54eb298414..02d0ac4241 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2191,6 +2191,18 @@
           defined, the hypervisor default will be used.
           <span class="since">Since 4.6.0</span> (QEMU/KVM only)
       </dd>
+      <dt><code>nested-hv</code></dt>
+      <dd>Configure nested HV availability for pSeries guests. This needs to
+          be enabled from the host (L0) in order to be effective; having HV
+          support in the (L1) guest is very desiderable if it's planned to
+          run nested (L2) guests inside it, because it will result in those
+          nested guests having much better performance than they would when
+          using KVM PR or TCG.
+          Possible values for the <code>state</code> attribute are
+          <code>on</code> and <code>off</code>. If the attribute is not
+          defined, the hypervisor default will be used.
+          <span class="since">Since 4.10.0</span> (QEMU/KVM only)
+      </dd>
     </dl>
 
     <h3><a id="elementsTime">Time keeping</a></h3>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index e4ce7804b9..70a7767d9c 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4925,6 +4925,11 @@
               <ref name="featurestate"/>
             </element>
           </optional>
+          <optional>
+            <element name="nested-hv">
+              <ref name="featurestate"/>
+            </element>
+          </optional>
         </interleave>
       </element>
     </optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e013e9f0c5..660e1523fe 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -153,6 +153,7 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST,
               "hpt",
               "vmcoreinfo",
               "htm",
+              "nested-hv",
 );
 
 VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, VIR_DOMAIN_CAPABILITIES_POLICY_LAST,
@@ -19987,6 +19988,7 @@ virDomainDefParseXML(xmlDocPtr xml,
             break;
 
         case VIR_DOMAIN_FEATURE_HTM:
+        case VIR_DOMAIN_FEATURE_NESTED_HV:
             if (!(tmp = virXMLPropString(nodes[i], "state"))) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                _("missing state attribute '%s' of feature '%s'"),
@@ -22147,6 +22149,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
         case VIR_DOMAIN_FEATURE_SMM:
         case VIR_DOMAIN_FEATURE_VMCOREINFO:
         case VIR_DOMAIN_FEATURE_HTM:
+        case VIR_DOMAIN_FEATURE_NESTED_HV:
             if (src->features[i] != dst->features[i]) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                _("State of feature '%s' differs: "
@@ -27823,6 +27826,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
             case VIR_DOMAIN_FEATURE_PVSPINLOCK:
             case VIR_DOMAIN_FEATURE_VMPORT:
             case VIR_DOMAIN_FEATURE_HTM:
+            case VIR_DOMAIN_FEATURE_NESTED_HV:
                 switch ((virTristateSwitch) def->features[i]) {
                 case VIR_TRISTATE_SWITCH_LAST:
                 case VIR_TRISTATE_SWITCH_ABSENT:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index d32514e7e6..f05fca284f 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1775,6 +1775,7 @@ typedef enum {
     VIR_DOMAIN_FEATURE_HPT,
     VIR_DOMAIN_FEATURE_VMCOREINFO,
     VIR_DOMAIN_FEATURE_HTM,
+    VIR_DOMAIN_FEATURE_NESTED_HV,
 
     VIR_DOMAIN_FEATURE_LAST
 } virDomainFeature;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 4fcca1e05a..0ddc6ef4a7 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3819,6 +3819,7 @@ qemuDomainDefValidateFeatures(const virDomainDef *def,
 
         case VIR_DOMAIN_FEATURE_HPT:
         case VIR_DOMAIN_FEATURE_HTM:
+        case VIR_DOMAIN_FEATURE_NESTED_HV:
             if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT &&
                 !qemuDomainIsPSeries(def)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
diff --git a/tests/qemuxml2argvdata/pseries-features.xml b/tests/qemuxml2argvdata/pseries-features.xml
index 5c842fe87b..6f7d32b065 100644
--- a/tests/qemuxml2argvdata/pseries-features.xml
+++ b/tests/qemuxml2argvdata/pseries-features.xml
@@ -11,6 +11,7 @@
       <maxpagesize unit='GiB'>1</maxpagesize>
     </hpt>
     <htm state='on'/>
+    <nested-hv state='off'/>
   </features>
   <devices>
     <emulator>/usr/bin/qemu-system-ppc64</emulator>
diff --git a/tests/qemuxml2xmloutdata/pseries-features.xml b/tests/qemuxml2xmloutdata/pseries-features.xml
index 55a44c75a0..7e12bc9c03 100644
--- a/tests/qemuxml2xmloutdata/pseries-features.xml
+++ b/tests/qemuxml2xmloutdata/pseries-features.xml
@@ -13,6 +13,7 @@
       <maxpagesize unit='KiB'>1048576</maxpagesize>
     </hpt>
     <htm state='on'/>
+    <nested-hv state='off'/>
   </features>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
-- 
2.20.1