diff --git a/sys/x86/include/xen/xen-os.h b/sys/x86/include/xen/xen-os.h index 1a32b9c9e3a5..6a3b82c0ba62 100644 --- a/sys/x86/include/xen/xen-os.h +++ b/sys/x86/include/xen/xen-os.h @@ -1,88 +1,91 @@ /***************************************************************************** * x86/xen/xen-os.h * * Random collection of macros and definition * * Copyright (c) 2003, 2004 Keir Fraser (on behalf of the Xen team) * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (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. */ #ifndef _MACHINE_X86_XEN_XEN_OS_H_ #define _MACHINE_X86_XEN_XEN_OS_H_ #ifndef _XEN_XEN_OS_H_ #error "do not #include machine/xen/xen-os.h, #include xen/xen-os.h instead" #endif /* Shared memory needs write-back as its cache attribute for coherency. */ #define VM_MEMATTR_XEN VM_MEMATTR_WRITE_BACK /* Everything below this point is not included by assembler (.S) files. */ #ifndef __ASSEMBLY__ #include /* If non-zero, the hypervisor has been configured to use a direct vector */ extern int xen_vector_callback_enabled; +/* Signal whether the event channel vector requires EOI at the lapic */ +extern bool xen_evtchn_needs_ack; + /* tunable for disabling PV disks */ extern int xen_disable_pv_disks; /* tunable for disabling PV nics */ extern int xen_disable_pv_nics; extern uint32_t xen_cpuid_base; static inline u_int XEN_CPUID_TO_VCPUID(u_int cpuid) { return (pcpu_find(cpuid)->pc_vcpu_id); } #define XEN_VCPUID() PCPU_GET(vcpu_id) static inline bool xen_has_percpu_evtchn(void) { return (!xen_hvm_domain() || xen_vector_callback_enabled); } static inline bool xen_pv_disks_disabled(void) { return (xen_hvm_domain() && xen_disable_pv_disks != 0); } static inline bool xen_pv_nics_disabled(void) { return (xen_hvm_domain() && xen_disable_pv_nics != 0); } bool xen_has_iommu_maps(void); #endif /* !__ASSEMBLY__ */ #endif /* _MACHINE_X86_XEN_XEN_OS_H_ */ diff --git a/sys/xen/hvm.h b/sys/xen/hvm.h index 01e409f026c4..3ff3ee3c51e6 100644 --- a/sys/xen/hvm.h +++ b/sys/xen/hvm.h @@ -1,107 +1,106 @@ /* * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (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. */ #ifndef __XEN_HVM_H__ #define __XEN_HVM_H__ #include #include #include /** * \brief Wrapper function to obtain a HVM parameter value. * * \param index HVM parameter index; see . * * \returns 0 on failure; the value of the parameter otherwise. */ static inline unsigned long hvm_get_parameter(int index) { struct xen_hvm_param xhv; int error; xhv.domid = DOMID_SELF; xhv.index = index; error = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv); if (error) { printf("%s: error %d trying to get %d\n", __func__, error, index); return (0); } return (xhv.value); } /** The callback method types for Hypervisor event delivery to our domain. */ enum { HVM_CB_TYPE_GSI, HVM_CB_TYPE_PCI_INTX, HVM_CB_TYPE_VECTOR, HVM_CB_TYPE_MASK = 0xFF, HVM_CB_TYPE_SHIFT = 56 }; /** Format for specifying a GSI type callback. */ enum { HVM_CB_GSI_GSI_MASK = 0xFFFFFFFF, HVM_CB_GSI_GSI_SHIFT = 0 }; #define HVM_CALLBACK_GSI(gsi) \ (((uint64_t)HVM_CB_TYPE_GSI << HVM_CB_TYPE_SHIFT) \ | ((gsi) & HVM_CB_GSI_GSI_MASK) << HVM_CB_GSI_GSI_SHIFT) /** Format for specifying a virtual PCI interrupt line GSI style callback. */ enum { HVM_CB_PCI_INTX_INTPIN_MASK = 0x3, HVM_CB_PCI_INTX_INTPIN_SHIFT = 0, HVM_CB_PCI_INTX_SLOT_MASK = 0x1F, HVM_CB_PCI_INTX_SLOT_SHIFT = 11, }; #define HVM_CALLBACK_PCI_INTX(slot, pin) \ (((uint64_t)HVM_CB_TYPE_PCI_INTX << HVM_CB_TYPE_SHIFT) \ | (((slot) & HVM_CB_PCI_INTX_SLOT_MASK) << HVM_CB_PCI_INTX_SLOT_SHIFT) \ | (((pin) & HVM_CB_PCI_INTX_INTPIN_MASK) << HVM_CB_PCI_INTX_INTPIN_SHIFT)) /** Format for specifying a direct IDT vector injection style callback. */ enum { HVM_CB_VECTOR_VECTOR_MASK = 0xFFFFFFFF, HVM_CB_VECTOR_VECTOR_SHIFT = 0 }; #define HVM_CALLBACK_VECTOR(vector) \ (((uint64_t)HVM_CB_TYPE_VECTOR << HVM_CB_TYPE_SHIFT) \ | (((vector) & HVM_CB_GSI_GSI_MASK) << HVM_CB_GSI_GSI_SHIFT)) enum xen_hvm_init_type { XEN_HVM_INIT_EARLY, XEN_HVM_INIT_LATE, XEN_HVM_INIT_CANCELLED_SUSPEND, XEN_HVM_INIT_RESUME, }; int xen_hvm_init_hypercall_stubs(enum xen_hvm_init_type); void xen_hvm_set_callback(device_t); void xen_hvm_suspend(void); void xen_hvm_resume(bool suspend_cancelled); extern uint32_t hvm_start_flags; -extern bool xen_evtchn_needs_ack; #endif /* __XEN_HVM_H__ */