Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=25d61578daae697c4a0eb817f42a868af9824f82
Commit:     25d61578daae697c4a0eb817f42a868af9824f82
Parent:     3e3d32770204ea24cf71919a90d9ccfc2bd407dd
Author:     John Keller <[EMAIL PROTECTED]>
AuthorDate: Thu May 10 22:42:44 2007 -0700
Committer:  Tony Luck <[EMAIL PROTECTED]>
CommitDate: Fri May 11 09:35:38 2007 -0700

    [IA64] SN: validate smp_affinity mask on intr redirect
    
    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.
    
    [EMAIL PROTECTED]: fixes]
    Signed-off-by: John Keller <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Tony Luck <[EMAIL PROTECTED]>
---
 arch/ia64/kernel/irq.c |   11 +++++++++++
 include/asm-ia64/irq.h |    6 ++++++
 kernel/irq/proc.c      |    7 +++++++
 3 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
index ce49c85..b4c2396 100644
--- a/arch/ia64/kernel/irq.c
+++ b/arch/ia64/kernel/irq.c
@@ -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
diff --git a/include/asm-ia64/irq.h b/include/asm-ia64/irq.h
index 79479e2..6722161 100644
--- a/include/asm-ia64/irq.h
+++ b/include/asm-ia64/irq.h
@@ -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 */
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index ddde0ef..b4f1674 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -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
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to