summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMartin J. Bligh <mbligh@aracnet.com>2002-12-22 18:19:53 -0800
committerPatrick Mochel <mochel@osdl.org>2002-12-22 18:19:53 -0800
commit00047bcc15091f3ce64315e289ba2fccafefd15e (patch)
tree402017caf4031d50cbfdcd8abfffe2ccd546d4f5 /include
parent37d1206a506a5ee32d71bfa8e2c818551341e684 (diff)
[PATCH] cleanup IPI code
Reformat the IPI stuff, specifically send_IPI_mask, send_IPI_allbutself, and send_IPI_all. Though the way they work is pretty silly for NUMA-Q, I do an equivalent transform here, and fix the code in a seperate patch (next one). Goes into mach_ipi.h
Diffstat (limited to 'include')
-rw-r--r--include/asm-i386/mach-default/mach_ipi.h30
-rw-r--r--include/asm-i386/mach-numaq/mach_ipi.h39
-rw-r--r--include/asm-i386/mach-summit/mach_ipi.h39
3 files changed, 108 insertions, 0 deletions
diff --git a/include/asm-i386/mach-default/mach_ipi.h b/include/asm-i386/mach-default/mach_ipi.h
new file mode 100644
index 000000000000..481692a7b885
--- /dev/null
+++ b/include/asm-i386/mach-default/mach_ipi.h
@@ -0,0 +1,30 @@
+#ifndef __ASM_MACH_IPI_H
+#define __ASM_MACH_IPI_H
+
+static inline void send_IPI_mask_bitmask(int mask, int vector);
+static inline void __send_IPI_shortcut(unsigned int shortcut, int vector);
+
+static inline void send_IPI_mask(int mask, int vector)
+{
+ send_IPI_mask_bitmask(mask, vector);
+}
+
+static inline void send_IPI_allbutself(int vector)
+{
+ /*
+ * if there are no other CPUs in the system then we get an APIC send
+ * error if we try to broadcast, thus avoid sending IPIs in this case.
+ */
+ if (!(num_online_cpus() > 1))
+ return;
+
+ __send_IPI_shortcut(APIC_DEST_ALLBUT, vector);
+ return;
+}
+
+static inline void send_IPI_all(int vector)
+{
+ __send_IPI_shortcut(APIC_DEST_ALLINC, vector);
+}
+
+#endif /* __ASM_MACH_IPI_H */
diff --git a/include/asm-i386/mach-numaq/mach_ipi.h b/include/asm-i386/mach-numaq/mach_ipi.h
new file mode 100644
index 000000000000..382f337d1fdc
--- /dev/null
+++ b/include/asm-i386/mach-numaq/mach_ipi.h
@@ -0,0 +1,39 @@
+#ifndef __ASM_MACH_IPI_H
+#define __ASM_MACH_IPI_H
+
+static inline void send_IPI_mask_sequence(int mask, int vector);
+
+static inline void send_IPI_mask(int mask, int vector)
+{
+ send_IPI_mask_sequence(mask, vector);
+}
+
+static inline void send_IPI_allbutself(int vector)
+{
+ int cpu;
+ /*
+ * if there are no other CPUs in the system then we get an APIC send
+ * error if we try to broadcast, thus avoid sending IPIs in this case.
+ */
+ if (!(num_online_cpus() > 1))
+ return;
+
+ /* Pointless. Use send_IPI_mask to do this instead */
+ for (cpu = 0; cpu < NR_CPUS; ++cpu)
+ if (cpu_online(cpu) && cpu != smp_processor_id())
+ send_IPI_mask(1 << cpu, vector);
+
+ return;
+}
+
+static inline void send_IPI_all(int vector)
+{
+ int cpu;
+
+ /* Pointless. Use send_IPI_mask to do this instead */
+ for (cpu = 0; cpu < NR_CPUS; ++cpu)
+ if (cpu_online(cpu))
+ send_IPI_mask(1 << cpu, vector);
+}
+
+#endif /* __ASM_MACH_IPI_H */
diff --git a/include/asm-i386/mach-summit/mach_ipi.h b/include/asm-i386/mach-summit/mach_ipi.h
new file mode 100644
index 000000000000..382f337d1fdc
--- /dev/null
+++ b/include/asm-i386/mach-summit/mach_ipi.h
@@ -0,0 +1,39 @@
+#ifndef __ASM_MACH_IPI_H
+#define __ASM_MACH_IPI_H
+
+static inline void send_IPI_mask_sequence(int mask, int vector);
+
+static inline void send_IPI_mask(int mask, int vector)
+{
+ send_IPI_mask_sequence(mask, vector);
+}
+
+static inline void send_IPI_allbutself(int vector)
+{
+ int cpu;
+ /*
+ * if there are no other CPUs in the system then we get an APIC send
+ * error if we try to broadcast, thus avoid sending IPIs in this case.
+ */
+ if (!(num_online_cpus() > 1))
+ return;
+
+ /* Pointless. Use send_IPI_mask to do this instead */
+ for (cpu = 0; cpu < NR_CPUS; ++cpu)
+ if (cpu_online(cpu) && cpu != smp_processor_id())
+ send_IPI_mask(1 << cpu, vector);
+
+ return;
+}
+
+static inline void send_IPI_all(int vector)
+{
+ int cpu;
+
+ /* Pointless. Use send_IPI_mask to do this instead */
+ for (cpu = 0; cpu < NR_CPUS; ++cpu)
+ if (cpu_online(cpu))
+ send_IPI_mask(1 << cpu, vector);
+}
+
+#endif /* __ASM_MACH_IPI_H */