aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2006-10-04 02:16:39 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-04 07:55:27 -0700
commit3fc471ede99579211c44b6a64829c4318976990f (patch)
treeeb8fb39d32cebae5ac955e40ba1fd09e4c52ed85
parentb6cf2583ba026ca563ff8b15805fcf30b8e192a7 (diff)
downloadlinux-3fc471ede99579211c44b6a64829c4318976990f.tar.gz
[PATCH] genirq: i386 irq: Dynamic irq support
The current implementation of create_irq() is a hack but it is the current hack that msi.c uses, and unfortunately the ``generic'' apic msi ops depend on this hack. Thus we are stuck this hack of assuming irq == vector until the depencencies in the generic msi code are removed. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Rajesh Shah <rajesh.shah@intel.com> Cc: Andi Kleen <ak@muc.de> Cc: "Protasevich, Natalie" <Natalie.Protasevich@UNISYS.com> Cc: "Luck, Tony" <tony.luck@intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/i386/kernel/io_apic.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index b3b01894ca690f..fca689cfb0c9b5 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -2483,6 +2483,54 @@ static int __init ioapic_init_sysfs(void)
device_initcall(ioapic_init_sysfs);
+#ifdef CONFIG_PCI_MSI
+/*
+ * Dynamic irq allocate and deallocation for MSI
+ */
+int create_irq(void)
+{
+ /* Hack of the day: irq == vector.
+ *
+ * Ultimately this will be be more general,
+ * and not depend on the irq to vector identity mapping.
+ * But this version is needed until msi.c can cope with
+ * the more general form.
+ */
+ int irq, vector;
+ unsigned long flags;
+ vector = assign_irq_vector(AUTO_ASSIGN);
+ irq = vector;
+
+ if (vector >= 0) {
+ struct irq_desc *desc;
+
+ spin_lock_irqsave(&vector_lock, flags);
+ vector_irq[vector] = irq;
+ irq_vector[irq] = vector;
+ spin_unlock_irqrestore(&vector_lock, flags);
+
+ set_intr_gate(vector, interrupt[irq]);
+
+ dynamic_irq_init(irq);
+ }
+ return irq;
+}
+
+void destroy_irq(unsigned int irq)
+{
+ unsigned long flags;
+ unsigned int vector;
+
+ dynamic_irq_cleanup(irq);
+
+ spin_lock_irqsave(&vector_lock, flags);
+ vector = irq_vector[irq];
+ vector_irq[vector] = -1;
+ irq_vector[irq] = 0;
+ spin_unlock_irqrestore(&vector_lock, flags);
+}
+#endif /* CONFIG_PCI_MSI */
+
/* --------------------------------------------------------------------------
ACPI-based IOAPIC Configuration
-------------------------------------------------------------------------- */