]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
tools/libxc: Reduce feature handling complexity in xc_cpuid_apply_policy()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 2 Mar 2020 14:36:03 +0000 (14:36 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 13 May 2020 19:33:42 +0000 (20:33 +0100)
xc_cpuid_apply_policy() is gaining extra parameters to untangle CPUID
complexity in Xen.  While an improvement in general, it does have the
unfortunate side effect of duplicating some settings across multiple
parameters.

Rearrange the logic to only consider 'pae' if no explicit featureset is
provided.  This reduces the complexity for callers who have already provided a
pae setting in the featureset.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Paul Durrant <pdurrant@amzn.com>
Acked-by: Wei Liu <wl@xen.org>
tools/libxc/include/xenctrl.h
tools/libxc/xc_cpuid_x86.c

index 0a6ff93229cf6ed1fbdb34a0c4d25d825af8adb2..45ff7db1e88b4377dc3f412ec32e8513d63def9a 100644 (file)
@@ -1798,6 +1798,13 @@ int xc_cpuid_set(xc_interface *xch,
                  const unsigned int *input,
                  const char **config,
                  char **config_transformed);
+
+/*
+ * Make adjustments to the CPUID settings for a domain.
+ *
+ * Either pass a full new @featureset (and @nr_features), or adjust individual
+ * features (@pae).
+ */
 int xc_cpuid_apply_policy(xc_interface *xch,
                           uint32_t domid,
                           const uint32_t *featureset,
index 5ced6d18b9eb161287f2cae787dd89ffa272e204..f045b03223f42fe99c8d4fb7c923cdfc5d32aa5e 100644 (file)
@@ -532,6 +532,11 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid,
 
         cpuid_featureset_to_policy(feat, p);
     }
+    else
+    {
+        if ( di.hvm )
+            p->basic.pae = pae;
+    }
 
     if ( !di.hvm )
     {
@@ -615,8 +620,6 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid,
             break;
         }
 
-        p->basic.pae = pae;
-
         /*
          * These settings are necessary to cause earlier HVM_PARAM_NESTEDHVM /
          * XEN_DOMCTL_disable_migrate settings to be reflected correctly in