From owner-svn-src-all@FreeBSD.ORG Tue Jan 4 14:49:54 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC58D106564A; Tue, 4 Jan 2011 14:49:54 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D957B8FC13; Tue, 4 Jan 2011 14:49:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p04Ensrx039324; Tue, 4 Jan 2011 14:49:54 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p04EnsLS039312; Tue, 4 Jan 2011 14:49:54 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201101041449.p04EnsLS039312@svn.freebsd.org> From: Robert Watson Date: Tue, 4 Jan 2011 14:49:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216956 - in head/sys: conf dev/xen/balloon dev/xen/blkfront dev/xen/netfront dev/xen/xenpci i386/include i386/include/xen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jan 2011 14:49:55 -0000 Author: rwatson Date: Tue Jan 4 14:49:54 2011 New Revision: 216956 URL: http://svn.freebsd.org/changeset/base/216956 Log: Make "options XENHVM" compile for i386, not just amd64 -- a largely mechanical change. This opens the door for using PV device drivers under Xen HVM on i386, as well as more general harmonisation of i386 and amd64 Xen support in FreeBSD. Reviewed by: cperciva MFC after: 3 weeks Modified: head/sys/conf/options.i386 head/sys/dev/xen/balloon/balloon.c head/sys/dev/xen/blkfront/blkfront.c head/sys/dev/xen/netfront/netfront.c head/sys/dev/xen/xenpci/evtchn.c head/sys/i386/include/pcpu.h head/sys/i386/include/pmap.h head/sys/i386/include/xen/hypercall.h head/sys/i386/include/xen/xen-os.h head/sys/i386/include/xen/xenpmap.h head/sys/i386/include/xen/xenvar.h Modified: head/sys/conf/options.i386 ============================================================================== --- head/sys/conf/options.i386 Tue Jan 4 14:13:09 2011 (r216955) +++ head/sys/conf/options.i386 Tue Jan 4 14:49:54 2011 (r216956) @@ -118,3 +118,4 @@ BPF_JITTER opt_bpf.h NATIVE opt_global.h XEN opt_global.h +XENHVM opt_global.h Modified: head/sys/dev/xen/balloon/balloon.c ============================================================================== --- head/sys/dev/xen/balloon/balloon.c Tue Jan 4 14:13:09 2011 (r216955) +++ head/sys/dev/xen/balloon/balloon.c Tue Jan 4 14:49:54 2011 (r216956) @@ -41,8 +41,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include #include Modified: head/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- head/sys/dev/xen/blkfront/blkfront.c Tue Jan 4 14:13:09 2011 (r216955) +++ head/sys/dev/xen/blkfront/blkfront.c Tue Jan 4 14:49:54 2011 (r216956) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Modified: head/sys/dev/xen/netfront/netfront.c ============================================================================== --- head/sys/dev/xen/netfront/netfront.c Tue Jan 4 14:13:09 2011 (r216955) +++ head/sys/dev/xen/netfront/netfront.c Tue Jan 4 14:49:54 2011 (r216956) @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/dev/xen/xenpci/evtchn.c ============================================================================== --- head/sys/dev/xen/xenpci/evtchn.c Tue Jan 4 14:13:09 2011 (r216955) +++ head/sys/dev/xen/xenpci/evtchn.c Tue Jan 4 14:49:54 2011 (r216956) @@ -51,13 +51,19 @@ __FBSDID("$FreeBSD$"); #include +#if defined(__i386__) +#define __ffs(word) ffs(word) +#elif defined(__amd64__) static inline unsigned long __ffs(unsigned long word) { __asm__("bsfq %1,%0" :"=r" (word) - :"rm" (word)); + :"rm" (word)); /* XXXRW: why no "cc"? */ return word; } +#else +#error "evtchn: unsupported architecture" +#endif #define is_valid_evtchn(x) ((x) != 0) #define evtchn_from_irq(x) (irq_evtchn[irq].evtchn) Modified: head/sys/i386/include/pcpu.h ============================================================================== --- head/sys/i386/include/pcpu.h Tue Jan 4 14:13:09 2011 (r216955) +++ head/sys/i386/include/pcpu.h Tue Jan 4 14:49:54 2011 (r216956) @@ -44,13 +44,16 @@ * other processors" */ -#ifdef XEN +#if defined(XEN) || defined(XENHVM) #ifndef NR_VIRQS #define NR_VIRQS 24 #endif #ifndef NR_IPIS #define NR_IPIS 2 #endif +#endif + +#if defined(XEN) /* These are peridically updated in shared_info, and then copied here. */ struct shadow_time_info { @@ -72,8 +75,18 @@ struct shadow_time_info { int pc_callfunc_irq; \ int pc_virq_to_irq[NR_VIRQS]; \ int pc_ipi_to_irq[NR_IPIS] -#else + +#elif defined(XENHVM) + +#define PCPU_XEN_FIELDS \ + ; \ + unsigned int pc_last_processed_l1i; \ + unsigned int pc_last_processed_l2i + +#else /* !XEN && !XENHVM */ + #define PCPU_XEN_FIELDS + #endif #define PCPU_MD_FIELDS \ Modified: head/sys/i386/include/pmap.h ============================================================================== --- head/sys/i386/include/pmap.h Tue Jan 4 14:13:09 2011 (r216955) +++ head/sys/i386/include/pmap.h Tue Jan 4 14:49:54 2011 (r216956) @@ -208,7 +208,7 @@ extern pd_entry_t *IdlePTD; /* physical */ #define vtophys(va) pmap_kextract((vm_offset_t)(va)) -#ifdef XEN +#if defined(XEN) #include #include #include @@ -315,7 +315,9 @@ pmap_kextract(vm_offset_t va) } return (pa); } +#endif +#if !defined(XEN) #define PT_UPDATES_FLUSH() #endif Modified: head/sys/i386/include/xen/hypercall.h ============================================================================== --- head/sys/i386/include/xen/hypercall.h Tue Jan 4 14:13:09 2011 (r216955) +++ head/sys/i386/include/xen/hypercall.h Tue Jan 4 14:49:54 2011 (r216956) @@ -234,9 +234,14 @@ HYPERVISOR_memory_op( return _hypercall2(int, memory_op, cmd, arg); } +#if defined(XEN) int HYPERVISOR_multicall(multicall_entry_t *, int); static inline int _HYPERVISOR_multicall( +#else /* XENHVM */ +static inline int +HYPERVISOR_multicall( +#endif void *call_list, int nr_calls) { return _hypercall2(int, multicall, call_list, nr_calls); Modified: head/sys/i386/include/xen/xen-os.h ============================================================================== --- head/sys/i386/include/xen/xen-os.h Tue Jan 4 14:13:09 2011 (r216955) +++ head/sys/i386/include/xen/xen-os.h Tue Jan 4 14:49:54 2011 (r216956) @@ -12,7 +12,7 @@ #define CONFIG_X86_PAE #endif -#if defined(XEN) && !defined(__XEN_INTERFACE_VERSION__) +#if !defined(__XEN_INTERFACE_VERSION__) /* * Can update to a more recent version when we implement * the hypercall page @@ -95,6 +95,8 @@ void printk(const char *fmt, ...); /* some function prototypes */ void trap_init(void); +#ifndef XENHVM + /* * STI/CLI equivalents. These basically set and clear the virtual * event_enable flag in teh shared_info structure. Note that when @@ -164,6 +166,7 @@ do { #define spin_lock_irqsave mtx_lock_irqsave #define spin_unlock_irqrestore mtx_unlock_irqrestore +#endif #ifdef SMP #define smp_mb() mb() Modified: head/sys/i386/include/xen/xenpmap.h ============================================================================== --- head/sys/i386/include/xen/xenpmap.h Tue Jan 4 14:13:09 2011 (r216955) +++ head/sys/i386/include/xen/xenpmap.h Tue Jan 4 14:49:54 2011 (r216956) @@ -35,6 +35,8 @@ #ifndef _XEN_XENPMAP_H_ #define _XEN_XENPMAP_H_ + +#if defined(XEN) void _xen_queue_pt_update(vm_paddr_t, vm_paddr_t, char *, int); void xen_pt_switch(vm_paddr_t); void xen_set_ldt(vm_paddr_t, unsigned long); @@ -230,5 +232,15 @@ phys_to_machine_mapping_valid(unsigned l return xen_phys_machine[pfn] != INVALID_P2M_ENTRY; } +#elif defined(XENHVM) + +#define set_phys_to_machine(pfn, mfn) ((void)0) +#define phys_to_machine_mapping_valid(pfn) (TRUE) + +#if !defined(PAE) +#define vtomach(va) pmap_kextract((vm_offset_t) (va)) +#endif + +#endif /* !XEN && !XENHVM */ #endif /* _XEN_XENPMAP_H_ */ Modified: head/sys/i386/include/xen/xenvar.h ============================================================================== --- head/sys/i386/include/xen/xenvar.h Tue Jan 4 14:13:09 2011 (r216955) +++ head/sys/i386/include/xen/xenvar.h Tue Jan 4 14:49:54 2011 (r216956) @@ -28,6 +28,11 @@ #ifndef XENVAR_H_ #define XENVAR_H_ + +#include + +#if defined(XEN) + #define XBOOTUP 0x1 #define XPMAP 0x2 extern int xendebug_flags; @@ -36,7 +41,6 @@ extern int xendebug_flags; #else #define XENPRINTF printf #endif -#include extern xen_pfn_t *xen_phys_machine; extern xen_pfn_t *xen_pfn_to_mfn_frame_list[16]; @@ -101,4 +105,11 @@ int xen_create_contiguous_region(vm_pag void xen_destroy_contiguous_region(void * addr, int npages); +#elif defined(XENHVM) + +#define PFNTOMFN(pa) (pa) +#define MFNTOPFN(ma) (ma) + +#endif /* !XEN && !XENHVM */ + #endif