static void x2apic_send_IPI(int cpu, int vector) { u32 dest = per_cpu(x86_cpu_to_logical_apicid, cpu); x2apic_wrmsr_fence(); __x2apic_send_IPI_dest(dest, vector, APIC_DEST_LOGICAL); }
static void x2apic_send_IPI_mask(cpumask_t mask, int vector) { unsigned long flags; unsigned long query_cpu; local_irq_save(flags); for_each_cpu_mask(query_cpu, mask) { __x2apic_send_IPI_dest(per_cpu(x86_cpu_to_apicid, query_cpu), vector, APIC_DEST_PHYSICAL); }
/* * for now, we send the IPI's one by one in the cpumask. * TBD: Based on the cpu mask, we can send the IPI's to the cluster group * at once. We have 16 cpu's in a cluster. This will minimize IPI register * writes. */ static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) { unsigned long query_cpu; unsigned long flags; x2apic_wrmsr_fence(); local_irq_save(flags); for_each_cpu(query_cpu, mask) { __x2apic_send_IPI_dest( per_cpu(x86_cpu_to_logical_apicid, query_cpu), vector, apic->dest_logical); }
static void __x2apic_send_IPI_mask(const struct cpumask *mask, int vector, int apic_dest) { struct cpumask *cpus_in_cluster_ptr; struct cpumask *ipi_mask_ptr; unsigned int cpu, this_cpu; unsigned long flags; u32 dest; x2apic_wrmsr_fence(); local_irq_save(flags); this_cpu = smp_processor_id(); /* * We are to modify mask, so we need an own copy * and be sure it's manipulated with irq off. */ ipi_mask_ptr = this_cpu_cpumask_var_ptr(ipi_mask); cpumask_copy(ipi_mask_ptr, mask); /* * The idea is to send one IPI per cluster. */ for_each_cpu(cpu, ipi_mask_ptr) { unsigned long i; cpus_in_cluster_ptr = per_cpu(cpus_in_cluster, cpu); dest = 0; /* Collect cpus in cluster. */ for_each_cpu_and(i, ipi_mask_ptr, cpus_in_cluster_ptr) { if (apic_dest == APIC_DEST_ALLINC || i != this_cpu) dest |= per_cpu(x86_cpu_to_logical_apicid, i); } if (!dest) continue; __x2apic_send_IPI_dest(dest, vector, apic->dest_logical); /* * Cluster sibling cpus should be discared now so * we would not send IPI them second time. */ cpumask_andnot(ipi_mask_ptr, ipi_mask_ptr, cpus_in_cluster_ptr); }
static void __x2apic_send_IPI_mask(const struct cpumask *mask, int vector, int apic_dest) { unsigned long query_cpu; unsigned long this_cpu; unsigned long flags; x2apic_wrmsr_fence(); local_irq_save(flags); this_cpu = smp_processor_id(); for_each_cpu(query_cpu, mask) { if (apic_dest == APIC_DEST_ALLBUT && this_cpu == query_cpu) continue; __x2apic_send_IPI_dest(per_cpu(x86_cpu_to_apicid, query_cpu), vector, APIC_DEST_PHYSICAL); } local_irq_restore(flags); }