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

[xen master] tools/libxc: Reduce feature handling complexity in xc_cpuid_apply_policy()



commit d8a6a8b36d864e1e56d3c63b30892cbb4e55d65c
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon Mar 2 14:36:03 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed May 13 20:33:42 2020 +0100

    tools/libxc: Reduce feature handling complexity in xc_cpuid_apply_policy()
    
    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@xxxxxxxxxx>
    Reviewed-by: Paul Durrant <pdurrant@xxxxxxxx>
    Acked-by: Wei Liu <wl@xxxxxxx>
---
 tools/libxc/include/xenctrl.h | 7 +++++++
 tools/libxc/xc_cpuid_x86.c    | 7 +++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 0a6ff93229..45ff7db1e8 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -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,
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 5ced6d18b9..f045b03223 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -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
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.