x86: fully honor "nolapic"
[safe/jmp/linux-2.6] / arch / x86 / kernel / io_apic.c
index 58938cc..40747e5 100644 (file)
@@ -129,7 +129,6 @@ static struct irq_pin_list *get_one_free_irq_2_pin(int cpu)
        node = cpu_to_node(cpu);
 
        pin = kzalloc_node(sizeof(*pin), GFP_ATOMIC, node);
-       printk(KERN_DEBUG "  alloc irq_2_pin on cpu %d node %d\n", cpu, node);
 
        return pin;
 }
@@ -170,7 +169,7 @@ static struct irq_cfg irq_cfgx[NR_IRQS] = {
        [15] = { .vector = IRQ15_VECTOR, },
 };
 
-void __init arch_early_irq_init(void)
+int __init arch_early_irq_init(void)
 {
        struct irq_cfg *cfg;
        struct irq_desc *desc;
@@ -188,6 +187,8 @@ void __init arch_early_irq_init(void)
                if (i < NR_IRQS_LEGACY)
                        cpumask_setall(cfg[i].domain);
        }
+
+       return 0;
 }
 
 #ifdef CONFIG_SPARSE_IRQ
@@ -212,11 +213,11 @@ static struct irq_cfg *get_one_free_irq_cfg(int cpu)
 
        cfg = kzalloc_node(sizeof(*cfg), GFP_ATOMIC, node);
        if (cfg) {
-               /* FIXME: needs alloc_cpumask_var_node() */
-               if (!alloc_cpumask_var(&cfg->domain, GFP_ATOMIC)) {
+               if (!alloc_cpumask_var_node(&cfg->domain, GFP_ATOMIC, node)) {
                        kfree(cfg);
                        cfg = NULL;
-               } else if (!alloc_cpumask_var(&cfg->old_domain, GFP_ATOMIC)) {
+               } else if (!alloc_cpumask_var_node(&cfg->old_domain,
+                                                         GFP_ATOMIC, node)) {
                        free_cpumask_var(cfg->domain);
                        kfree(cfg);
                        cfg = NULL;
@@ -225,12 +226,11 @@ static struct irq_cfg *get_one_free_irq_cfg(int cpu)
                        cpumask_clear(cfg->old_domain);
                }
        }
-       printk(KERN_DEBUG "  alloc irq_cfg on cpu %d node %d\n", cpu, node);
 
        return cfg;
 }
 
-void arch_init_chip_data(struct irq_desc *desc, int cpu)
+int arch_init_chip_data(struct irq_desc *desc, int cpu)
 {
        struct irq_cfg *cfg;
 
@@ -242,6 +242,8 @@ void arch_init_chip_data(struct irq_desc *desc, int cpu)
                        BUG_ON(1);
                }
        }
+
+       return 0;
 }
 
 #ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC
@@ -702,7 +704,7 @@ static void __unmask_IO_APIC_irq(struct irq_cfg *cfg)
 }
 
 #ifdef CONFIG_X86_64
-void io_apic_sync(struct irq_pin_list *entry)
+static void io_apic_sync(struct irq_pin_list *entry)
 {
        /*
         * Synchronize the IO-APIC and the CPU by doing
@@ -1326,13 +1328,10 @@ next:
                }
                if (unlikely(current_vector == vector))
                        continue;
-#ifdef CONFIG_X86_64
-               if (vector == IA32_SYSCALL_VECTOR)
-                       goto next;
-#else
-               if (vector == SYSCALL_VECTOR)
+
+               if (test_bit(vector, used_vectors))
                        goto next;
-#endif
+
                for_each_cpu_and(new_cpu, tmp_mask, cpu_online_mask)
                        if (per_cpu(vector_irq, new_cpu)[vector] != -1)
                                goto next;
@@ -1403,8 +1402,6 @@ void __setup_vector_irq(int cpu)
 
        /* Mark the inuse vectors */
        for_each_irq_desc(irq, desc) {
-               if (!desc)
-                       continue;
                cfg = desc->chip_data;
                if (!cpumask_test_cpu(cpu, cfg->domain))
                        continue;
@@ -1786,8 +1783,6 @@ __apicdebuginit(void) print_IO_APIC(void)
        for_each_irq_desc(irq, desc) {
                struct irq_pin_list *entry;
 
-               if (!desc)
-                       continue;
                cfg = desc->chip_data;
                entry = cfg->irq_2_pin;
                if (!entry)
@@ -2428,9 +2423,6 @@ static void ir_irq_migration(struct work_struct *work)
        struct irq_desc *desc;
 
        for_each_irq_desc(irq, desc) {
-               if (!desc)
-                       continue;
-
                if (desc->status & IRQ_MOVE_PENDING) {
                        unsigned long flags;
 
@@ -2475,10 +2467,9 @@ static void set_ir_ioapic_affinity_irq(unsigned int irq,
 asmlinkage void smp_irq_move_cleanup_interrupt(void)
 {
        unsigned vector, me;
+
        ack_APIC_irq();
-#ifdef CONFIG_X86_64
        exit_idle();
-#endif
        irq_enter();
 
        me = smp_processor_id();
@@ -2523,7 +2514,7 @@ static void irq_complete_move(struct irq_desc **descp)
                if (likely(!cfg->move_desc_pending))
                        return;
 
-               /* domain is not change, but affinity is changed */
+               /* domain has not changed, but affinity did */
                me = smp_processor_id();
                if (cpu_isset(me, desc->affinity)) {
                        *descp = desc = move_irq_desc(desc, me);
@@ -2717,9 +2708,6 @@ static inline void init_IO_APIC_traps(void)
         * 0x80, because int 0x80 is hm, kind of importantish. ;)
         */
        for_each_irq_desc(irq, desc) {
-               if (!desc)
-                       continue;
-
                cfg = desc->chip_data;
                if (IO_APIC_IRQ(irq) && cfg && !cfg->vector) {
                        /*
@@ -3270,6 +3258,9 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms
        int err;
        unsigned dest;
 
+       if (disable_apic)
+               return -ENXIO;
+
        cfg = irq_cfg(irq);
        err = assign_irq_vector(irq, cfg, TARGET_CPUS);
        if (err)
@@ -3360,7 +3351,7 @@ static void
 ir_set_msi_irq_affinity(unsigned int irq, const struct cpumask *mask)
 {
        struct irq_desc *desc = irq_to_desc(irq);
-       struct irq_cfg *cfg;
+       struct irq_cfg *cfg = desc->chip_data;
        unsigned int dest;
        struct irte irte;
 
@@ -3738,6 +3729,9 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
        struct irq_cfg *cfg;
        int err;
 
+       if (disable_apic)
+               return -ENXIO;
+
        cfg = irq_cfg(irq);
        err = assign_irq_vector(irq, cfg, TARGET_CPUS);
        if (!err) {