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

[Xen-changelog] [xen master] x86/domctl: break out logic to update domain state from cpuid information



commit 277df04ba9635d698c9189dbf893e12b0cb73cf2
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Jan 22 16:18:02 2016 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Jan 22 16:18:02 2016 +0100

    x86/domctl: break out logic to update domain state from cpuid information
    
    Later changes will add to this logic.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/domctl.c |   66 ++++++++++++++++++++++++++----------------------
 1 files changed, 36 insertions(+), 30 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 95b0747..1d71216 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -47,6 +47,40 @@ static int gdbsx_guest_mem_io(domid_t domid, struct 
xen_domctl_gdbsx_memio *iop)
     return iop->remain ? -EFAULT : 0;
 }
 
+static void update_domain_cpuid_info(struct domain *d,
+                                     const xen_domctl_cpuid_t *ctl)
+{
+    switch ( ctl->input[0] )
+    {
+    case 0: {
+        union {
+            typeof(boot_cpu_data.x86_vendor_id) str;
+            struct {
+                uint32_t ebx, edx, ecx;
+            } reg;
+        } vendor_id = {
+            .reg = {
+                .ebx = ctl->ebx,
+                .edx = ctl->edx,
+                .ecx = ctl->ecx
+            }
+        };
+
+        d->arch.x86_vendor = get_cpu_vendor(vendor_id.str, gcv_guest);
+        break;
+    }
+
+    case 1:
+        d->arch.x86 = (ctl->eax >> 8) & 0xf;
+        if ( d->arch.x86 == 0xf )
+            d->arch.x86 += (ctl->eax >> 20) & 0xff;
+        d->arch.x86_model = (ctl->eax >> 4) & 0xf;
+        if ( d->arch.x86 >= 0x6 )
+            d->arch.x86_model |= (ctl->eax >> 12) & 0xf0;
+        break;
+    }
+}
+
 #define MAX_IOPORTS 0x10000
 
 long arch_do_domctl(
@@ -698,36 +732,8 @@ long arch_do_domctl(
             ret = -ENOENT;
 
         if ( !ret )
-        {
-            switch ( ctl->input[0] )
-            {
-            case 0: {
-                union {
-                    typeof(boot_cpu_data.x86_vendor_id) str;
-                    struct {
-                        uint32_t ebx, edx, ecx;
-                    } reg;
-                } vendor_id = {
-                    .reg = {
-                        .ebx = ctl->ebx,
-                        .edx = ctl->edx,
-                        .ecx = ctl->ecx
-                    }
-                };
+            update_domain_cpuid_info(d, ctl);
 
-                d->arch.x86_vendor = get_cpu_vendor(vendor_id.str, gcv_guest);
-                break;
-            }
-            case 1:
-                d->arch.x86 = (ctl->eax >> 8) & 0xf;
-                if ( d->arch.x86 == 0xf )
-                    d->arch.x86 += (ctl->eax >> 20) & 0xff;
-                d->arch.x86_model = (ctl->eax >> 4) & 0xf;
-                if ( d->arch.x86 >= 0x6 )
-                    d->arch.x86_model |= (ctl->eax >> 12) & 0xf0;
-                break;
-            }
-        }
         break;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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