int x86_fast_ipi(struct cpu_info *ci, int ipi) { if (!(ci->ci_flags & CPUF_RUNNING)) return (ENOENT); return (x86_ipi(ipi, ci->ci_apicid, LAPIC_DLMODE_FIXED)); }
void x86_send_ipi(struct cpu_info *ci, int ipimask) { x86_atomic_setbits_u32(&ci->ci_ipis, ipimask); /* Don't send IPI to cpu which isn't (yet) running. */ if (!(ci->ci_flags & CPUF_RUNNING)) return; x86_ipi(LAPIC_IPI_VECTOR, ci->ci_apicid, LAPIC_DLMODE_FIXED); }
void x86_broadcast_ipi(int ipimask) { struct cpu_info *ci, *self = curcpu(); int count = 0; CPU_INFO_ITERATOR cii; CPU_INFO_FOREACH(cii, ci) { if (ci == self) continue; if ((ci->ci_flags & CPUF_RUNNING) == 0) continue; x86_atomic_setbits_u32(&ci->ci_ipis, ipimask); count++; } if (!count) return; x86_ipi(LAPIC_IPI_VECTOR, LAPIC_DEST_ALLEXCL, LAPIC_DLMODE_FIXED); }
static inline void pmap_tlb_processpacket(pmap_tlb_packet_t *tp, kcpuset_t *target) { int err = 0; if (!kcpuset_match(target, kcpuset_attached)) { const struct cpu_info * const self = curcpu(); CPU_INFO_ITERATOR cii; struct cpu_info *lci; for (CPU_INFO_FOREACH(cii, lci)) { const cpuid_t lcid = cpu_index(lci); if (__predict_false(lci == self) || !kcpuset_isset(target, lcid)) { continue; } err |= x86_ipi(LAPIC_TLB_VECTOR, lci->ci_cpuid, LAPIC_DLMODE_FIXED); } } else {
int x86_send_ipi(struct cpu_info *ci, int ipimask) { int ret; x86_atomic_setbits_u32(&ci->ci_ipis, ipimask); /* Don't send IPI to cpu which isn't (yet) running. */ if (!(ci->ci_flags & CPUF_RUNNING)) return ENOENT; ret = x86_ipi(LAPIC_IPI_VECTOR, ci->ci_apicid, LAPIC_DLMODE_FIXED); if (ret != 0) { printf("ipi of %x from %s to %s failed\n", ipimask, curcpu()->ci_dev->dv_xname, ci->ci_dev->dv_xname); } return ret; }
const struct cpu_info * const self = curcpu(); CPU_INFO_ITERATOR cii; struct cpu_info *lci; for (CPU_INFO_FOREACH(cii, lci)) { const cpuid_t lcid = cpu_index(lci); if (__predict_false(lci == self) || !kcpuset_isset(target, lcid)) { continue; } err |= x86_ipi(LAPIC_TLB_VECTOR, lci->ci_cpuid, LAPIC_DLMODE_FIXED); } } else { err = x86_ipi(LAPIC_TLB_VECTOR, LAPIC_DEST_ALLEXCL, LAPIC_DLMODE_FIXED); } KASSERT(err == 0); } #endif /* XEN */ #endif /* MULTIPROCESSOR */ /* * pmap_tlb_shootnow: process pending TLB shootdowns queued on current CPU. * * => Must be called with preemption disabled. */ void pmap_tlb_shootnow(void) {