summaryrefslogtreecommitdiffstats
path: root/sys/amd64/amd64/mp_machdep.c
diff options
context:
space:
mode:
authorgibbs <gibbs@FreeBSD.org>2013-09-20 22:59:22 +0000
committergibbs <gibbs@FreeBSD.org>2013-09-20 22:59:22 +0000
commit7ed30adae7eb0c6e156983ca0c96c04e1e6a8e0d (patch)
tree301b6e7f4ff8cd017faecbcf64de6922be093a7e /sys/amd64/amd64/mp_machdep.c
parentec391855a94cc7ab44ba6ba5b3d8d27a5a1c224d (diff)
downloadFreeBSD-src-7ed30adae7eb0c6e156983ca0c96c04e1e6a8e0d.zip
FreeBSD-src-7ed30adae7eb0c6e156983ca0c96c04e1e6a8e0d.tar.gz
Merge Xen PVHVM support into the GENERIC kernel config for both
amd64 and i386. Submitted by: Roger Pau Monné Sponsored by: Citrix Systems R&D Reviewed by: gibbs Approved by: re (blanket Xen) MFC after: 2 weeks sys/amd64/amd64/mp_machdep.c: sys/amd64/include/cpu.h: sys/i386/i386/mp_machdep.c: sys/i386/include/cpu.h: - Introduce two new CPU hooks for initialization and resume purposes. This allows us to get rid of the XENHVM ifdefs in mp_machdep, and also sets some hooks into common code that can be used by other hypervisor implementations. sys/amd64/conf/XENHVM: sys/i386/conf/XENHVM: - Remove these configs now that GENERIC has builtin support for Xen HVM. sys/kern/subr_smp.c: - Make sure there are no pending IPIs when suspending a system. sys/x86/xen/hvm.c: - Add cpu init and resume vectors that are called from mp_machdep using the new hooks. - Only clear the vcpu_info mapping data on resume. It is already clear for the BSP on a cold boot and is set correctly as APs are started. - Gate xen_hvm_init_cpu only to systems running under Xen. sys/x86/xen/xen_intr.c: - Gate the setup of event channels only to systems running under Xen.
Diffstat (limited to 'sys/amd64/amd64/mp_machdep.c')
-rw-r--r--sys/amd64/amd64/mp_machdep.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index 1f02211..4ef4b3d 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -71,10 +71,6 @@ __FBSDID("$FreeBSD$");
#include <machine/tss.h>
#include <machine/cpu.h>
-#ifdef XENHVM
-#include <xen/hvm.h>
-#endif
-
#define WARMBOOT_TARGET 0
#define WARMBOOT_OFF (KERNBASE + 0x0467)
#define WARMBOOT_SEG (KERNBASE + 0x0469)
@@ -161,7 +157,7 @@ int cpu_apic_ids[MAXCPU];
int apic_cpuids[MAX_APIC_ID + 1];
/* Holds pending bitmap based IPIs per CPU */
-static volatile u_int cpu_ipi_pending[MAXCPU];
+volatile u_int cpu_ipi_pending[MAXCPU];
static u_int boot_address;
static int cpu_logical; /* logical cpus per core */
@@ -732,10 +728,8 @@ init_secondary(void)
/* set up FPU state on the AP */
fpuinit();
-#ifdef XENHVM
- /* register vcpu_info area */
- xen_hvm_init_cpu();
-#endif
+ if (cpu_ops.cpu_init)
+ cpu_ops.cpu_init();
/* A quick check from sanity claus */
cpuid = PCPU_GET(cpuid);
@@ -1466,12 +1460,9 @@ cpususpend_handler(void)
{
u_int cpu;
- cpu = PCPU_GET(cpuid);
-
-#ifdef XENHVM
mtx_assert(&smp_ipi_mtx, MA_NOTOWNED);
-#endif
+ cpu = PCPU_GET(cpuid);
if (savectx(susppcbs[cpu])) {
ctx_fpusave(susppcbs[cpu]->pcb_fpususpend);
wbinvd();
@@ -1490,15 +1481,8 @@ cpususpend_handler(void)
while (!CPU_ISSET(cpu, &started_cpus))
ia32_pause();
-#ifdef XENHVM
- /*
- * Reset pending bitmap IPIs, because Xen doesn't preserve pending
- * event channels on migration.
- */
- cpu_ipi_pending[cpu] = 0;
- /* register vcpu_info area */
- xen_hvm_init_cpu();
-#endif
+ if (cpu_ops.cpu_resume)
+ cpu_ops.cpu_resume();
/* Resume MCA and local APIC */
mca_resume();
OpenPOWER on IntegriCloud