powerpc: Remove checks for MSG_ALL and MSG_ALL_BUT_SELF
authorMilton Miller <miltonm@bga.com>
Tue, 10 May 2011 19:29:10 +0000 (19:29 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 19 May 2011 04:30:46 +0000 (14:30 +1000)
Now that smp_ops->smp_message_pass is always called with an (online) cpu
number for the target remove the checks for MSG_ALL and MSG_ALL_BUT_SELF.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 files changed:
arch/powerpc/include/asm/dbell.h
arch/powerpc/include/asm/machdep.h
arch/powerpc/include/asm/xics.h
arch/powerpc/kernel/dbell.c
arch/powerpc/platforms/cell/beat_smp.c
arch/powerpc/platforms/cell/smp.c
arch/powerpc/platforms/iseries/smp.c
arch/powerpc/platforms/powermac/smp.c
arch/powerpc/platforms/ps3/smp.c
arch/powerpc/sysdev/mpic.c
arch/powerpc/sysdev/xics/icp-hv.c
arch/powerpc/sysdev/xics/icp-native.c

index 0893ab9343a6a791a77c5262bbcfa56ba79b290b..3269eb49640afc790d25e3006867c3753d3412b3 100644 (file)
@@ -27,7 +27,7 @@ enum ppc_dbell {
        PPC_G_DBELL_MC = 4,     /* guest mcheck doorbell */
 };
 
-extern void doorbell_message_pass(int target, int msg);
+extern void doorbell_message_pass(int cpu, int msg);
 extern void doorbell_exception(struct pt_regs *regs);
 extern void doorbell_check_self(void);
 extern void doorbell_setup_this_cpu(void);
index c6345acf166f46c6ce654a51c4a4d619430cc6d9..b0802a5bd744792ee99b6eba1987fa5c66f988b0 100644 (file)
@@ -31,7 +31,7 @@ struct kimage;
 
 #ifdef CONFIG_SMP
 struct smp_ops_t {
-       void  (*message_pass)(int target, int msg);
+       void  (*message_pass)(int cpu, int msg);
        int   (*probe)(void);
        int   (*kick_cpu)(int nr);
        void  (*setup_cpu)(int nr);
index 6c06306c41001537660a3fa67497c60301b40140..1750c8dae1fa391d41fcf6724cc3fd6409727a08 100644 (file)
@@ -40,7 +40,7 @@ struct icp_ops {
        void (*teardown_cpu)(void);
        void (*flush_ipi)(void);
 #ifdef CONFIG_SMP
-       void (*message_pass)(int target, int msg);
+       void (*message_pass)(int cpu, int msg);
        irq_handler_t ipi_action;
 #endif
 };
index 3307a52d797fb682269723b240d05402aad26fe1..e49b24c8413342e35063e3b060749960678009c7 100644 (file)
@@ -34,32 +34,13 @@ void doorbell_setup_this_cpu(void)
        info->tag = mfspr(SPRN_PIR) & 0x3fff;
 }
 
-void doorbell_message_pass(int target, int msg)
+void doorbell_message_pass(int cpu, int msg)
 {
        struct doorbell_cpu_info *info;
-       int i;
-
-       if (target < NR_CPUS) {
-               info = &per_cpu(doorbell_cpu_info, target);
-               set_bit(msg, &info->messages);
-               ppc_msgsnd(PPC_DBELL, 0, info->tag);
-       }
-       else if (target == MSG_ALL_BUT_SELF) {
-               for_each_online_cpu(i) {
-                       if (i == smp_processor_id())
-                               continue;
-                       info = &per_cpu(doorbell_cpu_info, i);
-                       set_bit(msg, &info->messages);
-                       ppc_msgsnd(PPC_DBELL, 0, info->tag);
-               }
-       }
-       else { /* target == MSG_ALL */
-               for_each_online_cpu(i) {
-                       info = &per_cpu(doorbell_cpu_info, i);
-                       set_bit(msg, &info->messages);
-               }
-               ppc_msgsnd(PPC_DBELL, PPC_DBELL_MSG_BRDCAST, 0);
-       }
+
+       info = &per_cpu(doorbell_cpu_info, cpu);
+       set_bit(msg, &info->messages);
+       ppc_msgsnd(PPC_DBELL, 0, info->tag);
 }
 
 void doorbell_exception(struct pt_regs *regs)
index 3e86acbb0fb4c12201afd39c5a2cac5d55a1c0e3..23bbe6e08c873ed2ffee40c77301dc48fb013ee9 100644 (file)
@@ -67,22 +67,6 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
        return 0;
 }
 
-static void smp_beatic_message_pass(int target, int msg)
-{
-       unsigned int i;
-
-       if (target < NR_CPUS) {
-               beatic_cause_IPI(target, msg);
-       } else {
-               for_each_online_cpu(i) {
-                       if (target == MSG_ALL_BUT_SELF
-                           && i == smp_processor_id())
-                               continue;
-                       beatic_cause_IPI(i, msg);
-               }
-       }
-}
-
 static int __init smp_beatic_probe(void)
 {
        return cpumask_weight(cpu_possible_mask);
@@ -105,7 +89,7 @@ static int smp_celleb_cpu_bootable(unsigned int nr)
        return 1;
 }
 static struct smp_ops_t bpa_beatic_smp_ops = {
-       .message_pass   = smp_beatic_message_pass,
+       .message_pass   = beatic_cause_IPI,
        .probe          = smp_beatic_probe,
        .kick_cpu       = smp_celleb_kick_cpu,
        .setup_cpu      = smp_beatic_setup_cpu,
index a2161b91b0bf602aeda70bb116a7bc2d0a66525d..d176e6148e3f2597a872ee572cf9512226a10c07 100644 (file)
@@ -103,22 +103,6 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
        return 1;
 }
 
-static void smp_iic_message_pass(int target, int msg)
-{
-       unsigned int i;
-
-       if (target < NR_CPUS) {
-               iic_cause_IPI(target, msg);
-       } else {
-               for_each_online_cpu(i) {
-                       if (target == MSG_ALL_BUT_SELF
-                           && i == smp_processor_id())
-                               continue;
-                       iic_cause_IPI(i, msg);
-               }
-       }
-}
-
 static int __init smp_iic_probe(void)
 {
        iic_request_IPIs();
@@ -168,7 +152,7 @@ static int smp_cell_cpu_bootable(unsigned int nr)
        return 1;
 }
 static struct smp_ops_t bpa_iic_smp_ops = {
-       .message_pass   = smp_iic_message_pass,
+       .message_pass   = iic_cause_IPI,
        .probe          = smp_iic_probe,
        .kick_cpu       = smp_cell_kick_cpu,
        .setup_cpu      = smp_cell_setup_cpu,
index 02a677a1f912146af75d0a62f7e1d519ad3a3889..dcdbc5dc5aad6647f18ca85da673d897b5d540b4 100644 (file)
@@ -59,28 +59,12 @@ void iSeries_smp_message_recv(void)
                        smp_message_recv(msg);
 }
 
-static inline void smp_iSeries_do_message(int cpu, int msg)
+static void smp_iSeries_message_pass(int cpu, int msg)
 {
        set_bit(msg, &iSeries_smp_message[cpu]);
        HvCall_sendIPI(&(paca[cpu]));
 }
 
-static void smp_iSeries_message_pass(int target, int msg)
-{
-       int i;
-
-       if (target < NR_CPUS)
-               smp_iSeries_do_message(target, msg);
-       else {
-               for_each_online_cpu(i) {
-                       if ((target == MSG_ALL_BUT_SELF) &&
-                                       (i == smp_processor_id()))
-                               continue;
-                       smp_iSeries_do_message(i, msg);
-               }
-       }
-}
-
 static int smp_iSeries_probe(void)
 {
        return cpumask_weight(cpu_possible_mask);
index 621d4b7755f2772bbccd9bd3326311da8f949de9..c49e71926a5497145f640ef553daa37684c15b1a 100644 (file)
@@ -186,21 +186,10 @@ irqreturn_t psurge_primary_intr(int irq, void *d)
        return IRQ_HANDLED;
 }
 
-static void smp_psurge_message_pass(int target, int msg)
+static void smp_psurge_message_pass(int cpu, int msg)
 {
-       int i;
-
-       if (num_online_cpus() < 2)
-               return;
-
-       for_each_online_cpu(i) {
-               if (target == MSG_ALL
-                   || (target == MSG_ALL_BUT_SELF && i != smp_processor_id())
-                   || target == i) {
-                       set_bit(msg, &psurge_smp_message[i]);
-                       psurge_set_ipi(i);
-               }
-       }
+       set_bit(msg, &psurge_smp_message[cpu]);
+       psurge_set_ipi(cpu);
 }
 
 /*
index 51ffde40af2b7d5c9ba41fee997c4790073d8035..4c44794faac0b344ac50663ed12122519c37b53d 100644 (file)
@@ -39,7 +39,7 @@
 #define MSG_COUNT 4
 static DEFINE_PER_CPU(unsigned int [MSG_COUNT], ps3_ipi_virqs);
 
-static void do_message_pass(int target, int msg)
+static void ps3_smp_message_pass(int cpu, int msg)
 {
        int result;
        unsigned int virq;
@@ -49,28 +49,12 @@ static void do_message_pass(int target, int msg)
                return;
        }
 
-       virq = per_cpu(ps3_ipi_virqs, target)[msg];
+       virq = per_cpu(ps3_ipi_virqs, cpu)[msg];
        result = ps3_send_event_locally(virq);
 
        if (result)
                DBG("%s:%d: ps3_send_event_locally(%d, %d) failed"
-                       " (%d)\n", __func__, __LINE__, target, msg, result);
-}
-
-static void ps3_smp_message_pass(int target, int msg)
-{
-       int cpu;
-
-       if (target < NR_CPUS)
-               do_message_pass(target, msg);
-       else if (target == MSG_ALL_BUT_SELF) {
-               for_each_online_cpu(cpu)
-                       if (cpu != smp_processor_id())
-                               do_message_pass(cpu, msg);
-       } else {
-               for_each_online_cpu(cpu)
-                       do_message_pass(cpu, msg);
-       }
+                       " (%d)\n", __func__, __LINE__, cpu, msg, result);
 }
 
 static int ps3_smp_probe(void)
index 116695b7a5cb6983f747e500fcdbfde7dd7ea2b7..68ea50c419020b8c8695d1de36987351393a5bf1 100644 (file)
@@ -1628,31 +1628,15 @@ static void mpic_send_ipi(unsigned int ipi_no, const struct cpumask *cpu_mask)
                       mpic_physmask(cpumask_bits(cpu_mask)[0]));
 }
 
-void smp_mpic_message_pass(int target, int msg)
+void smp_mpic_message_pass(int cpu, int msg)
 {
-       cpumask_var_t tmp;
-
        /* make sure we're sending something that translates to an IPI */
        if ((unsigned int)msg > 3) {
                printk("SMP %d: smp_message_pass: unknown msg %d\n",
                       smp_processor_id(), msg);
                return;
        }
-       switch (target) {
-       case MSG_ALL:
-               mpic_send_ipi(msg, cpu_online_mask);
-               break;
-       case MSG_ALL_BUT_SELF:
-               alloc_cpumask_var(&tmp, GFP_NOWAIT);
-               cpumask_andnot(tmp, cpu_online_mask,
-                              cpumask_of(smp_processor_id()));
-               mpic_send_ipi(msg, tmp);
-               free_cpumask_var(tmp);
-               break;
-       default:
-               mpic_send_ipi(msg, cpumask_of(target));
-               break;
-       }
+       mpic_send_ipi(msg, cpumask_of(cpu));
 }
 
 int __init smp_mpic_probe(void)
index 76e87245bbfe19caeb75aafd0833e13eb51230f2..234764c189a44e01feceb330b3f0ce8c3ed98ae4 100644 (file)
@@ -118,7 +118,7 @@ static void icp_hv_set_cpu_priority(unsigned char cppr)
 
 #ifdef CONFIG_SMP
 
-static inline void icp_hv_do_message(int cpu, int msg)
+static void icp_hv_message_pass(int cpu, int msg)
 {
        unsigned long *tgt = &per_cpu(xics_ipi_message, cpu);
 
@@ -127,22 +127,6 @@ static inline void icp_hv_do_message(int cpu, int msg)
        icp_hv_set_qirr(cpu, IPI_PRIORITY);
 }
 
-static void icp_hv_message_pass(int target, int msg)
-{
-       unsigned int i;
-
-       if (target < NR_CPUS) {
-               icp_hv_do_message(target, msg);
-       } else {
-               for_each_online_cpu(i) {
-                       if (target == MSG_ALL_BUT_SELF
-                           && i == smp_processor_id())
-                               continue;
-                       icp_hv_do_message(i, msg);
-               }
-       }
-}
-
 static irqreturn_t icp_hv_ipi_action(int irq, void *dev_id)
 {
        int cpu = smp_processor_id();
index 3508321c4501ba0c21890a1b79be0722778eff8b..246500eefbfd781cd0dbfaab0d5ff3965f699701 100644 (file)
@@ -134,7 +134,7 @@ static unsigned int icp_native_get_irq(void)
 
 #ifdef CONFIG_SMP
 
-static inline void icp_native_do_message(int cpu, int msg)
+static void icp_native_message_pass(int cpu, int msg)
 {
        unsigned long *tgt = &per_cpu(xics_ipi_message, cpu);
 
@@ -143,22 +143,6 @@ static inline void icp_native_do_message(int cpu, int msg)
        icp_native_set_qirr(cpu, IPI_PRIORITY);
 }
 
-static void icp_native_message_pass(int target, int msg)
-{
-       unsigned int i;
-
-       if (target < NR_CPUS) {
-               icp_native_do_message(target, msg);
-       } else {
-               for_each_online_cpu(i) {
-                       if (target == MSG_ALL_BUT_SELF
-                           && i == smp_processor_id())
-                               continue;
-                       icp_native_do_message(i, msg);
-               }
-       }
-}
-
 static irqreturn_t icp_native_ipi_action(int irq, void *dev_id)
 {
        int cpu = smp_processor_id();