render / rpms / libvirt

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

Time keeping

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