FreeBSD/sys/x86/xen/xen_intr.c
/**
 * Attempt to free an active Xen interrupt source object.
 *
 * \param isrc  The interrupt source object to release.
 *
 * \returns  EBUSY if the source is still in use, otherwise 0.
 */
Attempt to free an active Xen interrupt source object.
\param isrc  The interrupt source object to release.

\returns  EBUSY if the source is still in use, otherwise 0.
Attempt to free an active Xen interrupt source object . \ param isrc The interrupt source object to release . \ returns EBUSY if the source is still in use otherwise 0 .
static int
xen_intr_release_isrc(struct xenisrc *isrc)
{
	mtx_lock(&xen_intr_isrc_lock);
	if (isrc->xi_intsrc.is_handlers != 0) {
		mtx_unlock(&xen_intr_isrc_lock);
		return (EBUSY);
	}
	evtchn_mask_port(isrc->xi_port);
	evtchn_clear_port(isrc->xi_port);
	evtchn_cpu_mask_port(isrc->xi_cpu, isrc->xi_port);
	evtchn_cpu_unmask_port(0, isrc->xi_port);
	if (isrc->xi_close != 0 && is_valid_evtchn(isrc->xi_port)) {
		struct evtchn_close close = { .port = isrc->xi_port };
		if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close))
			panic("EVTCHNOP_close failed");
	}
	xen_intr_port_to_isrc[isrc->xi_port] = NULL;
	isrc->xi_cpu = 0;
	isrc->xi_type = EVTCHN_TYPE_UNBOUND;
	isrc->xi_port = 0;
	isrc->xi_cookie = NULL;
	mtx_unlock(&xen_intr_isrc_lock);
	return (0);
}
static int xen_intr_release_isrc ( struct xenisrc * isrc ) { mtx_lock ( & xen_intr_isrc_lock ) ; if ( isrc -> xi_intsrc . is_handlers != 0 ) { mtx_unlock ( & xen_intr_isrc_lock ) ; return ( EBUSY ) ; } evtchn_mask_port ( isrc -> xi_port ) ; evtchn_clear_port ( isrc -> xi_port ) ; evtchn_cpu_mask_port ( isrc -> xi_cpu , isrc -> xi_port ) ; evtchn_cpu_unmask_port ( 0 , isrc -> xi_port ) ; if ( isrc -> xi_close != 0 && is_valid_evtchn ( isrc -> xi_port ) ) { struct evtchn_close close = { . port = isrc -> xi_port } ; if ( HYPERVISOR_event_channel_op ( EVTCHNOP_close , & close ) ) panic ( " " ) ; } xen_intr_port_to_isrc [ isrc -> xi_port ] = NULL ; isrc -> xi_cpu = 0 ; isrc -> xi_type = EVTCHN_TYPE_UNBOUND ; isrc -> xi_port = 0 ; isrc -> xi_cookie = NULL ; mtx_unlock ( & xen_intr_isrc_lock ) ; return ( 0 ) ; }
Attempt to free an active Xen interrupt source object.
Attempt to free an active Xen interrupt source object .
/* Rebind port to CPU 0. */