From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 06:38:05 2008 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 915E0106566C; Tue, 21 Oct 2008 06:38:05 +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 7E6D08FC14; Tue, 21 Oct 2008 06:38:05 +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 m9L6c5d7091258; Tue, 21 Oct 2008 06:38:05 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9L6c5wN091251; Tue, 21 Oct 2008 06:38:05 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200810210638.m9L6c5wN091251@svn.freebsd.org> From: Kip Macy Date: Tue, 21 Oct 2008 06:38:05 +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: r184110 - in head/sys/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, 21 Oct 2008 06:38:05 -0000 Author: kmacy Date: Tue Oct 21 06:38:05 2008 New Revision: 184110 URL: http://svn.freebsd.org/changeset/base/184110 Log: Header cleanups and addition of IPI declarations for xen Modified: head/sys/i386/include/apicvar.h head/sys/i386/include/smp.h head/sys/i386/include/xen/evtchn.h head/sys/i386/include/xen/xen-os.h head/sys/i386/include/xen/xen_intr.h head/sys/i386/include/xen/xenfunc.h Modified: head/sys/i386/include/apicvar.h ============================================================================== --- head/sys/i386/include/apicvar.h Tue Oct 21 05:08:35 2008 (r184109) +++ head/sys/i386/include/apicvar.h Tue Oct 21 06:38:05 2008 (r184110) @@ -113,6 +113,17 @@ #define APIC_THERMAL_INT (APIC_LOCAL_INTS + 1) #define APIC_IPI_INTS (APIC_LOCAL_INTS + 2) +#ifdef XEN +#define IPI_RENDEZVOUS (0) /* Inter-CPU rendezvous. */ +#define IPI_INVLTLB (1) /* TLB Shootdown IPIs */ +#define IPI_INVLPG (2) +#define IPI_INVLRNG (3) +#define IPI_INVLCACHE (4) +#define IPI_LAZYPMAP (5) /* Lazy pmap release. */ +/* Vector to handle bitmap based IPIs */ +#define IPI_BITMAP_VECTOR (6) + +#else #define IPI_RENDEZVOUS (APIC_IPI_INTS) /* Inter-CPU rendezvous. */ #define IPI_INVLTLB (APIC_IPI_INTS + 1) /* TLB Shootdown IPIs */ #define IPI_INVLPG (APIC_IPI_INTS + 2) @@ -121,6 +132,7 @@ #define IPI_LAZYPMAP (APIC_IPI_INTS + 5) /* Lazy pmap release. */ /* Vector to handle bitmap based IPIs */ #define IPI_BITMAP_VECTOR (APIC_IPI_INTS + 6) +#endif /* IPIs handled by IPI_BITMAPED_VECTOR (XXX ups is there a better place?) */ #define IPI_AST 0 /* Generate software trap. */ Modified: head/sys/i386/include/smp.h ============================================================================== --- head/sys/i386/include/smp.h Tue Oct 21 05:08:35 2008 (r184109) +++ head/sys/i386/include/smp.h Tue Oct 21 06:38:05 2008 (r184110) @@ -83,6 +83,11 @@ int ipi_nmi_handler(void); #endif #ifdef XEN void ipi_to_irq_init(void); + +#define RESCHEDULE_VECTOR 0 +#define CALL_FUNCTION_VECTOR 1 +#define NR_IPIS 2 + #endif #endif /* !LOCORE */ #endif /* SMP */ Modified: head/sys/i386/include/xen/evtchn.h ============================================================================== --- head/sys/i386/include/xen/evtchn.h Tue Oct 21 05:08:35 2008 (r184109) +++ head/sys/i386/include/xen/evtchn.h Tue Oct 21 06:38:05 2008 (r184110) @@ -37,13 +37,24 @@ void mask_evtchn(int port); void unmask_evtchn(int port); +#ifdef SMP +void rebind_evtchn_to_cpu(int port, unsigned int cpu); +#else +#define rebind_evtchn_to_cpu(port, cpu) ((void)0) +#endif +static inline +int test_and_set_evtchn_mask(int port) +{ + shared_info_t *s = HYPERVISOR_shared_info; + return synch_test_and_set_bit(port, s->evtchn_mask); +} static inline void clear_evtchn(int port) { - shared_info_t *s = HYPERVISOR_shared_info; - synch_clear_bit(port, &s->evtchn_pending[0]); + shared_info_t *s = HYPERVISOR_shared_info; + synch_clear_bit(port, &s->evtchn_pending[0]); } static inline void Modified: head/sys/i386/include/xen/xen-os.h ============================================================================== --- head/sys/i386/include/xen/xen-os.h Tue Oct 21 05:08:35 2008 (r184109) +++ head/sys/i386/include/xen/xen-os.h Tue Oct 21 06:38:05 2008 (r184110) @@ -98,12 +98,6 @@ void printk(const char *fmt, ...); /* some function prototypes */ void trap_init(void); -extern int preemptable; -#define preempt_disable() (preemptable = 0) -#define preempt_enable() (preemptable = 1) -#define preempt_enable_no_resched() (preemptable = 1) - - /* * STI/CLI equivalents. These basically set and clear the virtual * event_enable flag in teh shared_info structure. Note that when @@ -115,10 +109,8 @@ extern int preemptable; #define __cli() \ do { \ vcpu_info_t *_vcpu; \ - preempt_disable(); \ _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \ _vcpu->evtchn_upcall_mask = 1; \ - preempt_enable_no_resched(); \ barrier(); \ } while (0) @@ -126,36 +118,23 @@ do { do { \ vcpu_info_t *_vcpu; \ barrier(); \ - preempt_disable(); \ _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \ _vcpu->evtchn_upcall_mask = 0; \ barrier(); /* unmask then check (avoid races) */ \ if ( unlikely(_vcpu->evtchn_upcall_pending) ) \ force_evtchn_callback(); \ - preempt_enable(); \ -} while (0) - - -#define __save_flags(x) \ -do { \ - vcpu_info_t *vcpu; \ - vcpu = HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \ - (x) = _vcpu->evtchn_upcall_mask; \ } while (0) #define __restore_flags(x) \ do { \ vcpu_info_t *_vcpu; \ barrier(); \ - preempt_disable(); \ _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \ if ((_vcpu->evtchn_upcall_mask = (x)) == 0) { \ barrier(); /* unmask then check (avoid races) */ \ if ( unlikely(_vcpu->evtchn_upcall_pending) ) \ force_evtchn_callback(); \ - preempt_enable(); \ - } else \ - preempt_enable_no_resched(); \ + } \ } while (0) /* Modified: head/sys/i386/include/xen/xen_intr.h ============================================================================== --- head/sys/i386/include/xen/xen_intr.h Tue Oct 21 05:08:35 2008 (r184109) +++ head/sys/i386/include/xen/xen_intr.h Tue Oct 21 06:38:05 2008 (r184110) @@ -32,7 +32,6 @@ /* Dynamic binding of event channels and VIRQ sources to Linux IRQ space. */ extern void unbind_from_irq(int irq); -extern void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu); extern int bind_caller_port_to_irqhandler(unsigned int caller_port, const char *devname, driver_intr_t handler, void *arg, unsigned long irqflags, void **cookiep); @@ -41,8 +40,12 @@ extern int bind_listening_port_to_irqhan void **cookiep); extern int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu, const char *devname, driver_filter_t filter, driver_intr_t handler, unsigned long irqflags); -extern int bind_ipi_to_irqhandler(unsigned int ipi, unsigned int cpu, const char *devname, - driver_intr_t handler, unsigned long irqflags); +extern int bind_ipi_to_irqhandler(unsigned int ipi, + unsigned int cpu, + const char *devname, + driver_intr_t handler, + unsigned long irqflags); + extern int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain, unsigned int remote_port, const char *devname, @@ -65,7 +68,7 @@ extern void enable_irq(unsigned int); extern void irq_suspend(void); extern void irq_resume(void); -extern void idle_block(void); - +extern void idle_block(void); +extern int ap_cpu_initclocks(int cpu); #endif /* _XEN_INTR_H_ */ Modified: head/sys/i386/include/xen/xenfunc.h ============================================================================== --- head/sys/i386/include/xen/xenfunc.h Tue Oct 21 05:08:35 2008 (r184109) +++ head/sys/i386/include/xen/xenfunc.h Tue Oct 21 06:38:05 2008 (r184110) @@ -67,8 +67,6 @@ void _xen_machphys_update(vm_paddr_t, vm void xen_update_descriptor(union descriptor *, union descriptor *); -void ap_cpu_initclocks(void); - extern struct mtx balloon_lock; #if 0 #define balloon_lock(__flags) mtx_lock_irqsave(&balloon_lock, __flags)