diff --git a/sys/dev/xen/debug/debug.c b/sys/dev/xen/debug/debug.c --- a/sys/dev/xen/debug/debug.c +++ b/sys/dev/xen/debug/debug.c @@ -97,7 +97,7 @@ KASSERT(xen_domain(), ("Trying to add Xen debug device to non-xen guest")); - if (xen_hvm_domain() && !xen_vector_callback_enabled) + if (!xen_has_percpu_evtchn()) return; if (BUS_ADD_CHILD(parent, 0, "debug", 0) == NULL) diff --git a/sys/x86/include/xen/xen-os.h b/sys/x86/include/xen/xen-os.h --- a/sys/x86/include/xen/xen-os.h +++ b/sys/x86/include/xen/xen-os.h @@ -49,6 +49,13 @@ /* tunable for disabling PV nics */ extern int xen_disable_pv_nics; +static inline bool +xen_has_percpu_evtchn(void) +{ + + return (!xen_hvm_domain() || xen_vector_callback_enabled); +} + static inline bool xen_pv_shutdown_handler(void) { diff --git a/sys/x86/xen/xen_intr.c b/sys/x86/xen/xen_intr.c --- a/sys/x86/xen/xen_intr.c +++ b/sys/x86/xen/xen_intr.c @@ -510,7 +510,7 @@ s = HYPERVISOR_shared_info; v = DPCPU_GET(vcpu_info); - if (xen_hvm_domain() && !xen_vector_callback_enabled) { + if (!xen_has_percpu_evtchn()) { KASSERT((cpu == 0), ("Fired PCI event callback on wrong CPU")); } @@ -859,7 +859,7 @@ u_int to_cpu, vcpu_id; int error, masked; - if (xen_vector_callback_enabled == 0) + if (!xen_has_percpu_evtchn()) return (EOPNOTSUPP); to_cpu = apic_cpuid(apic_id);