FreeBSD/sys/mips/mips/mp_machdep.c
/*
 * Handle an IPI sent to this processor.
 */
Handle an IPI sent to this processor.
Handle an IPI sent to this processor .
static int
mips_ipi_handler(void *arg)
{
	u_int	cpu, ipi, ipi_bitmap;
	int	bit;
	cpu = PCPU_GET(cpuid);
	platform_ipi_clear();	
	ipi_bitmap = atomic_readandclear_int(PCPU_PTR(pending_ipis));
	if (ipi_bitmap == 0)
		return (FILTER_STRAY);
	CTR1(KTR_SMP, "smp_handle_ipi(), ipi_bitmap=%x", ipi_bitmap);
	while ((bit = ffs(ipi_bitmap))) {
		bit = bit - 1;
		ipi = 1 << bit;
		ipi_bitmap &= ~ipi;
		switch (ipi) {
		case IPI_RENDEZVOUS:
			CTR0(KTR_SMP, "IPI_RENDEZVOUS");
			smp_rendezvous_action();
			break;
		case IPI_AST:
			CTR0(KTR_SMP, "IPI_AST");
			break;
		case IPI_STOP:
			CTR0(KTR_SMP, "IPI_STOP or IPI_STOP_HARD");
			savectx(&stoppcbs[cpu]);
			tlb_save();
			CPU_SET_ATOMIC(cpu, &stopped_cpus);
			while (!CPU_ISSET(cpu, &started_cpus))
				cpu_spinwait();
			CPU_CLR_ATOMIC(cpu, &started_cpus);
			CPU_CLR_ATOMIC(cpu, &stopped_cpus);
			CTR0(KTR_SMP, "IPI_STOP (restart)");
			break;
		case IPI_PREEMPT:
			CTR1(KTR_SMP, "%s: IPI_PREEMPT", __func__);
			sched_preempt(curthread);
			break;
		case IPI_HARDCLOCK:
			CTR1(KTR_SMP, "%s: IPI_HARDCLOCK", __func__);
			hardclockintr();
			break;
		default:
			panic("Unknown IPI 0x%0x on cpu %d", ipi, curcpu);
		}
	}
	return (FILTER_HANDLED);
}
static int mips_ipi_handler ( void * arg ) { u_int cpu , ipi , ipi_bitmap ; int bit ; cpu = PCPU_GET ( cpuid ) ; platform_ipi_clear ( ) ; ipi_bitmap = atomic_readandclear_int ( PCPU_PTR ( pending_ipis ) ) ; if ( ipi_bitmap == 0 ) return ( FILTER_STRAY ) ; CTR1 ( KTR_SMP , " " , ipi_bitmap ) ; while ( ( bit = ffs ( ipi_bitmap ) ) ) { bit = bit - 1 ; ipi = 1 << bit ; ipi_bitmap &= ~ ipi ; switch ( ipi ) { case IPI_RENDEZVOUS : CTR0 ( KTR_SMP , " " ) ; smp_rendezvous_action ( ) ; break ; case IPI_AST : CTR0 ( KTR_SMP , " " ) ; break ; case IPI_STOP : CTR0 ( KTR_SMP , " " ) ; savectx ( & stoppcbs [ cpu ] ) ; tlb_save ( ) ; CPU_SET_ATOMIC ( cpu , & stopped_cpus ) ; while ( ! CPU_ISSET ( cpu , & started_cpus ) ) cpu_spinwait ( ) ; CPU_CLR_ATOMIC ( cpu , & started_cpus ) ; CPU_CLR_ATOMIC ( cpu , & stopped_cpus ) ; CTR0 ( KTR_SMP , " " ) ; break ; case IPI_PREEMPT : CTR1 ( KTR_SMP , " " , __func__ ) ; sched_preempt ( curthread ) ; break ; case IPI_HARDCLOCK : CTR1 ( KTR_SMP , " " , __func__ ) ; hardclockintr ( ) ; break ; default : panic ( " " , ipi , curcpu ) ; } } return ( FILTER_HANDLED ) ; }
Handle an IPI sent to this processor.
Handle an IPI sent to this processor .
/* quiesce the pending ipi interrupt */ /*
			 * IPI_STOP_HARD is mapped to IPI_STOP so it is not
			 * necessary to add it in the switch.
			 */ /* Indicate we are stopped */ /* Wait for restart */