]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/ia64/kernel/iosapic.c
[PATCH] bitops: ia64: use cpu_set() instead of __set_bit()
[linux-2.6-omap-h63xx.git] / arch / ia64 / kernel / iosapic.c
index 7936b62f7a2e323a0f1d5d4ee4c46a2894bf5682..8832c553230ae1681e051858afd6912cb6a289f7 100644 (file)
@@ -561,7 +561,7 @@ static inline int vector_is_shared (int vector)
        return (iosapic_intr_info[vector].count > 1);
 }
 
-static void
+static int
 register_intr (unsigned int gsi, int vector, unsigned char delivery,
               unsigned long polarity, unsigned long trigger)
 {
@@ -576,7 +576,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery,
        index = find_iosapic(gsi);
        if (index < 0) {
                printk(KERN_WARNING "%s: No IOSAPIC for GSI %u\n", __FUNCTION__, gsi);
-               return;
+               return -ENODEV;
        }
 
        iosapic_address = iosapic_lists[index].addr;
@@ -587,7 +587,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery,
                rte = iosapic_alloc_rte();
                if (!rte) {
                        printk(KERN_WARNING "%s: cannot allocate memory\n", __FUNCTION__);
-                       return;
+                       return -ENOMEM;
                }
 
                rte_index = gsi - gsi_base;
@@ -603,7 +603,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery,
                struct iosapic_intr_info *info = &iosapic_intr_info[vector];
                if (info->trigger != trigger || info->polarity != polarity) {
                        printk (KERN_WARNING "%s: cannot override the interrupt\n", __FUNCTION__);
-                       return;
+                       return -EINVAL;
                }
        }
 
@@ -623,6 +623,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery,
                               __FUNCTION__, vector, idesc->handler->typename, irq_type->typename);
                idesc->handler = irq_type;
        }
+       return 0;
 }
 
 static unsigned int
@@ -630,6 +631,7 @@ get_target_cpu (unsigned int gsi, int vector)
 {
 #ifdef CONFIG_SMP
        static int cpu = -1;
+       extern int cpe_vector;
 
        /*
         * In case of vector shared by multiple RTEs, all RTEs that
@@ -652,6 +654,11 @@ get_target_cpu (unsigned int gsi, int vector)
        if (!cpu_online(smp_processor_id()))
                return cpu_physical_id(smp_processor_id());
 
+#ifdef CONFIG_ACPI
+       if (cpe_vector > 0 && vector == IA64_CPEP_VECTOR)
+               return get_cpei_target_cpu();
+#endif
+
 #ifdef CONFIG_NUMA
        {
                int num_cpus, cpu_index, iosapic_index, numa_cpu, i = 0;
@@ -710,7 +717,7 @@ int
 iosapic_register_intr (unsigned int gsi,
                       unsigned long polarity, unsigned long trigger)
 {
-       int vector, mask = 1;
+       int vector, mask = 1, err;
        unsigned int dest;
        unsigned long flags;
        struct iosapic_rte_info *rte;
@@ -737,8 +744,8 @@ again:
        vector = assign_irq_vector(AUTO_ASSIGN);
        if (vector < 0) {
                vector = iosapic_find_sharable_vector(trigger, polarity);
-               if (vector < 0)
-                       panic("%s: out of interrupt vectors!\n", __FUNCTION__);
+               if (vector < 0)
+                       return -ENOSPC;
        }
 
        spin_lock_irqsave(&irq_descp(vector)->lock, flags);
@@ -753,8 +760,13 @@ again:
                }
 
                dest = get_target_cpu(gsi, vector);
-               register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY,
+               err = register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY,
                              polarity, trigger);
+               if (err < 0) {
+                       spin_unlock(&iosapic_lock);
+                       spin_unlock_irqrestore(&irq_descp(vector)->lock, flags);
+                       return err;
+               }
 
                /*
                 * If the vector is shared and already unmasked for
@@ -776,7 +788,6 @@ again:
        return vector;
 }
 
-#ifdef CONFIG_ACPI_DEALLOCATE_IRQ
 void
 iosapic_unregister_intr (unsigned int gsi)
 {
@@ -859,7 +870,6 @@ iosapic_unregister_intr (unsigned int gsi)
        spin_unlock(&iosapic_lock);
        spin_unlock_irqrestore(&idesc->lock, flags);
 }
-#endif /* CONFIG_ACPI_DEALLOCATE_IRQ */
 
 /*
  * ACPI calls this when it finds an entry for a platform interrupt.