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

[Xen-changelog] [xen master] x86/cpuid: Move the legacy cpuids array into struct cpuid_policy



commit 37814513bc9dcd46d084d5713eee7f8d6f7f870f
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Jan 4 13:31:53 2017 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri Jan 13 13:16:57 2017 +0000

    x86/cpuid: Move the legacy cpuids array into struct cpuid_policy
    
    This hides the legacy details inside the cpuid subsystem, where they will
    eventually be dropped entirely.
    
    While altering the line containing paging_initialised, change its type to 
bool
    to match its use.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/cpuid.c         | 10 +++++++++-
 xen/arch/x86/domain.c        | 14 +-------------
 xen/arch/x86/domctl.c        |  4 ++--
 xen/include/asm-x86/cpuid.h  |  4 ++++
 xen/include/asm-x86/domain.h |  5 -----
 5 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index b7f6e60..95040f9 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -330,6 +330,8 @@ void recalculate_cpuid_policy(struct domain *d)
 
 int init_domain_cpuid_policy(struct domain *d)
 {
+    unsigned int i;
+
     d->arch.cpuid = xmalloc(struct cpuid_policy);
 
     if ( !d->arch.cpuid )
@@ -339,6 +341,12 @@ int init_domain_cpuid_policy(struct domain *d)
 
     recalculate_cpuid_policy(d);
 
+    for ( i = 0; i < MAX_CPUID_INPUT; i++ )
+    {
+        d->arch.cpuid->legacy[i].input[0] = XEN_CPUID_INPUT_UNUSED;
+        d->arch.cpuid->legacy[i].input[1] = XEN_CPUID_INPUT_UNUSED;
+    }
+
     return 0;
 }
 
@@ -349,7 +357,7 @@ static void domain_cpuid(const struct domain *d, uint32_t 
leaf,
 
     for ( i = 0; i < MAX_CPUID_INPUT; i++ )
     {
-        cpuid_input_t *cpuid = &d->arch.cpuids[i];
+        xen_domctl_cpuid_t *cpuid = &d->arch.cpuid->legacy[i];
 
         if ( (cpuid->input[0] == leaf) &&
              ((cpuid->input[1] == XEN_CPUID_INPUT_UNUSED) ||
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 6fc1242..369a83a 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -503,7 +503,7 @@ static bool emulation_flags_ok(const struct domain *d, 
uint32_t emflags)
 int arch_domain_create(struct domain *d, unsigned int domcr_flags,
                        struct xen_arch_domainconfig *config)
 {
-    int i, paging_initialised = 0;
+    bool paging_initialised = false;
     int rc = -ENOMEM;
 
     if ( config == NULL && !is_idle_domain(d) )
@@ -606,16 +606,6 @@ int arch_domain_create(struct domain *d, unsigned int 
domcr_flags,
         if ( (rc = init_domain_cpuid_policy(d)) )
             goto fail;
 
-        d->arch.cpuids = xmalloc_array(cpuid_input_t, MAX_CPUID_INPUT);
-        rc = -ENOMEM;
-        if ( d->arch.cpuids == NULL )
-            goto fail;
-        for ( i = 0; i < MAX_CPUID_INPUT; i++ )
-        {
-            d->arch.cpuids[i].input[0] = XEN_CPUID_INPUT_UNUSED;
-            d->arch.cpuids[i].input[1] = XEN_CPUID_INPUT_UNUSED;
-        }
-
         d->arch.x86_vendor = boot_cpu_data.x86_vendor;
         d->arch.x86        = boot_cpu_data.x86;
         d->arch.x86_model  = boot_cpu_data.x86_model;
@@ -678,7 +668,6 @@ int arch_domain_create(struct domain *d, unsigned int 
domcr_flags,
     iommu_domain_destroy(d);
     cleanup_domain_irq_mapping(d);
     free_xenheap_page(d->shared_info);
-    xfree(d->arch.cpuids);
     xfree(d->arch.cpuid);
     if ( paging_initialised )
         paging_final_teardown(d);
@@ -697,7 +686,6 @@ void arch_domain_destroy(struct domain *d)
         hvm_domain_destroy(d);
 
     xfree(d->arch.e820);
-    xfree(d->arch.cpuids);
     xfree(d->arch.cpuid);
 
     free_domain_pirqs(d);
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 038521a..772c5d2 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -51,13 +51,13 @@ static int gdbsx_guest_mem_io(domid_t domid, struct 
xen_domctl_gdbsx_memio *iop)
 static int update_legacy_cpuid_array(struct domain *d,
                                      const xen_domctl_cpuid_t *ctl)
 {
-    cpuid_input_t *cpuid, *unused = NULL;
+    xen_domctl_cpuid_t *cpuid, *unused = NULL;
     unsigned int i;
 
     /* Try to insert ctl into d->arch.cpuids[] */
     for ( i = 0; i < MAX_CPUID_INPUT; i++ )
     {
-        cpuid = &d->arch.cpuids[i];
+        cpuid = &d->arch.cpuid->legacy[i];
 
         if ( cpuid->input[0] == XEN_CPUID_INPUT_UNUSED )
         {
diff --git a/xen/include/asm-x86/cpuid.h b/xen/include/asm-x86/cpuid.h
index 38e3975..b359b38 100644
--- a/xen/include/asm-x86/cpuid.h
+++ b/xen/include/asm-x86/cpuid.h
@@ -203,6 +203,10 @@ struct cpuid_policy
 
     /* Toolstack selected Hypervisor max_leaf (if non-zero). */
     uint8_t hv_limit, hv2_limit;
+
+    /* Temporary: Legacy data array. */
+#define MAX_CPUID_INPUT 40
+    xen_domctl_cpuid_t legacy[MAX_CPUID_INPUT];
 };
 
 /* Fill in a featureset bitmap from a CPUID policy. */
diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h
index 9e3a07b..eb6227d 100644
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
@@ -234,9 +234,6 @@ struct paging_vcpu {
     struct shadow_vcpu shadow;
 };
 
-#define MAX_CPUID_INPUT 40
-typedef xen_domctl_cpuid_t cpuid_input_t;
-
 #define MAX_NESTEDP2M 10
 
 #define MAX_ALTP2M      10 /* arbitrary */
@@ -360,8 +357,6 @@ struct arch_domain
      */
     uint8_t x87_fip_width;
 
-    cpuid_input_t *cpuids;
-
     /* CPUID Policy. */
     struct cpuid_policy *cpuid;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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