
From: Anton Blanchard <anton@samba.org>

 Replace CONFIG_IRQ_ALL_CPUS with a boot option (noirqdistrib).  Compile
options arent much use on a distro kernel.  This also removes the ppc64 use
of smp_threads_ready.

I considered removing the option completely but we have had problems in the
past with firmware bugs.  In those cases the boot option would have helped.
 
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/ppc64/Kconfig              |    8 --------
 25-akpm/arch/ppc64/kernel/irq.c         |    8 ++++++++
 25-akpm/arch/ppc64/kernel/mpic.c        |   12 +++++-------
 25-akpm/arch/ppc64/kernel/pSeries_smp.c |    2 --
 25-akpm/arch/ppc64/kernel/smp.c         |    3 ---
 25-akpm/arch/ppc64/kernel/xics.c        |   32 ++++++++++++++------------------
 25-akpm/include/asm-ppc64/irq.h         |    2 ++
 7 files changed, 29 insertions(+), 38 deletions(-)

diff -puN arch/ppc64/Kconfig~ppc64-remove-config_irq_all_cpus arch/ppc64/Kconfig
--- 25/arch/ppc64/Kconfig~ppc64-remove-config_irq_all_cpus	2005-01-16 01:13:51.605735896 -0800
+++ 25-akpm/arch/ppc64/Kconfig	2005-01-16 01:13:51.616734224 -0800
@@ -186,14 +186,6 @@ config SMP
 
 	  If you don't know what to do here, say Y.
 
-config IRQ_ALL_CPUS
-	bool "Distribute interrupts on all CPUs by default"
-	depends on SMP && PPC_MULTIPLATFORM
-	help
-	  This option gives the kernel permission to distribute IRQs across
-	  multiple CPUs.  Saying N here will route all IRQs to the first
-	  CPU.
-
 config NR_CPUS
 	int "Maximum number of CPUs (2-128)"
 	range 2 128
diff -puN arch/ppc64/kernel/irq.c~ppc64-remove-config_irq_all_cpus arch/ppc64/kernel/irq.c
--- 25/arch/ppc64/kernel/irq.c~ppc64-remove-config_irq_all_cpus	2005-01-16 01:13:51.606735744 -0800
+++ 25-akpm/arch/ppc64/kernel/irq.c	2005-01-16 01:13:51.617734072 -0800
@@ -62,6 +62,7 @@ extern void iSeries_smp_message_recv( st
 
 extern irq_desc_t irq_desc[NR_IRQS];
 
+int distribute_irqs = 1;
 int __irq_offset_value;
 int ppc_spurious_interrupts;
 unsigned long lpevent_count;
@@ -479,3 +480,10 @@ EXPORT_SYMBOL(do_softirq);
 
 #endif /* CONFIG_IRQSTACKS */
 
+static int __init setup_noirqdistrib(char *str)
+{
+	distribute_irqs = 0;
+	return 1;
+}
+
+__setup("noirqdistrib", setup_noirqdistrib);
diff -puN arch/ppc64/kernel/mpic.c~ppc64-remove-config_irq_all_cpus arch/ppc64/kernel/mpic.c
--- 25/arch/ppc64/kernel/mpic.c~ppc64-remove-config_irq_all_cpus	2005-01-16 01:13:51.607735592 -0800
+++ 25-akpm/arch/ppc64/kernel/mpic.c	2005-01-16 01:13:51.618733920 -0800
@@ -765,10 +765,8 @@ void mpic_setup_this_cpu(void)
 #ifdef CONFIG_SMP
 	struct mpic *mpic = mpic_primary;
 	unsigned long flags;
-#ifdef CONFIG_IRQ_ALL_CPUS
 	u32 msk = 1 << hard_smp_processor_id();
 	unsigned int i;
-#endif
 
 	BUG_ON(mpic == NULL);
 
@@ -776,16 +774,16 @@ void mpic_setup_this_cpu(void)
 
 	spin_lock_irqsave(&mpic_lock, flags);
 
-#ifdef CONFIG_IRQ_ALL_CPUS
  	/* let the mpic know we want intrs. default affinity is 0xffffffff
 	 * until changed via /proc. That's how it's done on x86. If we want
 	 * it differently, then we should make sure we also change the default
 	 * values of irq_affinity in irq.c.
  	 */
- 	for (i = 0; i < mpic->num_sources ; i++)
-		mpic_irq_write(i, MPIC_IRQ_DESTINATION,
-			mpic_irq_read(i, MPIC_IRQ_DESTINATION) | msk);
-#endif /* CONFIG_IRQ_ALL_CPUS */
+	if (distribute_irqs) {
+	 	for (i = 0; i < mpic->num_sources ; i++)
+			mpic_irq_write(i, MPIC_IRQ_DESTINATION,
+				mpic_irq_read(i, MPIC_IRQ_DESTINATION) | msk);
+	}
 
 	/* Set current processor priority to 0 */
 	mpic_cpu_write(MPIC_CPU_CURRENT_TASK_PRI, 0);
diff -puN arch/ppc64/kernel/pSeries_smp.c~ppc64-remove-config_irq_all_cpus arch/ppc64/kernel/pSeries_smp.c
--- 25/arch/ppc64/kernel/pSeries_smp.c~ppc64-remove-config_irq_all_cpus	2005-01-16 01:13:51.609735288 -0800
+++ 25-akpm/arch/ppc64/kernel/pSeries_smp.c	2005-01-16 01:13:51.618733920 -0800
@@ -259,7 +259,6 @@ static void __devinit smp_xics_setup_cpu
 	if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR)
 		vpa_init(cpu);
 
-#ifdef CONFIG_IRQ_ALL_CPUS
 	/*
 	 * Put the calling processor into the GIQ.  This is really only
 	 * necessary from a secondary thread as the OF start-cpu interface
@@ -267,7 +266,6 @@ static void __devinit smp_xics_setup_cpu
 	 */
 	rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE,
 		(1UL << interrupt_server_size) - 1 - default_distrib_server, 1);
-#endif
 }
 
 static spinlock_t timebase_lock = SPIN_LOCK_UNLOCKED;
diff -puN arch/ppc64/kernel/smp.c~ppc64-remove-config_irq_all_cpus arch/ppc64/kernel/smp.c
--- 25/arch/ppc64/kernel/smp.c~ppc64-remove-config_irq_all_cpus	2005-01-16 01:13:51.610735136 -0800
+++ 25-akpm/arch/ppc64/kernel/smp.c	2005-01-16 01:13:51.619733768 -0800
@@ -526,9 +526,6 @@ void __init smp_cpus_done(unsigned int m
 	
 	smp_ops->setup_cpu(boot_cpuid);
 
-	/* XXX fix this, xics currently relies on it - Anton */
-	smp_threads_ready = 1;
-
 	set_cpus_allowed(current, old_mask);
 
 	/*
diff -puN arch/ppc64/kernel/xics.c~ppc64-remove-config_irq_all_cpus arch/ppc64/kernel/xics.c
--- 25/arch/ppc64/kernel/xics.c~ppc64-remove-config_irq_all_cpus	2005-01-16 01:13:51.612734832 -0800
+++ 25-akpm/arch/ppc64/kernel/xics.c	2005-01-16 01:13:51.620733616 -0800
@@ -242,28 +242,24 @@ static unsigned int real_irq_to_virt(uns
 static int get_irq_server(unsigned int irq)
 {
 	unsigned int server;
-
-#ifdef CONFIG_IRQ_ALL_CPUS
 	/* For the moment only implement delivery to all cpus or one cpu */
-	if (smp_threads_ready) {
-		cpumask_t cpumask = irq_affinity[irq];
-		cpumask_t tmp = CPU_MASK_NONE;
-		if (cpus_equal(cpumask, CPU_MASK_ALL)) {
-			server = default_distrib_server;
-		} else {
-			cpus_and(tmp, cpu_online_map, cpumask);
+	cpumask_t cpumask = irq_affinity[irq];
+	cpumask_t tmp = CPU_MASK_NONE;
 
-			if (cpus_empty(tmp))
-				server = default_distrib_server;
-			else
-				server = get_hard_smp_processor_id(first_cpu(tmp));
-		}
+	if (!distribute_irqs)
+		return default_server;
+
+	if (cpus_equal(cpumask, CPU_MASK_ALL)) {
+		server = default_distrib_server;
 	} else {
-		server = default_server;
+		cpus_and(tmp, cpu_online_map, cpumask);
+
+		if (cpus_empty(tmp))
+			server = default_distrib_server;
+		else
+			server = get_hard_smp_processor_id(first_cpu(tmp));
 	}
-#else
-	server = default_server;
-#endif
+
 	return server;
 
 }
diff -puN include/asm-ppc64/irq.h~ppc64-remove-config_irq_all_cpus include/asm-ppc64/irq.h
--- 25/include/asm-ppc64/irq.h~ppc64-remove-config_irq_all_cpus	2005-01-16 01:13:51.613734680 -0800
+++ 25-akpm/include/asm-ppc64/irq.h	2005-01-16 01:13:51.620733616 -0800
@@ -87,6 +87,8 @@ static __inline__ int irq_canonicalize(i
 	return irq;
 }
 
+extern int distribute_irqs;
+
 struct irqaction;
 struct pt_regs;
 
_
