]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[IA64] SN: validate smp_affinity mask on intr redirect
authorJohn Keller <jpk@sgi.com>
Fri, 11 May 2007 05:42:44 +0000 (22:42 -0700)
committerTony Luck <tony.luck@intel.com>
Fri, 11 May 2007 16:35:38 +0000 (09:35 -0700)
On SN, only allow one bit to be set in the smp_affinty mask when
redirecting an interrupt.  Currently setting multiple bits is allowed, but
only the first bit is used in determining the CPU to redirect to.  This has
caused confusion among some customers.

[akpm@linux-foundation.org: fixes]
Signed-off-by: John Keller <jpk@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Tony Luck <tony.luck@intel.com>
arch/ia64/kernel/irq.c
include/asm-ia64/irq.h
kernel/irq/proc.c

index ce49c85c928f5fe44f52501c86211b11926c89d8..b4c239685d2eb8f0072d2510573d027ab867d1c3 100644 (file)
@@ -104,6 +104,17 @@ void set_irq_affinity_info (unsigned int irq, int hwid, int redir)
                irq_redir[irq] = (char) (redir & 0xff);
        }
 }
+
+bool is_affinity_mask_valid(cpumask_t cpumask)
+{
+       if (ia64_platform_is("sn2")) {
+               /* Only allow one CPU to be specified in the smp_affinity mask */
+               if (cpus_weight(cpumask) != 1)
+                       return false;
+       }
+       return true;
+}
+
 #endif /* CONFIG_SMP */
 
 #ifdef CONFIG_HOTPLUG_CPU
index 79479e2c6966b0cb468db6f348538e8b0e19d32f..67221615e3173537ac8df7b4ba6de436dd97db3c 100644 (file)
@@ -11,6 +11,9 @@
  * 02/29/00     D.Mosberger    moved most things into hw_irq.h
  */
 
+#include <linux/types.h>
+#include <linux/cpumask.h>
+
 #define NR_IRQS                256
 #define NR_IRQ_VECTORS NR_IRQS
 
@@ -29,5 +32,8 @@ extern void disable_irq (unsigned int);
 extern void disable_irq_nosync (unsigned int);
 extern void enable_irq (unsigned int);
 extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
+bool is_affinity_mask_valid(cpumask_t cpumask);
+
+#define is_affinity_mask_valid is_affinity_mask_valid
 
 #endif /* _ASM_IA64_IRQ_H */
index ddde0ef9ccdcbb4dbd8834accc5f0264deee8403..b4f1674fca7987d8f99fa707eb2655cd20f0bc37 100644 (file)
@@ -27,6 +27,10 @@ static int irq_affinity_read_proc(char *page, char **start, off_t off,
        return len;
 }
 
+#ifndef is_affinity_mask_valid
+#define is_affinity_mask_valid(val) 1
+#endif
+
 int no_irq_affinity;
 static int irq_affinity_write_proc(struct file *file, const char __user *buffer,
                                   unsigned long count, void *data)
@@ -42,6 +46,9 @@ static int irq_affinity_write_proc(struct file *file, const char __user *buffer,
        if (err)
                return err;
 
+       if (!is_affinity_mask_valid(new_value))
+               return -EINVAL;
+
        /*
         * Do not allow disabling IRQs completely - it's a too easy
         * way to make the system unusable accidentally :-) At least