render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
9c6c51
From cb462f891f39ff47179e6fe65437450f9d8c7824 Mon Sep 17 00:00:00 2001
9c6c51
Message-Id: <cb462f891f39ff47179e6fe65437450f9d8c7824@dist-git>
9c6c51
From: Andrea Bolognani <abologna@redhat.com>
9c6c51
Date: Tue, 3 Jul 2018 15:25:16 +0200
9c6c51
Subject: [PATCH] conf: Parse and format the HTM pSeries feature
9c6c51
9c6c51
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
9c6c51
Reviewed-by: John Ferlan <jferlan@redhat.com>
9c6c51
9c6c51
(cherry picked from commit 9f3b9100f33036cb14296aa0a788788743b75a23)
9c6c51
https: //bugzilla.redhat.com/show_bug.cgi?id=1525599
9c6c51
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
9c6c51
Acked-by: David Gibson <dgibson@redhat.com>
9c6c51
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
9c6c51
---
9c6c51
 docs/formatdomain.html.in                     |  8 ++++++++
9c6c51
 docs/schemas/domaincommon.rng                 |  5 +++++
9c6c51
 src/conf/domain_conf.c                        | 19 +++++++++++++++++++
9c6c51
 src/conf/domain_conf.h                        |  1 +
9c6c51
 src/qemu/qemu_domain.c                        |  1 +
9c6c51
 tests/qemuxml2argvdata/pseries-features.xml   |  1 +
9c6c51
 tests/qemuxml2argvtest.c                      |  1 +
9c6c51
 tests/qemuxml2xmloutdata/pseries-features.xml |  1 +
9c6c51
 tests/qemuxml2xmltest.c                       |  1 +
9c6c51
 9 files changed, 38 insertions(+)
9c6c51
9c6c51
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
9c6c51
index 0d68596991..a3afe137bf 100644
9c6c51
--- a/docs/formatdomain.html.in
9c6c51
+++ b/docs/formatdomain.html.in
9c6c51
@@ -1929,6 +1929,7 @@
9c6c51
   <smm state='on'>
9c6c51
     <tseg unit='MiB'>48</tseg>
9c6c51
   </smm>
9c6c51
+  <htm state='on'/>
9c6c51
 </features>
9c6c51
 ...
9c6c51
 
9c6c51
@@ -2162,6 +2163,13 @@
9c6c51
       
Enable QEMU vmcoreinfo device to let the guest kernel save debug
9c6c51
           details. Since 4.4.0 (QEMU only)
9c6c51
       
9c6c51
+      
htm
9c6c51
+      
Configure HTM (Hardware Transational Memory) availability for
9c6c51
+          pSeries guests. Possible values for the state attribute
9c6c51
+          are on and off. If the attribute is not
9c6c51
+          defined, the hypervisor default will be used.
9c6c51
+          Since 4.6.0 (QEMU/KVM only)
9c6c51
+      
9c6c51
     
9c6c51
 
9c6c51
     

Time keeping

9c6c51
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
9c6c51
index f46145cf9b..bd687ce9d3 100644
9c6c51
--- a/docs/schemas/domaincommon.rng
9c6c51
+++ b/docs/schemas/domaincommon.rng
9c6c51
@@ -4907,6 +4907,11 @@
9c6c51
           <optional>
9c6c51
             <ref name="vmcoreinfo"/>
9c6c51
           </optional>
9c6c51
+          <optional>
9c6c51
+            <element name="htm">
9c6c51
+              <ref name="featurestate"/>
9c6c51
+            </element>
9c6c51
+          </optional>
9c6c51
         </interleave>
9c6c51
       </element>
9c6c51
     </optional>
9c6c51
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
9c6c51
index b8b53450fa..f4e59f6c91 100644
9c6c51
--- a/src/conf/domain_conf.c
9c6c51
+++ b/src/conf/domain_conf.c
9c6c51
@@ -152,6 +152,7 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST,
9c6c51
               "ioapic",
9c6c51
               "hpt",
9c6c51
               "vmcoreinfo",
9c6c51
+              "htm",
9c6c51
 );
9c6c51
 
9c6c51
 VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, VIR_DOMAIN_CAPABILITIES_POLICY_LAST,
9c6c51
@@ -19827,6 +19828,22 @@ virDomainDefParseXML(xmlDocPtr xml,
9c6c51
             }
9c6c51
             break;
9c6c51
 
9c6c51
+        case VIR_DOMAIN_FEATURE_HTM:
9c6c51
+            if (!(tmp = virXMLPropString(nodes[i], "state"))) {
9c6c51
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
9c6c51
+                               _("missing state attribute '%s' of feature '%s'"),
9c6c51
+                               tmp, virDomainFeatureTypeToString(val));
9c6c51
+                goto error;
9c6c51
+            }
9c6c51
+            if ((def->features[val] = virTristateSwitchTypeFromString(tmp)) < 0) {
9c6c51
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
9c6c51
+                               _("unknown state attribute '%s' of feature '%s'"),
9c6c51
+                               tmp, virDomainFeatureTypeToString(val));
9c6c51
+                goto error;
9c6c51
+            }
9c6c51
+            VIR_FREE(tmp);
9c6c51
+            break;
9c6c51
+
9c6c51
         /* coverity[dead_error_begin] */
9c6c51
         case VIR_DOMAIN_FEATURE_LAST:
9c6c51
             break;
9c6c51
@@ -21961,6 +21978,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
9c6c51
         case VIR_DOMAIN_FEATURE_VMPORT:
9c6c51
         case VIR_DOMAIN_FEATURE_SMM:
9c6c51
         case VIR_DOMAIN_FEATURE_VMCOREINFO:
9c6c51
+        case VIR_DOMAIN_FEATURE_HTM:
9c6c51
             if (src->features[i] != dst->features[i]) {
9c6c51
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
9c6c51
                                _("State of feature '%s' differs: "
9c6c51
@@ -27626,6 +27644,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
9c6c51
             case VIR_DOMAIN_FEATURE_PMU:
9c6c51
             case VIR_DOMAIN_FEATURE_PVSPINLOCK:
9c6c51
             case VIR_DOMAIN_FEATURE_VMPORT:
9c6c51
+            case VIR_DOMAIN_FEATURE_HTM:
9c6c51
                 switch ((virTristateSwitch) def->features[i]) {
9c6c51
                 case VIR_TRISTATE_SWITCH_LAST:
9c6c51
                 case VIR_TRISTATE_SWITCH_ABSENT:
9c6c51
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
9c6c51
index 71437dc485..41d27482fb 100644
9c6c51
--- a/src/conf/domain_conf.h
9c6c51
+++ b/src/conf/domain_conf.h
9c6c51
@@ -1771,6 +1771,7 @@ typedef enum {
9c6c51
     VIR_DOMAIN_FEATURE_IOAPIC,
9c6c51
     VIR_DOMAIN_FEATURE_HPT,
9c6c51
     VIR_DOMAIN_FEATURE_VMCOREINFO,
9c6c51
+    VIR_DOMAIN_FEATURE_HTM,
9c6c51
 
9c6c51
     VIR_DOMAIN_FEATURE_LAST
9c6c51
 } virDomainFeature;
9c6c51
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
9c6c51
index 4c2a162b85..0eacad1e44 100644
9c6c51
--- a/src/qemu/qemu_domain.c
9c6c51
+++ b/src/qemu/qemu_domain.c
9c6c51
@@ -3865,6 +3865,7 @@ qemuDomainDefValidateFeatures(const virDomainDef *def,
9c6c51
         case VIR_DOMAIN_FEATURE_PMU:
9c6c51
         case VIR_DOMAIN_FEATURE_VMPORT:
9c6c51
         case VIR_DOMAIN_FEATURE_VMCOREINFO:
9c6c51
+        case VIR_DOMAIN_FEATURE_HTM:
9c6c51
         case VIR_DOMAIN_FEATURE_LAST:
9c6c51
             break;
9c6c51
         }
9c6c51
diff --git a/tests/qemuxml2argvdata/pseries-features.xml b/tests/qemuxml2argvdata/pseries-features.xml
9c6c51
index 30cee5b81c..5c842fe87b 100644
9c6c51
--- a/tests/qemuxml2argvdata/pseries-features.xml
9c6c51
+++ b/tests/qemuxml2argvdata/pseries-features.xml
9c6c51
@@ -10,6 +10,7 @@
9c6c51
     <hpt resizing='required'>
9c6c51
       <maxpagesize unit='GiB'>1</maxpagesize>
9c6c51
     </hpt>
9c6c51
+    <htm state='on'/>
9c6c51
   </features>
9c6c51
   <devices>
9c6c51
     <emulator>/usr/bin/qemu-system-ppc64</emulator>
9c6c51
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
9c6c51
index c279ac4975..d6911f9344 100644
9c6c51
--- a/tests/qemuxml2argvtest.c
9c6c51
+++ b/tests/qemuxml2argvtest.c
9c6c51
@@ -1850,6 +1850,7 @@ mymain(void)
9c6c51
     DO_TEST("pseries-features",
9c6c51
             QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
9c6c51
             QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE,
9c6c51
+            QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
9c6c51
             QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
9c6c51
     DO_TEST_FAILURE("pseries-features",
9c6c51
                     QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
9c6c51
diff --git a/tests/qemuxml2xmloutdata/pseries-features.xml b/tests/qemuxml2xmloutdata/pseries-features.xml
9c6c51
index f36705f011..55a44c75a0 100644
9c6c51
--- a/tests/qemuxml2xmloutdata/pseries-features.xml
9c6c51
+++ b/tests/qemuxml2xmloutdata/pseries-features.xml
9c6c51
@@ -12,6 +12,7 @@
9c6c51
     <hpt resizing='required'>
9c6c51
       <maxpagesize unit='KiB'>1048576</maxpagesize>
9c6c51
     </hpt>
9c6c51
+    <htm state='on'/>
9c6c51
   </features>
9c6c51
   <clock offset='utc'/>
9c6c51
   <on_poweroff>destroy</on_poweroff>
9c6c51
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
9c6c51
index eac6d5b073..bbb995656e 100644
9c6c51
--- a/tests/qemuxml2xmltest.c
9c6c51
+++ b/tests/qemuxml2xmltest.c
9c6c51
@@ -620,6 +620,7 @@ mymain(void)
9c6c51
     DO_TEST("pseries-features",
9c6c51
             QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
9c6c51
             QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE,
9c6c51
+            QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
9c6c51
             QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
9c6c51
 
9c6c51
     DO_TEST("pseries-serial-native",
9c6c51
-- 
9c6c51
2.18.0
9c6c51