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-changelog

[Xen-changelog] [linux-2.6.18-xen] x86 xen: New vcpu_op call to get phys

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] x86 xen: New vcpu_op call to get physical CPU identity.
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 05 Mar 2008 12:30:07 -0800
Delivery-date: Wed, 05 Mar 2008 12:30:04 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1204715381 0
# Node ID 26e1e96bd46a53991e216271d077aa6fb20ea218
# Parent  1cf7ba68d855aa86b1c54c34c03fc62571eb5c94
x86 xen: New vcpu_op call to get physical CPU identity.

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 vcpu op to Xen to allow dom0 to query the hypervisor for
architecture dependent physical cpu information if dom0 vcpus are
pinned.

Signed-off-by: Mark Langsdorf <mark.langsdorf@xxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 drivers/xen/core/smpboot.c   |   34 +++++++++++++++++++++++++++-------
 include/xen/interface/vcpu.h |   18 +++++++++++++++++-
 2 files changed, 44 insertions(+), 8 deletions(-)

diff -r 1cf7ba68d855 -r 26e1e96bd46a drivers/xen/core/smpboot.c
--- a/drivers/xen/core/smpboot.c        Mon Mar 03 13:36:57 2008 +0000
+++ b/drivers/xen/core/smpboot.c        Wed Mar 05 11:09:41 2008 +0000
@@ -258,17 +258,28 @@ void __init smp_prepare_cpus(unsigned in
 {
        unsigned int cpu;
        struct task_struct *idle;
+       int apicid, acpiid;
+       struct vcpu_get_physid cpu_id;
 #ifdef __x86_64__
        struct desc_ptr *gdt_descr;
 #else
        struct Xgt_desc_struct *gdt_descr;
 #endif
 
-       boot_cpu_data.apicid = 0;
+       apicid = 0;
+       if (HYPERVISOR_vcpu_op(VCPUOP_get_physid, 0, &cpu_id) == 0) {
+               apicid = xen_vcpu_physid_to_x86_apicid(cpu_id.phys_id);
+               acpiid = xen_vcpu_physid_to_x86_acpiid(cpu_id.phys_id);
+#ifdef CONFIG_ACPI
+               if (acpiid != 0xff)
+                       x86_acpiid_to_apicid[acpiid] = apicid;
+#endif
+       }
+       boot_cpu_data.apicid = apicid;
        cpu_data[0] = boot_cpu_data;
 
-       cpu_2_logical_apicid[0] = 0;
-       x86_cpu_to_apicid[0] = 0;
+       cpu_2_logical_apicid[0] = apicid;
+       x86_cpu_to_apicid[0] = apicid;
 
        current_thread_info()->cpu = 0;
 
@@ -312,11 +323,20 @@ void __init smp_prepare_cpus(unsigned in
                        (void *)gdt_descr->address,
                        XENFEAT_writable_descriptor_tables);
 
+               apicid = cpu;
+               if (HYPERVISOR_vcpu_op(VCPUOP_get_physid, cpu, &cpu_id) == 0) {
+                       apicid = xen_vcpu_physid_to_x86_apicid(cpu_id.phys_id);
+                       acpiid = xen_vcpu_physid_to_x86_acpiid(cpu_id.phys_id);
+#ifdef CONFIG_ACPI
+                       if (acpiid != 0xff)
+                               x86_acpiid_to_apicid[acpiid] = apicid;
+#endif
+               }
                cpu_data[cpu] = boot_cpu_data;
-               cpu_data[cpu].apicid = cpu;
-
-               cpu_2_logical_apicid[cpu] = cpu;
-               x86_cpu_to_apicid[cpu] = cpu;
+               cpu_data[cpu].apicid = apicid;
+
+               cpu_2_logical_apicid[cpu] = apicid;
+               x86_cpu_to_apicid[cpu] = apicid;
 
                idle = fork_idle(cpu);
                if (IS_ERR(idle))
diff -r 1cf7ba68d855 -r 26e1e96bd46a include/xen/interface/vcpu.h
--- a/include/xen/interface/vcpu.h      Mon Mar 03 13:36:57 2008 +0000
+++ b/include/xen/interface/vcpu.h      Wed Mar 05 11:09:41 2008 +0000
@@ -170,7 +170,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_set_singles
  *
  * This may be called only once per vcpu.
  */
-#define VCPUOP_register_vcpu_info   10  /* arg == struct vcpu_info */
+#define VCPUOP_register_vcpu_info   10  /* arg == vcpu_register_vcpu_info_t */
 struct vcpu_register_vcpu_info {
     uint64_t mfn;    /* mfn of page to place vcpu_info */
     uint32_t offset; /* offset within page */
@@ -181,6 +181,22 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_register_vc
 
 /* Send an NMI to the specified VCPU. @extra_arg == NULL. */
 #define VCPUOP_send_nmi             11
+
+/* 
+ * Get the physical ID information for a pinned vcpu's underlying physical
+ * processor.  The physical ID informmation is architecture-specific.
+ * On x86: id[7:0]=apic_id, id[15:8]=acpi_id, id[63:16]=mbz,
+ *         and an unavailable identifier is returned as 0xff.
+ * This command returns -EINVAL if it is not a valid operation for this VCPU.
+ */
+#define VCPUOP_get_physid           12 /* arg == vcpu_get_physid_t */
+struct vcpu_get_physid {
+    uint64_t phys_id;
+};
+typedef struct vcpu_get_physid vcpu_get_physid_t;
+DEFINE_XEN_GUEST_HANDLE(vcpu_get_physid_t);
+#define xen_vcpu_physid_to_x86_apicid(physid) ((uint8_t)((physid)>>0))
+#define xen_vcpu_physid_to_x86_acpiid(physid) ((uint8_t)((physid)>>8))
 
 #endif /* __XEN_PUBLIC_VCPU_H__ */
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] x86 xen: New vcpu_op call to get physical CPU identity., Xen patchbot-linux-2.6.18-xen <=