Index: sys/xen/xen_intr.c =================================================================== --- sys/xen/xen_intr.c +++ sys/xen/xen_intr.c @@ -687,16 +687,6 @@ panic("unable to rebind xen IPI: %d", error); isrc->xi_port = bind_ipi.port; - isrc->xi_cpu = 0; - xen_intr_port_to_isrc[bind_ipi.port] = isrc; - - error = xen_intr_assign_cpu(&isrc->xi_intsrc, - cpu_apic_ids[cpu]); - if (error) - panic("unable to bind xen IPI to CPU#%d: %d", - cpu, error); - - evtchn_unmask_port(bind_ipi.port); #else panic("Resume IPI event channel on UP"); #endif @@ -717,18 +707,37 @@ panic("unable to rebind xen VIRQ#%d: %d", isrc->xi_virq, error); isrc->xi_port = bind_virq.port; +} + +static void +xen_intr_rebind_isrc(struct xenisrc *isrc) +{ + int cpu = isrc->xi_cpu; + int error; + + switch (isrc->xi_type) { + case EVTCHN_TYPE_IPI: + xen_rebind_ipi(isrc); + break; + case EVTCHN_TYPE_VIRQ: + xen_rebind_virq(isrc); + break; + default: + return; + } + isrc->xi_cpu = 0; - xen_intr_port_to_isrc[bind_virq.port] = isrc; + xen_intr_port_to_isrc[isrc->xi_port] = isrc; #ifdef SMP error = xen_intr_assign_cpu(&isrc->xi_intsrc, cpu_apic_ids[cpu]); if (error) - panic("unable to bind xen VIRQ#%d to CPU#%d: %d", + panic("unable to bind xen intr#%d to CPU#%d: %d", isrc->xi_virq, cpu, error); #endif - evtchn_unmask_port(bind_virq.port); + evtchn_unmask_port(isrc->xi_port); } /** @@ -767,19 +776,8 @@ vector = first_evtchn_irq + isrc_idx; isrc = (struct xenisrc *)intr_lookup_source(vector); - if (isrc != NULL) { - isrc->xi_port = 0; - switch (isrc->xi_type) { - case EVTCHN_TYPE_IPI: - xen_rebind_ipi(isrc); - break; - case EVTCHN_TYPE_VIRQ: - xen_rebind_virq(isrc); - break; - default: - break; - } - } + if (isrc != NULL) + xen_intr_rebind_isrc(isrc); } }