{
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;
(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_data[cpu].apicid = apicid;
- cpu_2_logical_apicid[cpu] = cpu;
- x86_cpu_to_apicid[cpu] = cpu;
+ cpu_2_logical_apicid[cpu] = apicid;
+ x86_cpu_to_apicid[cpu] = apicid;
idle = fork_idle(cpu);
if (IS_ERR(idle))
*
* 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 */
/* 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__ */
/*