MN10300: cleanup IRQ affinity setting
Mark Salter [Wed, 12 Dec 2012 15:36:37 +0000 (15:36 +0000)]
The irq_set_affinity handler for the mn10300 cpu pic had some hard-coded IRQs
which were not to be migrated from one cpu to another. This patch cleans those
up by using a combination of IRQF_NOBALANCING and specialized irq chips with
no irq_set_affinity handler. This maintains the previous behavior by using
generic IRQ interfaces rather than hard coding IRQ numbers in the default
irq_set_affinity handler.

Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>

arch/mn10300/kernel/irq.c
arch/mn10300/kernel/mn10300-serial.c
arch/mn10300/kernel/smp.c

index 35932a8..6ab3b73 100644 (file)
@@ -142,57 +142,11 @@ mn10300_cpupic_setaffinity(struct irq_data *d, const struct cpumask *mask,
                           bool force)
 {
        unsigned long flags;
-       int err;
 
        flags = arch_local_cli_save();
-
-       /* check irq no */
-       switch (d->irq) {
-       case TMJCIRQ:
-       case RESCHEDULE_IPI:
-       case CALL_FUNC_SINGLE_IPI:
-       case LOCAL_TIMER_IPI:
-       case FLUSH_CACHE_IPI:
-       case CALL_FUNCTION_NMI_IPI:
-       case DEBUGGER_NMI_IPI:
-#ifdef CONFIG_MN10300_TTYSM0
-       case SC0RXIRQ:
-       case SC0TXIRQ:
-#ifdef CONFIG_MN10300_TTYSM0_TIMER8
-       case TM8IRQ:
-#elif CONFIG_MN10300_TTYSM0_TIMER2
-       case TM2IRQ:
-#endif /* CONFIG_MN10300_TTYSM0_TIMER8 */
-#endif /* CONFIG_MN10300_TTYSM0 */
-
-#ifdef CONFIG_MN10300_TTYSM1
-       case SC1RXIRQ:
-       case SC1TXIRQ:
-#ifdef CONFIG_MN10300_TTYSM1_TIMER12
-       case TM12IRQ:
-#elif defined(CONFIG_MN10300_TTYSM1_TIMER9)
-       case TM9IRQ:
-#elif defined(CONFIG_MN10300_TTYSM1_TIMER3)
-       case TM3IRQ:
-#endif /* CONFIG_MN10300_TTYSM1_TIMER12 */
-#endif /* CONFIG_MN10300_TTYSM1 */
-
-#ifdef CONFIG_MN10300_TTYSM2
-       case SC2RXIRQ:
-       case SC2TXIRQ:
-       case TM10IRQ:
-#endif /* CONFIG_MN10300_TTYSM2 */
-               err = -1;
-               break;
-
-       default:
-               set_bit(d->irq, irq_affinity_request);
-               err = 0;
-               break;
-       }
-
+       set_bit(d->irq, irq_affinity_request);
        arch_local_irq_restore(flags);
-       return err;
+       return 0;
 }
 #endif /* CONFIG_SMP */
 
index 131b81f..4968cfe 100644 (file)
@@ -936,15 +936,18 @@ static int mn10300_serial_startup(struct uart_port *_port)
        irq_set_chip(port->tm_irq, &mn10300_serial_pic);
 
        if (request_irq(port->rx_irq, mn10300_serial_interrupt,
-                       IRQF_DISABLED, port->rx_name, port) < 0)
+                       IRQF_DISABLED | IRQF_NOBALANCING,
+                       port->rx_name, port) < 0)
                goto error;
 
        if (request_irq(port->tx_irq, mn10300_serial_interrupt,
-                       IRQF_DISABLED, port->tx_name, port) < 0)
+                       IRQF_DISABLED | IRQF_NOBALANCING,
+                       port->tx_name, port) < 0)
                goto error2;
 
        if (request_irq(port->tm_irq, mn10300_serial_interrupt,
-                       IRQF_DISABLED, port->tm_name, port) < 0)
+                       IRQF_DISABLED | IRQF_NOBALANCING,
+                       port->tm_name, port) < 0)
                goto error3;
        mn10300_serial_mask_ack(port->tm_irq);
 
index e62c223..95983cd 100644 (file)
@@ -130,10 +130,12 @@ static irqreturn_t smp_call_function_interrupt(int irq, void *dev_id);
 
 static struct irqaction reschedule_ipi = {
        .handler        = smp_reschedule_interrupt,
+       .flags          = IRQF_NOBALANCING,
        .name           = "smp reschedule IPI"
 };
 static struct irqaction call_function_ipi = {
        .handler        = smp_call_function_interrupt,
+       .flags          = IRQF_NOBALANCING,
        .name           = "smp call function IPI"
 };
 
@@ -141,7 +143,7 @@ static struct irqaction call_function_ipi = {
 static irqreturn_t smp_ipi_timer_interrupt(int irq, void *dev_id);
 static struct irqaction local_timer_ipi = {
        .handler        = smp_ipi_timer_interrupt,
-       .flags          = IRQF_DISABLED,
+       .flags          = IRQF_DISABLED | IRQF_NOBALANCING,
        .name           = "smp local timer IPI"
 };
 #endif
@@ -180,6 +182,7 @@ static void init_ipi(void)
 
 #ifdef CONFIG_MN10300_CACHE_ENABLED
        /* set up the cache flush IPI */
+       irq_set_chip(FLUSH_CACHE_IPI, &mn10300_ipi_type);
        flags = arch_local_cli_save();
        __set_intr_stub(NUM2EXCEP_IRQ_LEVEL(FLUSH_CACHE_GxICR_LV),
                        mn10300_low_ipi_handler);
@@ -189,6 +192,7 @@ static void init_ipi(void)
 #endif
 
        /* set up the NMI call function IPI */
+       irq_set_chip(CALL_FUNCTION_NMI_IPI, &mn10300_ipi_type);
        flags = arch_local_cli_save();
        GxICR(CALL_FUNCTION_NMI_IPI) = GxICR_NMI | GxICR_ENABLE | GxICR_DETECT;
        tmp16 = GxICR(CALL_FUNCTION_NMI_IPI);
@@ -199,6 +203,10 @@ static void init_ipi(void)
        __set_intr_stub(NUM2EXCEP_IRQ_LEVEL(SMP_BOOT_GxICR_LV),
                        mn10300_low_ipi_handler);
        arch_local_irq_restore(flags);
+
+#ifdef CONFIG_KERNEL_DEBUGGER
+       irq_set_chip(DEBUGGER_NMI_IPI, &mn10300_ipi_type);
+#endif
 }
 
 /**