From owner-svn-src-projects@FreeBSD.ORG Thu Oct 16 22:45:07 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C8BB1065687; Thu, 16 Oct 2008 22:45:07 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 899EE8FC14; Thu, 16 Oct 2008 22:45:07 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GMj7uW072210; Thu, 16 Oct 2008 22:45:07 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GMj7cw072203; Thu, 16 Oct 2008 22:45:07 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200810162245.m9GMj7cw072203@svn.freebsd.org> From: Kip Macy Date: Thu, 16 Oct 2008 22:45:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183962 - in projects/releng_6_xen/sys/i386: conf i386 include/xen isa pci xen X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 22:45:07 -0000 Author: kmacy Date: Thu Oct 16 22:45:07 2008 New Revision: 183962 URL: http://svn.freebsd.org/changeset/base/183962 Log: - Fix floating point handling for xen - Enable SMP Modified: projects/releng_6_xen/sys/i386/conf/XEN projects/releng_6_xen/sys/i386/i386/machdep.c projects/releng_6_xen/sys/i386/include/xen/xen-os.h projects/releng_6_xen/sys/i386/isa/npx.c projects/releng_6_xen/sys/i386/pci/pci_cfgreg.c projects/releng_6_xen/sys/i386/pci/pci_pir.c projects/releng_6_xen/sys/i386/xen/pmap.c Modified: projects/releng_6_xen/sys/i386/conf/XEN ============================================================================== --- projects/releng_6_xen/sys/i386/conf/XEN Thu Oct 16 20:56:09 2008 (r183961) +++ projects/releng_6_xen/sys/i386/conf/XEN Thu Oct 16 22:45:07 2008 (r183962) @@ -67,8 +67,8 @@ options INVARIANT_SUPPORT # Extra sanit #options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed # To make an SMP kernel, the next two lines are needed -#options SMP # Symmetric MultiProcessor Kernel -#device apic # I/O APIC +options SMP # Symmetric MultiProcessor Kernel +device apic # I/O APIC options PAE @@ -104,6 +104,8 @@ device splash # Splash screen and scre # Add suspend/resume support for the i8254. #device pmtimer # native +device pci + # Serial (COM) ports device uart # Generic UART driver Modified: projects/releng_6_xen/sys/i386/i386/machdep.c ============================================================================== --- projects/releng_6_xen/sys/i386/i386/machdep.c Thu Oct 16 20:56:09 2008 (r183961) +++ projects/releng_6_xen/sys/i386/i386/machdep.c Thu Oct 16 22:45:07 2008 (r183962) @@ -152,7 +152,6 @@ uint32_t arch_i386_xbox_memsize = 0; void Xhypervisor_callback(void); void failsafe_callback(void); -int gdtset; extern trap_info_t trap_table[]; struct proc_ldt default_proc_ldt; extern int init_first; @@ -1195,7 +1194,7 @@ void cpu_idle(void) { -#ifdef SMP +#if defined(SMP) && !defined(XEN) if (mp_grab_cpu_hlt()) return; #endif Modified: projects/releng_6_xen/sys/i386/include/xen/xen-os.h ============================================================================== --- projects/releng_6_xen/sys/i386/include/xen/xen-os.h Thu Oct 16 20:56:09 2008 (r183961) +++ projects/releng_6_xen/sys/i386/include/xen/xen-os.h Thu Oct 16 22:45:07 2008 (r183962) @@ -37,7 +37,7 @@ extern int gdtset; static inline int smp_processor_id(void) { - if (likely(gdtset)) + if (__predict_true(gdtset)) return PCPU_GET(cpuid); return 0; } Modified: projects/releng_6_xen/sys/i386/isa/npx.c ============================================================================== --- projects/releng_6_xen/sys/i386/isa/npx.c Thu Oct 16 20:56:09 2008 (r183961) +++ projects/releng_6_xen/sys/i386/isa/npx.c Thu Oct 16 22:45:07 2008 (r183962) @@ -69,6 +69,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef XEN +#include +#endif #ifdef DEV_ISA #include #endif @@ -101,10 +104,15 @@ __FBSDID("$FreeBSD$"); #define fxsave(addr) __asm __volatile("fxsave %0" : "=m" (*(addr))) #define ldmxcsr(__csr) __asm __volatile("ldmxcsr %0" : : "m" (__csr)) #endif +#ifdef XEN +#define start_emulating() (HYPERVISOR_fpu_taskswitch(1)) +#define stop_emulating() (HYPERVISOR_fpu_taskswitch(0)) +#else #define start_emulating() __asm("smsw %%ax; orb %0,%%al; lmsw %%ax" \ : : "n" (CR0_TS) : "ax") #define stop_emulating() __asm("clts") +#endif #else /* !(__GNUCLIKE_ASM && !lint) */ void fldcw(caddr_t addr); Modified: projects/releng_6_xen/sys/i386/pci/pci_cfgreg.c ============================================================================== --- projects/releng_6_xen/sys/i386/pci/pci_cfgreg.c Thu Oct 16 20:56:09 2008 (r183961) +++ projects/releng_6_xen/sys/i386/pci/pci_cfgreg.c Thu Oct 16 22:45:07 2008 (r183962) @@ -82,9 +82,10 @@ static struct mtx pcicfg_mtx; static int pcireg_cfgread(int bus, int slot, int func, int reg, int bytes); static void pcireg_cfgwrite(int bus, int slot, int func, int reg, int data, int bytes); +#ifndef XEN static int pcireg_cfgopen(void); - static int pciereg_cfgopen(void); +#endif static int pciereg_cfgread(int bus, int slot, int func, int reg, int bytes); static void pciereg_cfgwrite(int bus, int slot, int func, int reg, @@ -105,6 +106,7 @@ pci_i386_map_intline(int line) return (line); } +#ifndef XEN static u_int16_t pcibios_get_version(void) { @@ -125,6 +127,7 @@ pcibios_get_version(void) } return (args.ebx & 0xffff); } +#endif /* * Initialise access to PCI configuration space @@ -132,6 +135,9 @@ pcibios_get_version(void) int pci_cfgregopen(void) { +#ifdef XEN + return (0); +#else static int opened = 0; u_int16_t vid, did; u_int16_t v; @@ -171,6 +177,7 @@ pci_cfgregopen(void) } return(1); +#endif /* !XEN */ } /* @@ -349,6 +356,7 @@ pcireg_cfgwrite(int bus, int slot, int f mtx_unlock_spin(&pcicfg_mtx); } +#ifndef XEN /* check whether the configuration mechanism has been correctly identified */ static int pci_cfgcheck(int maxdev) @@ -526,6 +534,7 @@ pciereg_cfgopen(void) devmax = 32; return (1); } +#endif /* !XEN */ #define PCIE_PADDR(bar, reg, bus, slot, func) \ ((bar) | \ Modified: projects/releng_6_xen/sys/i386/pci/pci_pir.c ============================================================================== --- projects/releng_6_xen/sys/i386/pci/pci_pir.c Thu Oct 16 20:56:09 2008 (r183961) +++ projects/releng_6_xen/sys/i386/pci/pci_pir.c Thu Oct 16 22:45:07 2008 (r183962) @@ -137,6 +137,10 @@ pci_pir_open(void) int i; uint8_t ck, *cv; +#ifdef XEN + return; +#else + /* Don't try if we've already found a table. */ if (pci_route_table != NULL) return; @@ -147,7 +151,7 @@ pci_pir_open(void) sigaddr = bios_sigsearch(0, "_PIR", 4, 16, 0); if (sigaddr == 0) return; - +#endif /* If we found something, check the checksum and length. */ /* XXX - Use pmap_mapdev()? */ pt = (struct PIR_table *)(uintptr_t)BIOS_PADDRTOVADDR(sigaddr); @@ -478,7 +482,11 @@ pci_pir_biosroute(int bus, int device, i args.eax = PCIBIOS_ROUTE_INTERRUPT; args.ebx = (bus << 8) | (device << 3) | func; args.ecx = (irq << 8) | (0xa + pin); +#ifdef XEN + return (0); +#else return (bios32(&args, PCIbios.ventry, GSEL(GCODE_SEL, SEL_KPL))); +#endif } Modified: projects/releng_6_xen/sys/i386/xen/pmap.c ============================================================================== --- projects/releng_6_xen/sys/i386/xen/pmap.c Thu Oct 16 20:56:09 2008 (r183961) +++ projects/releng_6_xen/sys/i386/xen/pmap.c Thu Oct 16 22:45:07 2008 (r183962) @@ -1424,7 +1424,6 @@ pmap_pinit(struct pmap *pmap) LIST_INSERT_HEAD(&allpmaps, pmap, pm_list); mtx_unlock_spin(&allpmaps_lock); /* Wire in kernel global address entries. */ - /* XXX copies current process, does not fill in MPPTDI */ bcopy(PTD + KPTDI, pmap->pm_pdir + KPTDI, nkpt * sizeof(pd_entry_t)); #ifdef PAE @@ -1442,11 +1441,6 @@ pmap_pinit(struct pmap *pmap) } #endif -#ifdef SMP - pmap->pm_pdir[MPPTDI] = PTD[MPPTDI]; -#endif - - #ifdef XEN for (i = 0; i < NPGPTD; i++) { pt_entry_t *pd; @@ -1742,9 +1736,6 @@ pmap_release(pmap_t pmap) bzero(pmap->pm_pdir + PTDPTDI, (nkpt + NPGPTD) * sizeof(*pmap->pm_pdir)); -#ifdef SMP - pmap->pm_pdir[MPPTDI] = 0; -#endif pmap_qremove((vm_offset_t)pmap->pm_pdir, NPGPTD); #if defined(PAE) && defined(XEN)