[libvirt] [PATCH 4/6] conf: Parse and format nested-hv feature

Andrea Bolognani abologna at redhat.com
Tue Nov 20 17:08:34 UTC 2018


Signed-off-by: Andrea Bolognani <abologna at 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 2af4960981..84259c45e4 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2295,6 +2295,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 5ee727eefa..d7a022a4ae 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4976,6 +4976,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 13874837c2..90f5618a04 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,
@@ -20155,6 +20156,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'"),
@@ -22317,6 +22319,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: "
@@ -28232,6 +28235,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 467785cd83..b84db2ab7c 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1777,6 +1777,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 a8a235a897..ee61caa823 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3890,6 +3890,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.19.1




More information about the libvir-list mailing list