Changeset View
Changeset View
Standalone View
Standalone View
sys/x86/xen/xen_intr.c
Show First 20 Lines • Show All 293 Lines • ▼ Show 20 Lines | xen_intr_find_unused_isrc(enum evtchn_type type) | ||||
mtx_assert(&xen_intr_x86_lock, MA_OWNED); | mtx_assert(&xen_intr_x86_lock, MA_OWNED); | ||||
for (isrc_idx = 0; isrc_idx < xen_intr_auto_vector_count; isrc_idx ++) { | for (isrc_idx = 0; isrc_idx < xen_intr_auto_vector_count; isrc_idx ++) { | ||||
struct xenisrc *isrc; | struct xenisrc *isrc; | ||||
u_int vector; | u_int vector; | ||||
vector = first_evtchn_irq + isrc_idx; | vector = first_evtchn_irq + isrc_idx; | ||||
isrc = (struct xenisrc *)intr_lookup_source(vector); | isrc = (struct xenisrc *)intr_lookup_source(vector); | ||||
if (isrc != NULL | if (__predict_true(isrc != NULL) && | ||||
&& isrc->xi_type == EVTCHN_TYPE_UNBOUND) { | __predict_true(isrc->xi_intsrc.is_pic == &xen_intr_pic) && | ||||
isrc->xi_type == EVTCHN_TYPE_UNBOUND) { | |||||
KASSERT(isrc->xi_intsrc.is_handlers == 0, | KASSERT(isrc->xi_intsrc.is_handlers == 0, | ||||
("Free evtchn still has handlers")); | ("Free evtchn still has handlers")); | ||||
isrc->xi_type = type; | isrc->xi_type = type; | ||||
return (isrc); | return (isrc); | ||||
} | } | ||||
} | } | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
Show All 35 Lines | xen_intr_alloc_isrc(enum evtchn_type type) | ||||
KASSERT((intr_lookup_source(vector) == NULL), | KASSERT((intr_lookup_source(vector) == NULL), | ||||
("Trying to use an already allocated vector")); | ("Trying to use an already allocated vector")); | ||||
mtx_unlock(&xen_intr_x86_lock); | mtx_unlock(&xen_intr_x86_lock); | ||||
isrc = malloc(sizeof(*isrc), M_XENINTR, M_WAITOK | M_ZERO); | isrc = malloc(sizeof(*isrc), M_XENINTR, M_WAITOK | M_ZERO); | ||||
isrc->xi_intsrc.is_pic = &xen_intr_pic; | isrc->xi_intsrc.is_pic = &xen_intr_pic; | ||||
isrc->xi_vector = vector; | isrc->xi_vector = vector; | ||||
isrc->xi_type = type; | isrc->xi_type = type; | ||||
intr_register_source(&isrc->xi_intsrc); | if (__predict_false(intr_register_source(&isrc->xi_intsrc) != 0)) { | ||||
free(isrc, M_XENINTR); | |||||
printf("%s(): WARNING failed to register IRQ %u\n", __func__, | |||||
vector); | |||||
return (NULL); | |||||
} | |||||
return (isrc); | return (isrc); | ||||
} | } | ||||
/** | /** | ||||
* Attempt to free an active Xen interrupt source object. | * Attempt to free an active Xen interrupt source object. | ||||
* | * | ||||
* \param isrc The interrupt source object to release. | * \param isrc The interrupt source object to release. | ||||
▲ Show 20 Lines • Show All 1,033 Lines • Show Last 20 Lines |