Index: sys/x86/include/xen/xen-os.h =================================================================== --- sys/x86/include/xen/xen-os.h +++ sys/x86/include/xen/xen-os.h @@ -41,6 +41,9 @@ /* If non-zero, the hypervisor has been configured to use a direct vector */ extern int xen_vector_callback_enabled; +/* from 27c36a12f1584b53d2454dac238eeed3dedc82ba */ +extern bool xen_evtchn_needs_ack; + /* tunable for disabling PV disks */ extern int xen_disable_pv_disks; Index: sys/x86/include/xen/xen_intr_x86.h =================================================================== --- /dev/null +++ sys/x86/include/xen/xen_intr_x86.h @@ -0,0 +1,99 @@ +/****************************************************************************** + * xen_intr_x86.h + * + * APIs for managing Xen event channel, virtual IRQ, and physical IRQ + * notifications. + * + * Copyright (c) 2004, K A Fraser + * Copyright (c) 2012, Spectra Logic Corporation + * + * This file may be distributed separately from the Linux kernel, or + * incorporated into other software packages, subject to the following license: + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this source file (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, modify, + * merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * $FreeBSD$ + */ +#ifndef _XEN_INTR_X86_H_ +#define _XEN_INTR_X86_H_ + +#include + +/** + * Allocate a local event channel port for servicing interprocessor + * interupts and, if successful, associate the port with the specified + * interrupt handler. + * + * \param cpu The cpu receiving the IPI. + * \param filter The interrupt filter servicing this IPI. + * \param irqflags Interrupt handler flags. See sys/bus.h. + * \param handlep Pointer to an opaque handle used to manage this + * registration. + * + * \returns 0 on success, otherwise an errno. + */ +int xen_intr_alloc_and_bind_ipi(u_int cpu, + driver_filter_t filter, enum intr_type irqflags, + xen_intr_handle_t *handlep); + +/** + * Register a physical interrupt vector and setup the interrupt source. + * + * \param vector The global vector to use. + * \param trig Default trigger method. + * \param pol Default polarity of the interrupt. + * + * \returns 0 on success, otherwise an errno. + */ +int xen_register_pirq(int vector, enum intr_trigger trig, + enum intr_polarity pol); + +/** + * Setup MSI vector interrupt(s). + * + * \param dev The device that requests the binding. + * + * \param vector Requested initial vector to bind the MSI interrupt(s) to. + * + * \param count Number of vectors to allocate. + * + * \returns 0 on success, otherwise an errno. + */ +int xen_register_msi(device_t dev, int vector, int count); + +/** + * Teardown a MSI vector interrupt. + * + * \param vector Requested vector to release. + * + * \returns 0 on success, otherwise an errno. + */ +int xen_release_msi(int vector); + +/** + * Register the IO-APIC PIRQs when running in legacy PVH Dom0 mode. + * + * \param pic PIC instance. + * + * NB: this should be removed together with the support for legacy PVH mode. + */ +struct pic; +void xenpv_register_pirqs(struct pic *pic); + +#endif /* _XEN_INTR_X86_H_ */ Index: sys/x86/xen/pvcpu_enum.c =================================================================== --- sys/x86/xen/pvcpu_enum.c +++ sys/x86/xen/pvcpu_enum.c @@ -52,6 +52,8 @@ #include +#include + #include #include #include Index: sys/x86/xen/xen_apic.c =================================================================== --- sys/x86/xen/xen_apic.c +++ sys/x86/xen/xen_apic.c @@ -54,6 +54,8 @@ #include #include +#include + #include /*--------------------------------- Macros -----------------------------------*/ Index: sys/x86/xen/xen_intr.c =================================================================== --- sys/x86/xen/xen_intr.c +++ sys/x86/xen/xen_intr.c @@ -59,7 +59,6 @@ #include #include -#include #include #include #include @@ -67,6 +66,10 @@ #include #include +#if defined(__amd64__) || defined(__i386__) +#include +#endif + #ifdef DDB #include #endif Index: sys/x86/xen/xen_msi.c =================================================================== --- sys/x86/xen/xen_msi.c +++ sys/x86/xen/xen_msi.c @@ -49,6 +49,8 @@ #include #include +#include + static struct mtx msi_lock; static u_int msi_last_irq; Index: sys/x86/xen/xen_nexus.c =================================================================== --- sys/x86/xen/xen_nexus.c +++ sys/x86/xen/xen_nexus.c @@ -47,6 +47,8 @@ #include #include +#include + #include "pcib_if.h" /* Index: sys/xen/hvm.h =================================================================== --- sys/xen/hvm.h +++ sys/xen/hvm.h @@ -104,6 +104,5 @@ void xen_hvm_resume(bool suspend_cancelled); extern uint32_t hvm_start_flags; -extern bool xen_evtchn_needs_ack; #endif /* __XEN_HVM_H__ */ Index: sys/xen/xen_intr.h =================================================================== --- sys/xen/xen_intr.h +++ sys/xen/xen_intr.h @@ -135,35 +135,6 @@ driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type irqflags, xen_intr_handle_t *handlep); -/** - * Allocate a local event channel port for servicing interprocessor - * interupts and, if successful, associate the port with the specified - * interrupt handler. - * - * \param cpu The cpu receiving the IPI. - * \param filter The interrupt filter servicing this IPI. - * \param irqflags Interrupt handler flags. See sys/bus.h. - * \param handlep Pointer to an opaque handle used to manage this - * registration. - * - * \returns 0 on success, otherwise an errno. - */ -int xen_intr_alloc_and_bind_ipi(u_int cpu, - driver_filter_t filter, enum intr_type irqflags, - xen_intr_handle_t *handlep); - -/** - * Register a physical interrupt vector and setup the interrupt source. - * - * \param vector The global vector to use. - * \param trig Default trigger method. - * \param pol Default polarity of the interrupt. - * - * \returns 0 on success, otherwise an errno. - */ -int xen_register_pirq(int vector, enum intr_trigger trig, - enum intr_polarity pol); - /** * Unbind an interrupt handler from its interrupt source. * @@ -218,28 +189,6 @@ */ evtchn_port_t xen_intr_port(xen_intr_handle_t handle); -/** - * Setup MSI vector interrupt(s). - * - * \param dev The device that requests the binding. - * - * \param vector Requested initial vector to bind the MSI interrupt(s) to. - * - * \param count Number of vectors to allocate. - * - * \returns 0 on success, otherwise an errno. - */ -int xen_register_msi(device_t dev, int vector, int count); - -/** - * Teardown a MSI vector interrupt. - * - * \param vector Requested vector to release. - * - * \returns 0 on success, otherwise an errno. - */ -int xen_release_msi(int vector); - /** * Bind an event channel port with a handler * @@ -271,14 +220,4 @@ int xen_intr_get_evtchn_from_port(evtchn_port_t port, xen_intr_handle_t *handlep); -/** - * Register the IO-APIC PIRQs when running in legacy PVH Dom0 mode. - * - * \param pic PIC instance. - * - * NB: this should be removed together with the support for legacy PVH mode. - */ -struct pic; -void xenpv_register_pirqs(struct pic *pic); - #endif /* _XEN_INTR_H_ */