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

[Xen-devel] [PATCH][retry 2][1/2] new platform hypervisor call to get APICIDs



Some AMD machines have APIC IDs that not equal to CPU IDs.  In
the default Xen configuration, ACPI calls on these machines
can get confused.  This shows up most noticeably when running
AMD PowerNow!.  The only solution is for dom0 to get the
hypervisor's cpuid to apicid table when needed (ie, when dom0
vcpus are pinned).

Add a new platform hypercall to Xen to allow dom0 to query the
hypervisor for the actual cpuid to apicid table.  

The second patch adds the dom0 call to this platform hypercall.

I have tested this on my 4p/16 core machine and it works.  I
would appreciate testing on other boxes.

-Mark Langsdorf
Operating System Research Center
AMD

Signed-off-by: Mark Langsdorf <mark.langsdorf@xxxxxxx>

diff -r 7530c4dba8a5 xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c Mon Mar 03 15:19:39 2008 +0000
+++ b/xen/arch/x86/platform_hypercall.c Mon Mar 03 14:36:53 2008 -0600
@@ -340,6 +340,24 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
     }
     break;
 
+    case XENPF_getapicids:
+    {
+        XEN_GUEST_HANDLE(uint8) apicids;
+        uint32_t i, nr_cpus;
+
+        nr_cpus = op->u.getapicids.nr_cpus;
+        guest_from_compat_handle(apicids, op->u.getapicids.apicids);
+ 
+        for (i = 0; i < nr_cpus; i++) 
+        {
+             ret = -EFAULT;
+             if ( copy_to_guest_offset(apicids, i, &x86_cpu_to_apicid[i], 1) )
+                 goto out;
+        }
+        ret = copy_to_guest(u_xenpf_op, op, 1) ? -EFAULT : 0;
+    }
+    break;
+
     default:
         ret = -ENOSYS;
         break;
diff -r 7530c4dba8a5 xen/include/public/platform.h
--- a/xen/include/public/platform.h     Mon Mar 03 15:19:39 2008 +0000
+++ b/xen/include/public/platform.h     Mon Mar 03 14:36:53 2008 -0600
@@ -198,6 +198,16 @@ struct xenpf_getidletime {
 };
 typedef struct xenpf_getidletime xenpf_getidletime_t;
 DEFINE_XEN_GUEST_HANDLE(xenpf_getidletime_t);
+
+#define XENPF_getapicids       54
+struct xenpf_getapicids {
+    /* IN variables */
+    /* size of apicid table */
+    uint32_t nr_cpus;
+    /* OUT variables */
+    /* Table of cpu to apicids */
+    XEN_GUEST_HANDLE(uint8) apicids;
+};
 
 struct xen_platform_op {
     uint32_t cmd;
@@ -213,6 +223,7 @@ struct xen_platform_op {
         struct xenpf_enter_acpi_sleep  enter_acpi_sleep;
         struct xenpf_change_freq       change_freq;
         struct xenpf_getidletime       getidletime;
+       struct xenpf_getapicids        getapicids;
         uint8_t                        pad[128];
     } u;
 };


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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