svn commit: r184035 - in projects/release_6_3_xen/sys/i386: i386 xen

Kip Macy kmacy at FreeBSD.org
Sat Oct 18 22:47:45 UTC 2008


Author: kmacy
Date: Sat Oct 18 22:47:44 2008
New Revision: 184035
URL: http://svn.freebsd.org/changeset/base/184035

Log:
  Use post 6.3 pcpu implementation, it simplifies the code and doesn't involve working around
  the default placement of privatespace in the hypervisor's address space

Modified:
  projects/release_6_3_xen/sys/i386/i386/machdep.c
  projects/release_6_3_xen/sys/i386/xen/mp_machdep.c
  projects/release_6_3_xen/sys/i386/xen/xen_machdep.c

Modified: projects/release_6_3_xen/sys/i386/i386/machdep.c
==============================================================================
--- projects/release_6_3_xen/sys/i386/i386/machdep.c	Sat Oct 18 22:22:25 2008	(r184034)
+++ projects/release_6_3_xen/sys/i386/i386/machdep.c	Sat Oct 18 22:47:44 2008	(r184035)
@@ -126,7 +126,9 @@ __FBSDID("$FreeBSD$");
 #include <machine/perfmon.h>
 #endif
 #ifdef SMP
+#ifndef XEN
 #include <machine/privatespace.h>
+#endif
 #include <machine/smp.h>
 #endif
 
@@ -223,9 +225,12 @@ vm_paddr_t dump_avail[PHYSMAP_SIZE + 2];
 struct kva_md_info kmi;
 
 static struct trapframe proc0_tf;
-#ifndef SMP
+#if !defined(SMP) && !defined(XEN)
 static struct pcpu __pcpu;
 #endif
+#ifdef XEN
+struct pcpu __pcpu[MAXCPU];
+#endif
 
 struct mtx icu_lock;
 
@@ -2205,11 +2210,7 @@ init386(int first)
 	gdt_segs[GUDATA_SEL].ssd_limit = atop(HYPERVISOR_VIRT_START + MTOPSIZE);
 	gdt_segs[GBIOSLOWMEM_SEL].ssd_limit = atop(HYPERVISOR_VIRT_START + MTOPSIZE);
 
-#ifdef SMP
-	pc = &SMP_prvspace[0].pcpu;
-#else
-	pc = &__pcpu;
-#endif
+	pc = &__pcpu[0];
 	gdt_segs[GPRIV_SEL].ssd_base = (int) pc;
 	gdt_segs[GPROC0_SEL].ssd_base = (int) &pc->pc_common_tss;
 

Modified: projects/release_6_3_xen/sys/i386/xen/mp_machdep.c
==============================================================================
--- projects/release_6_3_xen/sys/i386/xen/mp_machdep.c	Sat Oct 18 22:22:25 2008	(r184034)
+++ projects/release_6_3_xen/sys/i386/xen/mp_machdep.c	Sat Oct 18 22:47:44 2008	(r184035)
@@ -81,7 +81,6 @@ __FBSDID("$FreeBSD$");
 #include <machine/smp.h>
 #include <machine/smptests.h>	/** COUNT_XINVLTLB_HITS */
 #include <machine/specialreg.h>
-#include <machine/privatespace.h>
 
 #include <machine/xen/hypervisor.h>
 #include <machine/xen/evtchn.h>
@@ -623,7 +622,7 @@ start_all_aps(void)
 		bootAPgdt = gdt + (512*cpu);
 
 		/* Get per-cpu data */
-		pc = &SMP_prvspace[bootAP].pcpu;
+		pc = &__pcpu[bootAP];
 		pcpu_init(pc, bootAP, sizeof(struct pcpu));
 		pc->pc_apic_id = cpu_apic_ids[bootAP];
 		pc->pc_prvspace = pc;

Modified: projects/release_6_3_xen/sys/i386/xen/xen_machdep.c
==============================================================================
--- projects/release_6_3_xen/sys/i386/xen/xen_machdep.c	Sat Oct 18 22:22:25 2008	(r184034)
+++ projects/release_6_3_xen/sys/i386/xen/xen_machdep.c	Sat Oct 18 22:47:44 2008	(r184035)
@@ -65,10 +65,6 @@ __FBSDID("$FreeBSD$");
 #include <machine/xen/xenfunc.h>
 #include <xen/interface/memory.h>
 #include <machine/xen/features.h>
-#ifdef SMP
-#include <machine/privatespace.h>
-#endif
-
 
 #include <vm/vm_page.h>
 
@@ -834,7 +830,7 @@ initvalues(start_info_t *startinfo)
 	vm_paddr_t pdir_shadow_ma;
 #endif
 	unsigned long i;
-	int ncpus;
+	int ncpus = MAXCPU;
 
 	nkpt = min(
 		min(
@@ -842,12 +838,6 @@ initvalues(start_info_t *startinfo)
 		    NPGPTD*NPDEPG - KPTDI),
 		    (HYPERVISOR_VIRT_START - KERNBASE) >> PDRSHIFT);
 	
-#ifdef SMP
-	ncpus = MAXCPU;
-#else
-	ncpus = 1;
-#endif	
-
 	HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);	
 #ifdef notyet
 	/*
@@ -873,7 +863,7 @@ initvalues(start_info_t *startinfo)
 	cur_space += (4 * PAGE_SIZE);
 	bootmem_end = (char *)cur_space;
 	
-	/* allocate page for gdt */
+	/* allocate pages for gdt */
 	gdt = (union descriptor *)cur_space;
 	cur_space += PAGE_SIZE*ncpus;
 
@@ -988,8 +978,6 @@ initvalues(start_info_t *startinfo)
 	
 	PT_UPDATES_FLUSH();
 
-		
-
 	memcpy(((uint8_t *)IdlePTDnew) + ((unsigned int)(KERNBASE >> 18)),
 	    ((uint8_t *)IdlePTD) + ((KERNBASE >> 18) & PAGE_MASK),
 	    l1_pages*sizeof(pt_entry_t));


More information about the svn-src-projects mailing list