diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2006-10-04 05:16:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-04 10:55:27 -0400 |
commit | 3fc471ede99579211c44b6a64829c4318976990f (patch) | |
tree | eb8fb39d32cebae5ac955e40ba1fd09e4c52ed85 /arch/i386/kernel/io_apic.c | |
parent | b6cf2583ba026ca563ff8b15805fcf30b8e192a7 (diff) |
[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>
Diffstat (limited to 'arch/i386/kernel/io_apic.c')
-rw-r--r-- | arch/i386/kernel/io_apic.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index b3b01894ca69..fca689cfb0c9 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) | |||
2483 | 2483 | ||
2484 | device_initcall(ioapic_init_sysfs); | 2484 | device_initcall(ioapic_init_sysfs); |
2485 | 2485 | ||
2486 | #ifdef CONFIG_PCI_MSI | ||
2487 | /* | ||
2488 | * Dynamic irq allocate and deallocation for MSI | ||
2489 | */ | ||
2490 | int create_irq(void) | ||
2491 | { | ||
2492 | /* Hack of the day: irq == vector. | ||
2493 | * | ||
2494 | * Ultimately this will be be more general, | ||
2495 | * and not depend on the irq to vector identity mapping. | ||
2496 | * But this version is needed until msi.c can cope with | ||
2497 | * the more general form. | ||
2498 | */ | ||
2499 | int irq, vector; | ||
2500 | unsigned long flags; | ||
2501 | vector = assign_irq_vector(AUTO_ASSIGN); | ||
2502 | irq = vector; | ||
2503 | |||
2504 | if (vector >= 0) { | ||
2505 | struct irq_desc *desc; | ||
2506 | |||
2507 | spin_lock_irqsave(&vector_lock, flags); | ||
2508 | vector_irq[vector] = irq; | ||
2509 | irq_vector[irq] = vector; | ||
2510 | spin_unlock_irqrestore(&vector_lock, flags); | ||
2511 | |||
2512 | set_intr_gate(vector, interrupt[irq]); | ||
2513 | |||
2514 | dynamic_irq_init(irq); | ||
2515 | } | ||
2516 | return irq; | ||
2517 | } | ||
2518 | |||
2519 | void destroy_irq(unsigned int irq) | ||
2520 | { | ||
2521 | unsigned long flags; | ||
2522 | unsigned int vector; | ||
2523 | |||
2524 | dynamic_irq_cleanup(irq); | ||
2525 | |||
2526 | spin_lock_irqsave(&vector_lock, flags); | ||
2527 | vector = irq_vector[irq]; | ||
2528 | vector_irq[vector] = -1; | ||
2529 | irq_vector[irq] = 0; | ||
2530 | spin_unlock_irqrestore(&vector_lock, flags); | ||
2531 | } | ||
2532 | #endif /* CONFIG_PCI_MSI */ | ||
2533 | |||
2486 | /* -------------------------------------------------------------------------- | 2534 | /* -------------------------------------------------------------------------- |
2487 | ACPI-based IOAPIC Configuration | 2535 | ACPI-based IOAPIC Configuration |
2488 | -------------------------------------------------------------------------- */ | 2536 | -------------------------------------------------------------------------- */ |