[libvirt PATCH 12/16] virDomainFeaturesDefParse: Inline SMM parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 41 ++++++++++++++++++++++++++---------------
 1 file changed, 26 insertions(+), 15 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 02c06d5ab9..b411c1fb8c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -17554,8 +17554,7 @@ virDomainFeaturesDefParse(virDomainDef *def,
         case VIR_DOMAIN_FEATURE_HAP:
         case VIR_DOMAIN_FEATURE_PMU:
         case VIR_DOMAIN_FEATURE_PVSPINLOCK:
-        case VIR_DOMAIN_FEATURE_VMPORT:
-        case VIR_DOMAIN_FEATURE_SMM: {
+        case VIR_DOMAIN_FEATURE_VMPORT: {
             virTristateSwitch state;
 
             if (virXMLPropTristateSwitch(nodes[i], "state",
@@ -17569,6 +17568,31 @@ virDomainFeaturesDefParse(virDomainDef *def,
             break;
         }
 
+        case VIR_DOMAIN_FEATURE_SMM: {
+            virTristateSwitch state;
+
+            if (virXMLPropTristateSwitch(nodes[i], "state",
+                                         VIR_XML_PROP_NONE, &state) < 0)
+                return -1;
+
+            if ((state == VIR_TRISTATE_SWITCH_ABSENT) ||
+                (state == VIR_TRISTATE_SWITCH_ON)) {
+                int rv = virParseScaledValue("string(./features/smm/tseg)",
+                                             "string(./features/smm/tseg/@unit)",
+                                             ctxt,
+                                             &def->tseg_size,
+                                             1024 * 1024, /* Defaults to mebibytes */
+                                             ULLONG_MAX,
+                                             false);
+                if (rv < 0)
+                    return -1;
+
+                def->features[val] = VIR_TRISTATE_SWITCH_ON;
+                def->tseg_specified = rv != 0;
+            }
+            break;
+        }
+
         case VIR_DOMAIN_FEATURE_GIC:
             if (virXMLPropEnum(nodes[i], "version", virGICVersionTypeFromString,
                                VIR_XML_PROP_NONZERO, &def->gic_version) < 0)
@@ -17670,19 +17694,6 @@ virDomainFeaturesDefParse(virDomainDef *def,
     }
     VIR_FREE(nodes);
 
-    if (def->features[VIR_DOMAIN_FEATURE_SMM] == VIR_TRISTATE_SWITCH_ON) {
-        int rv = virParseScaledValue("string(./features/smm/tseg)",
-                                     "string(./features/smm/tseg/@unit)",
-                                     ctxt,
-                                     &def->tseg_size,
-                                     1024 * 1024, /* Defaults to mebibytes */
-                                     ULLONG_MAX,
-                                     false);
-        if (rv < 0)
-            return -1;
-        def->tseg_specified = rv;
-    }
-
     if (def->features[VIR_DOMAIN_FEATURE_MSRS] == VIR_TRISTATE_SWITCH_ON) {
         virDomainMsrsUnknown unknown;
         xmlNodePtr node = NULL;
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux