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

[Xen-changelog] [xen-unstable] x86: add platform hypercall to retrieve pCPU-s' family, model, and stepping



# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1323766131 -3600
# Node ID 3f4ffde189f228d88e534865023fd795f77f0d05
# Parent  77528dbced3ea74901be6b1aeddedda22bfdaf63
x86: add platform hypercall to retrieve pCPU-s' family, model, and stepping

With the recent hotplug changes to the Xen part of the microcode
loading, this allows the kernel driver to avoid unnecessary calls into
the hypervisor during pCPU hot-enabling: Knowing that the hypervisor
retains the data for already booted CPUs, only data for CPUs with a
different signature needs to be passed down. Since the microcode
loading code can be pretty verbose, avoiding to invoke it can make the
log much easier to look at in case of problems.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Keir Fraser <keir@xxxxxxx>
---


diff -r 77528dbced3e -r 3f4ffde189f2 xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c Tue Dec 13 09:47:13 2011 +0100
+++ b/xen/arch/x86/platform_hypercall.c Tue Dec 13 09:48:51 2011 +0100
@@ -469,6 +469,42 @@
     }
     break;
 
+    case XENPF_get_cpu_version:
+    {
+        struct xenpf_pcpu_version *ver = &op->u.pcpu_version;
+
+        if ( !get_cpu_maps() )
+        {
+            ret = -EBUSY;
+            break;
+        }
+
+        if ( (ver->xen_cpuid >= nr_cpu_ids) || !cpu_online(ver->xen_cpuid) )
+        {
+            memset(ver->vendor_id, 0, sizeof(ver->vendor_id));
+            ver->family = 0;
+            ver->model = 0;
+            ver->stepping = 0;
+        }
+        else
+        {
+            const struct cpuinfo_x86 *c = &cpu_data[ver->xen_cpuid];
+
+            memcpy(ver->vendor_id, c->x86_vendor_id, sizeof(ver->vendor_id));
+            ver->family = c->x86;
+            ver->model = c->x86_model;
+            ver->stepping = c->x86_mask;
+        }
+
+        ver->max_present = cpumask_last(&cpu_present_map);
+
+        put_cpu_maps();
+
+        if ( copy_field_to_guest(u_xenpf_op, op, u.pcpu_version) )
+            ret = -EFAULT;
+    }
+    break;
+
     case XENPF_cpu_online:
     {
         int cpu = op->u.cpu_ol.cpuid;
diff -r 77528dbced3e -r 3f4ffde189f2 xen/arch/x86/x86_64/platform_hypercall.c
--- a/xen/arch/x86/x86_64/platform_hypercall.c  Tue Dec 13 09:47:13 2011 +0100
+++ b/xen/arch/x86/x86_64/platform_hypercall.c  Tue Dec 13 09:48:51 2011 +0100
@@ -3,7 +3,7 @@
  */
 
 #include <xen/config.h>
-#include <xen/types.h>
+#include <xen/lib.h>
 #include <compat/platform.h>
 
 DEFINE_XEN_GUEST_HANDLE(compat_platform_op_t);
@@ -26,8 +26,13 @@
 #define xen_processor_power_t   compat_processor_power_t
 #define set_cx_pminfo           compat_set_cx_pminfo
 
-#define xenpf_pcpuinfo compat_pf_pcpuinfo
-#define xenpf_pcpuinfo_t compat_pf_pcpuinfo_t
+#define xen_pf_pcpuinfo xenpf_pcpuinfo
+CHECK_pf_pcpuinfo;
+#undef xen_pf_pcpuinfo
+
+#define xen_pf_pcpu_version xenpf_pcpu_version
+CHECK_pf_pcpu_version;
+#undef xen_pf_pcpu_version
 
 #define xenpf_enter_acpi_sleep compat_pf_enter_acpi_sleep
 
diff -r 77528dbced3e -r 3f4ffde189f2 xen/include/public/platform.h
--- a/xen/include/public/platform.h     Tue Dec 13 09:47:13 2011 +0100
+++ b/xen/include/public/platform.h     Tue Dec 13 09:48:51 2011 +0100
@@ -449,6 +449,21 @@
 typedef struct xenpf_pcpuinfo xenpf_pcpuinfo_t;
 DEFINE_XEN_GUEST_HANDLE(xenpf_pcpuinfo_t);
 
+#define XENPF_get_cpu_version 48
+struct xenpf_pcpu_version {
+    /* IN */
+    uint32_t xen_cpuid;
+    /* OUT */
+    /* The maxium cpu_id that is present */
+    uint32_t max_present;
+    char vendor_id[12];
+    uint32_t family;
+    uint32_t model;
+    uint32_t stepping;
+};
+typedef struct xenpf_pcpu_version xenpf_pcpu_version_t;
+DEFINE_XEN_GUEST_HANDLE(xenpf_pcpu_version_t);
+
 #define XENPF_cpu_online    56
 #define XENPF_cpu_offline   57
 struct xenpf_cpu_ol
@@ -492,6 +507,7 @@
         struct xenpf_getidletime       getidletime;
         struct xenpf_set_processor_pminfo set_pminfo;
         struct xenpf_pcpuinfo          pcpu_info;
+        struct xenpf_pcpu_version      pcpu_version;
         struct xenpf_cpu_ol            cpu_ol;
         struct xenpf_cpu_hotadd        cpu_add;
         struct xenpf_mem_hotadd        mem_add;
diff -r 77528dbced3e -r 3f4ffde189f2 xen/include/xlat.lst
--- a/xen/include/xlat.lst      Tue Dec 13 09:47:13 2011 +0100
+++ b/xen/include/xlat.lst      Tue Dec 13 09:48:51 2011 +0100
@@ -72,6 +72,17 @@
 ?      physdev_restore_msi             physdev.h
 ?      physdev_set_iopl                physdev.h
 ?      physdev_setup_gsi               physdev.h
+!      pct_register                    platform.h
+!      power_register                  platform.h
+?      processor_csd                   platform.h
+!      processor_cx                    platform.h
+!      processor_flags                 platform.h
+!      processor_performance           platform.h
+!      processor_power                 platform.h
+?      processor_px                    platform.h
+!      psd_package                     platform.h
+?      xenpf_pcpuinfo                  platform.h
+?      xenpf_pcpu_version              platform.h
 !      sched_poll                      sched.h
 ?      sched_remote_shutdown           sched.h
 ?      sched_shutdown                  sched.h
@@ -84,12 +95,3 @@
 !      vcpu_set_singleshot_timer       vcpu.h
 ?      xenoprof_init                   xenoprof.h
 ?      xenoprof_passive                xenoprof.h
-!      power_register                  platform.h
-?      processor_csd                   platform.h
-!      processor_cx                    platform.h
-!      processor_flags                 platform.h
-!      processor_power                 platform.h
-!      pct_register                    platform.h
-?      processor_px                    platform.h
-!      psd_package                     platform.h
-!      processor_performance           platform.h

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.