WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: xen-devel@xxxxxxxxxxxxxxxxxxx, Chris Lalancette <clalance@xxxxxxxxxx>
Subject: [Xen-devel] [PATCH][retry 2][1/2] new platform hypervisor call to get APICIDs
From: Mark Langsdorf <mark.langsdorf@xxxxxxx>
Date: Mon, 3 Mar 2008 15:40:26 -0600
Delivery-date: Mon, 03 Mar 2008 13:37:01 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.6 (enterprise 20070904.708012)
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

<Prev in Thread] Current Thread [Next in Thread>