FreeBSD/sys/kern/kern_intr.c
/*
 * Bind an interrupt event to the specified CPU.  Note that not all
 * platforms support binding an interrupt to a CPU.  For those
 * platforms this request will fail.  For supported platforms, any
 * associated ithreads as well as the primary interrupt context will
 * be bound to the specificed CPU.  Using a cpu id of NOCPU unbinds
 * the interrupt event.
 */
Bind an interrupt event to the specified CPU.  Note that not all
platforms support binding an interrupt to a CPU.  For those
platforms this request will fail.  For supported platforms, any
associated ithreads as well as the primary interrupt context will
be bound to the specificed CPU.  Using a cpu id of NOCPU unbinds
the interrupt event.
Bind an interrupt event to the specified CPU . Note that not all platforms support binding an interrupt to a CPU . For those platforms this request will fail . For supported platforms any associated ithreads as well as the primary interrupt context will be bound to the specificed CPU . Using a cpu id of NOCPU unbinds the interrupt event .
int
intr_event_bind(struct intr_event *ie, int cpu)
{
	lwpid_t id;
	int error;
	if (cpu != NOCPU && CPU_ABSENT(cpu))
		return (EINVAL);
	if (ie->ie_assign_cpu == NULL)
		return (EOPNOTSUPP);
	error = priv_check(curthread, PRIV_SCHED_CPUSET_INTR);
	if (error)
		return (error);
	mtx_lock(&ie->ie_lock);
	if (ie->ie_thread != NULL) {
		id = ie->ie_thread->it_thread->td_tid;
		mtx_unlock(&ie->ie_lock);
		error = cpuset_setithread(id, cpu);
		if (error)
			return (error);
	} else
		mtx_unlock(&ie->ie_lock);
	error = ie->ie_assign_cpu(ie->ie_source, cpu);
	if (error) {
		mtx_lock(&ie->ie_lock);
		if (ie->ie_thread != NULL) {
			cpu = ie->ie_cpu;
			id = ie->ie_thread->it_thread->td_tid;
			mtx_unlock(&ie->ie_lock);
			(void)cpuset_setithread(id, cpu);
		} else
			mtx_unlock(&ie->ie_lock);
		return (error);
	}
	mtx_lock(&ie->ie_lock);
	ie->ie_cpu = cpu;
	mtx_unlock(&ie->ie_lock);
	return (error);
}
int intr_event_bind ( struct intr_event * ie , int cpu ) { lwpid_t id ; int error ; if ( cpu != NOCPU && CPU_ABSENT ( cpu ) ) return ( EINVAL ) ; if ( ie -> ie_assign_cpu == NULL ) return ( EOPNOTSUPP ) ; error = priv_check ( curthread , PRIV_SCHED_CPUSET_INTR ) ; if ( error ) return ( error ) ; mtx_lock ( & ie -> ie_lock ) ; if ( ie -> ie_thread != NULL ) { id = ie -> ie_thread -> it_thread -> td_tid ; mtx_unlock ( & ie -> ie_lock ) ; error = cpuset_setithread ( id , cpu ) ; if ( error ) return ( error ) ; } else mtx_unlock ( & ie -> ie_lock ) ; error = ie -> ie_assign_cpu ( ie -> ie_source , cpu ) ; if ( error ) { mtx_lock ( & ie -> ie_lock ) ; if ( ie -> ie_thread != NULL ) { cpu = ie -> ie_cpu ; id = ie -> ie_thread -> it_thread -> td_tid ; mtx_unlock ( & ie -> ie_lock ) ; ( void ) cpuset_setithread ( id , cpu ) ; } else mtx_unlock ( & ie -> ie_lock ) ; return ( error ) ; } mtx_lock ( & ie -> ie_lock ) ; ie -> ie_cpu = cpu ; mtx_unlock ( & ie -> ie_lock ) ; return ( error ) ; }
Bind an interrupt event to the specified CPU.
Bind an interrupt event to the specified CPU .
/* Need a CPU to bind to. */ /*
	 * If we have any ithreads try to set their mask first to verify
	 * permissions, etc.
	 */