]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
xen: Introduce xen_support_evtchn_bind
authorJulien Grall <julien.grall@citrix.com>
Sat, 10 Oct 2015 19:40:06 +0000 (20:40 +0100)
committerJulien Grall <julien.grall@citrix.com>
Mon, 2 Nov 2015 11:46:55 +0000 (11:46 +0000)
xen_vector_callback_enabled is x86 specific and supporting evtchn rebind
on others architectures may be different.

Introduce a new helper to check if we can rebind the event channel.

Note that xen_intr_assign_cpu was only checking if
xen_vector_callback_enabled. Although it looks like to me that rebind
should be supported for PVH.

sys/dev/xen/debug/debug.c
sys/x86/include/xen/xen-os.h
sys/x86/xen/xen_intr.c

index 31bb70979cf989339a7bc3a02e7b588ab8e18dae..a8b9b17969eed97b7b22abe237b70b46f8104fd1 100644 (file)
@@ -95,7 +95,7 @@ xendebug_identify(driver_t *driver, device_t parent)
        KASSERT(xen_domain(),
            ("Trying to add Xen debug device to non-xen guest"));
 
-       if (xen_hvm_domain() && !xen_vector_callback_enabled)
+       if (!xen_support_evtchn_rebind())
                return;
 
        if (BUS_ADD_CHILD(parent, 0, "debug", 0) == NULL)
index c3cff89036e23e8885cac203249d38a5d793f8b1..507ddf1e5856b43e580fa55bab0ad487af13729f 100644 (file)
@@ -42,6 +42,13 @@ xen_pmap(vm_paddr_t pa, vm_size_t size)
        return (pmap_mapdev(pa, size));
 }
 
+static inline bool
+xen_support_evtchn_rebind(void)
+{
+
+       return (!xen_hvm_domain() || xen_vector_callback_enabled == 0);
+}
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* _MACHINE_X86_XEN_XEN_OS_H_ */
index 5fd50d836929ede32f04eb33a860dfb17ca66a34..266cdc87065c585d0aeeca1026642ca8adb3b177 100644 (file)
@@ -531,7 +531,7 @@ xen_intr_handle_upcall(struct trapframe *trap_frame)
        s   = HYPERVISOR_shared_info;
        v   = DPCPU_GET(vcpu_info);
 
-       if (xen_hvm_domain() && !xen_vector_callback_enabled) {
+       if (!xen_support_evtchn_rebind()) {
                KASSERT((cpu == 0), ("Fired PCI event callback on wrong CPU"));
        }
 
@@ -871,7 +871,7 @@ xen_intr_assign_cpu(struct intsrc *base_isrc, u_int apic_id)
        u_int to_cpu, vcpu_id;
        int error, masked;
 
-       if (xen_vector_callback_enabled == 0)
+       if (!xen_support_evtchn_rebind())
                return (EOPNOTSUPP);
 
        to_cpu = apic_cpuid(apic_id);