summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorgibbs <gibbs@FreeBSD.org>2013-10-05 23:11:01 +0000
committergibbs <gibbs@FreeBSD.org>2013-10-05 23:11:01 +0000
commit9c8c76f921175f7cebcd3cd61d9086c333b96e35 (patch)
treec4b59481817d15ea30e15e04f5ceb28ea7ae41a1 /sys/i386
parentaed205d5cd3901acd2a0cf583e44ec166d99191a (diff)
downloadFreeBSD-src-9c8c76f921175f7cebcd3cd61d9086c333b96e35.zip
FreeBSD-src-9c8c76f921175f7cebcd3cd61d9086c333b96e35.tar.gz
Formalize the concept of virtual CPU ids by adding a per-cpu vcpu_id
field. Perform vcpu enumeration for Xen PV and HVM environments and convert all Xen drivers to use vcpu_id instead of a hard coded assumption of the mapping algorithm (acpi or apic ID) in use. Submitted by: Roger Pau Monné Sponsored by: Citrix Systems R&D Reviewed by: gibbs Approved by: re (blanket Xen) amd64/include/pcpu.h: i386/include/pcpu.h: Add vcpu_id to the amd64 and i386 pcpu structures. dev/xen/timer/timer.c x86/xen/xen_intr.c Use new vcpu_id instead of assuming acpi_id == vcpu_id. i386/xen/mp_machdep.c: i386/xen/mptable.c x86/xen/hvm.c: Perform Xen HVM and Xen full PV vcpu_id mapping. x86/xen/hvm.c: x86/acpica/madt.c Change SYSINIT ordering of acpi CPU enumeration so that it is guaranteed to be available at the time of Xen HVM vcpu id mapping.
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/include/pcpu.h7
-rw-r--r--sys/i386/xen/mp_machdep.c8
-rw-r--r--sys/i386/xen/mptable.c2
3 files changed, 6 insertions, 11 deletions
diff --git a/sys/i386/include/pcpu.h b/sys/i386/include/pcpu.h
index 60e50f8..dc29b6d 100644
--- a/sys/i386/include/pcpu.h
+++ b/sys/i386/include/pcpu.h
@@ -62,13 +62,13 @@ struct shadow_time_info {
vm_paddr_t *pc_pdir_shadow; \
uint64_t pc_processed_system_time; \
struct shadow_time_info pc_shadow_time; \
- char __pad[189]
+ char __pad[185]
#else /* !XEN */
#define PCPU_XEN_FIELDS \
; \
- char __pad[237]
+ char __pad[233]
#endif
@@ -84,7 +84,8 @@ struct shadow_time_info {
u_int pc_acpi_id; /* ACPI CPU id */ \
u_int pc_apic_id; \
int pc_private_tss; /* Flag indicating private tss*/\
- u_int pc_cmci_mask /* MCx banks for CMCI */ \
+ u_int pc_cmci_mask; /* MCx banks for CMCI */ \
+ u_int pc_vcpu_id /* Xen vCPU ID */ \
PCPU_XEN_FIELDS
#ifdef _KERNEL
diff --git a/sys/i386/xen/mp_machdep.c b/sys/i386/xen/mp_machdep.c
index ae5b5d4..c48fcb2 100644
--- a/sys/i386/xen/mp_machdep.c
+++ b/sys/i386/xen/mp_machdep.c
@@ -783,13 +783,7 @@ start_all_aps(void)
dpcpu_init((void *)kmem_malloc(kernel_arena, DPCPU_SIZE,
M_WAITOK | M_ZERO), bootAP);
pc->pc_apic_id = cpu_apic_ids[bootAP];
- /*
- * The i386 PV port uses the apic_id as vCPU id, but the
- * PVHVM port needs to use the acpi_id, so set it for PV
- * also in order to work with shared devices between PV
- * and PVHVM.
- */
- pc->pc_acpi_id = cpu_apic_ids[bootAP];
+ pc->pc_vcpu_id = cpu_apic_ids[bootAP];
pc->pc_prvspace = pc;
pc->pc_curthread = 0;
diff --git a/sys/i386/xen/mptable.c b/sys/i386/xen/mptable.c
index 29d3b33..6682a8f 100644
--- a/sys/i386/xen/mptable.c
+++ b/sys/i386/xen/mptable.c
@@ -88,7 +88,7 @@ mptable_setup_local(void)
{
PCPU_SET(apic_id, 0);
- PCPU_SET(acpi_id, 0);
+ PCPU_SET(vcpu_id, 0);
return (0);
}
OpenPOWER on IntegriCloud