diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2006-10-04 05:16:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-04 10:55:28 -0400 |
commit | e500f57436b9056a245216c53113613928155eba (patch) | |
tree | 2b93aae3dfbe82fd5387ec7e0cb5945951655d07 | |
parent | 23d0b8b053391afe15c9667d80de77ca88e18b8b (diff) |
[PATCH] genirq: x86_64 irq: Make the external irq handlers report their vector, not the irq number
This is a small pessimization but it paves the way for making this information
per cpu. Which allows the the maximum number of IRQS to become NR_CPUS*224.
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/x86_64/kernel/i8259.c | 58 | ||||
-rw-r--r-- | arch/x86_64/kernel/io_apic.c | 4 | ||||
-rw-r--r-- | arch/x86_64/kernel/irq.c | 9 | ||||
-rw-r--r-- | include/asm-x86_64/hw_irq.h | 1 |
4 files changed, 33 insertions, 39 deletions
diff --git a/arch/x86_64/kernel/i8259.c b/arch/x86_64/kernel/i8259.c index ae1101cd5252..bddde431871a 100644 --- a/arch/x86_64/kernel/i8259.c +++ b/arch/x86_64/kernel/i8259.c | |||
@@ -43,17 +43,10 @@ | |||
43 | BI(x,8) BI(x,9) BI(x,a) BI(x,b) \ | 43 | BI(x,8) BI(x,9) BI(x,a) BI(x,b) \ |
44 | BI(x,c) BI(x,d) BI(x,e) BI(x,f) | 44 | BI(x,c) BI(x,d) BI(x,e) BI(x,f) |
45 | 45 | ||
46 | #define BUILD_15_IRQS(x) \ | ||
47 | BI(x,0) BI(x,1) BI(x,2) BI(x,3) \ | ||
48 | BI(x,4) BI(x,5) BI(x,6) BI(x,7) \ | ||
49 | BI(x,8) BI(x,9) BI(x,a) BI(x,b) \ | ||
50 | BI(x,c) BI(x,d) BI(x,e) | ||
51 | |||
52 | /* | 46 | /* |
53 | * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts: | 47 | * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts: |
54 | * (these are usually mapped to vectors 0x20-0x2f) | 48 | * (these are usually mapped to vectors 0x20-0x2f) |
55 | */ | 49 | */ |
56 | BUILD_16_IRQS(0x0) | ||
57 | 50 | ||
58 | /* | 51 | /* |
59 | * The IO-APIC gives us many more interrupt sources. Most of these | 52 | * The IO-APIC gives us many more interrupt sources. Most of these |
@@ -65,17 +58,12 @@ BUILD_16_IRQS(0x0) | |||
65 | * | 58 | * |
66 | * (these are usually mapped into the 0x30-0xff vector range) | 59 | * (these are usually mapped into the 0x30-0xff vector range) |
67 | */ | 60 | */ |
68 | BUILD_16_IRQS(0x1) BUILD_16_IRQS(0x2) BUILD_16_IRQS(0x3) | 61 | BUILD_16_IRQS(0x2) BUILD_16_IRQS(0x3) |
69 | BUILD_16_IRQS(0x4) BUILD_16_IRQS(0x5) BUILD_16_IRQS(0x6) BUILD_16_IRQS(0x7) | 62 | BUILD_16_IRQS(0x4) BUILD_16_IRQS(0x5) BUILD_16_IRQS(0x6) BUILD_16_IRQS(0x7) |
70 | BUILD_16_IRQS(0x8) BUILD_16_IRQS(0x9) BUILD_16_IRQS(0xa) BUILD_16_IRQS(0xb) | 63 | BUILD_16_IRQS(0x8) BUILD_16_IRQS(0x9) BUILD_16_IRQS(0xa) BUILD_16_IRQS(0xb) |
71 | BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd) | 64 | BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd) BUILD_16_IRQS(0xe) BUILD_16_IRQS(0xf) |
72 | |||
73 | #ifdef CONFIG_PCI_MSI | ||
74 | BUILD_15_IRQS(0xe) | ||
75 | #endif | ||
76 | 65 | ||
77 | #undef BUILD_16_IRQS | 66 | #undef BUILD_16_IRQS |
78 | #undef BUILD_15_IRQS | ||
79 | #undef BI | 67 | #undef BI |
80 | 68 | ||
81 | 69 | ||
@@ -88,29 +76,15 @@ BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd) | |||
88 | IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \ | 76 | IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \ |
89 | IRQ(x,c), IRQ(x,d), IRQ(x,e), IRQ(x,f) | 77 | IRQ(x,c), IRQ(x,d), IRQ(x,e), IRQ(x,f) |
90 | 78 | ||
91 | #define IRQLIST_15(x) \ | ||
92 | IRQ(x,0), IRQ(x,1), IRQ(x,2), IRQ(x,3), \ | ||
93 | IRQ(x,4), IRQ(x,5), IRQ(x,6), IRQ(x,7), \ | ||
94 | IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \ | ||
95 | IRQ(x,c), IRQ(x,d), IRQ(x,e) | ||
96 | |||
97 | void (*interrupt[NR_IRQS])(void) = { | 79 | void (*interrupt[NR_IRQS])(void) = { |
98 | IRQLIST_16(0x0), | 80 | IRQLIST_16(0x2), IRQLIST_16(0x3), |
99 | |||
100 | IRQLIST_16(0x1), IRQLIST_16(0x2), IRQLIST_16(0x3), | ||
101 | IRQLIST_16(0x4), IRQLIST_16(0x5), IRQLIST_16(0x6), IRQLIST_16(0x7), | 81 | IRQLIST_16(0x4), IRQLIST_16(0x5), IRQLIST_16(0x6), IRQLIST_16(0x7), |
102 | IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb), | 82 | IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb), |
103 | IRQLIST_16(0xc), IRQLIST_16(0xd) | 83 | IRQLIST_16(0xc), IRQLIST_16(0xd), IRQLIST_16(0xe), IRQLIST_16(0xf) |
104 | |||
105 | #ifdef CONFIG_PCI_MSI | ||
106 | , IRQLIST_15(0xe) | ||
107 | #endif | ||
108 | |||
109 | }; | 84 | }; |
110 | 85 | ||
111 | #undef IRQ | 86 | #undef IRQ |
112 | #undef IRQLIST_16 | 87 | #undef IRQLIST_16 |
113 | #undef IRQLIST_14 | ||
114 | 88 | ||
115 | /* | 89 | /* |
116 | * This is the 'legacy' 8259A Programmable Interrupt Controller, | 90 | * This is the 'legacy' 8259A Programmable Interrupt Controller, |
@@ -420,6 +394,26 @@ device_initcall(i8259A_init_sysfs); | |||
420 | */ | 394 | */ |
421 | 395 | ||
422 | static struct irqaction irq2 = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL}; | 396 | static struct irqaction irq2 = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL}; |
397 | int vector_irq[NR_VECTORS] __read_mostly = { | ||
398 | [0 ... FIRST_EXTERNAL_VECTOR - 1] = -1, | ||
399 | [FIRST_EXTERNAL_VECTOR + 0] = 0, | ||
400 | [FIRST_EXTERNAL_VECTOR + 1] = 1, | ||
401 | [FIRST_EXTERNAL_VECTOR + 2] = 2, | ||
402 | [FIRST_EXTERNAL_VECTOR + 3] = 3, | ||
403 | [FIRST_EXTERNAL_VECTOR + 4] = 4, | ||
404 | [FIRST_EXTERNAL_VECTOR + 5] = 5, | ||
405 | [FIRST_EXTERNAL_VECTOR + 6] = 6, | ||
406 | [FIRST_EXTERNAL_VECTOR + 7] = 7, | ||
407 | [FIRST_EXTERNAL_VECTOR + 8] = 8, | ||
408 | [FIRST_EXTERNAL_VECTOR + 9] = 9, | ||
409 | [FIRST_EXTERNAL_VECTOR + 10] = 10, | ||
410 | [FIRST_EXTERNAL_VECTOR + 11] = 11, | ||
411 | [FIRST_EXTERNAL_VECTOR + 12] = 12, | ||
412 | [FIRST_EXTERNAL_VECTOR + 13] = 13, | ||
413 | [FIRST_EXTERNAL_VECTOR + 14] = 14, | ||
414 | [FIRST_EXTERNAL_VECTOR + 15] = 15, | ||
415 | [FIRST_EXTERNAL_VECTOR + 16 ... NR_VECTORS - 1] = -1 | ||
416 | }; | ||
423 | 417 | ||
424 | void __init init_ISA_irqs (void) | 418 | void __init init_ISA_irqs (void) |
425 | { | 419 | { |
@@ -517,8 +511,6 @@ void __init init_IRQ(void) | |||
517 | */ | 511 | */ |
518 | for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) { | 512 | for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) { |
519 | int vector = FIRST_EXTERNAL_VECTOR + i; | 513 | int vector = FIRST_EXTERNAL_VECTOR + i; |
520 | if (i >= NR_IRQS) | ||
521 | break; | ||
522 | if (vector != IA32_SYSCALL_VECTOR) | 514 | if (vector != IA32_SYSCALL_VECTOR) |
523 | set_intr_gate(vector, interrupt[i]); | 515 | set_intr_gate(vector, interrupt[i]); |
524 | } | 516 | } |
@@ -528,7 +520,7 @@ void __init init_IRQ(void) | |||
528 | * IRQ0 must be given a fixed assignment and initialized, | 520 | * IRQ0 must be given a fixed assignment and initialized, |
529 | * because it's used before the IO-APIC is set up. | 521 | * because it's used before the IO-APIC is set up. |
530 | */ | 522 | */ |
531 | set_intr_gate(FIRST_DEVICE_VECTOR, interrupt[0]); | 523 | vector_irq[FIRST_DEVICE_VECTOR] = 0; |
532 | 524 | ||
533 | /* | 525 | /* |
534 | * The reschedule interrupt is a CPU-to-CPU reschedule-helper | 526 | * The reschedule interrupt is a CPU-to-CPU reschedule-helper |
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c index bb16f3790f09..9f849492c296 100644 --- a/arch/x86_64/kernel/io_apic.c +++ b/arch/x86_64/kernel/io_apic.c | |||
@@ -615,6 +615,7 @@ next: | |||
615 | } | 615 | } |
616 | 616 | ||
617 | vector = current_vector; | 617 | vector = current_vector; |
618 | vector_irq[vector] = irq; | ||
618 | IO_APIC_VECTOR(irq) = vector; | 619 | IO_APIC_VECTOR(irq) = vector; |
619 | 620 | ||
620 | return vector; | 621 | return vector; |
@@ -649,7 +650,6 @@ static void ioapic_register_intr(int irq, int vector, unsigned long trigger) | |||
649 | else | 650 | else |
650 | set_irq_chip_and_handler(irq, &ioapic_chip, | 651 | set_irq_chip_and_handler(irq, &ioapic_chip, |
651 | handle_edge_irq); | 652 | handle_edge_irq); |
652 | set_intr_gate(vector, interrupt[irq]); | ||
653 | } | 653 | } |
654 | 654 | ||
655 | static void __init setup_IO_APIC_irqs(void) | 655 | static void __init setup_IO_APIC_irqs(void) |
@@ -1420,7 +1420,6 @@ static inline void check_timer(void) | |||
1420 | */ | 1420 | */ |
1421 | disable_8259A_irq(0); | 1421 | disable_8259A_irq(0); |
1422 | vector = assign_irq_vector(0); | 1422 | vector = assign_irq_vector(0); |
1423 | set_intr_gate(vector, interrupt[0]); | ||
1424 | 1423 | ||
1425 | /* | 1424 | /* |
1426 | * Subtle, code in do_timer_interrupt() expects an AEOI | 1425 | * Subtle, code in do_timer_interrupt() expects an AEOI |
@@ -1671,7 +1670,6 @@ int create_irq(void) | |||
1671 | spin_unlock_irqrestore(&vector_lock, flags); | 1670 | spin_unlock_irqrestore(&vector_lock, flags); |
1672 | 1671 | ||
1673 | if (irq >= 0) { | 1672 | if (irq >= 0) { |
1674 | set_intr_gate(vector, interrupt[irq]); | ||
1675 | dynamic_irq_init(irq); | 1673 | dynamic_irq_init(irq); |
1676 | } | 1674 | } |
1677 | return irq; | 1675 | return irq; |
diff --git a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c index 609f97153b88..4542fb031994 100644 --- a/arch/x86_64/kernel/irq.c +++ b/arch/x86_64/kernel/irq.c | |||
@@ -105,7 +105,12 @@ skip: | |||
105 | asmlinkage unsigned int do_IRQ(struct pt_regs *regs) | 105 | asmlinkage unsigned int do_IRQ(struct pt_regs *regs) |
106 | { | 106 | { |
107 | /* high bit used in ret_from_ code */ | 107 | /* high bit used in ret_from_ code */ |
108 | unsigned irq = ~regs->orig_rax; | 108 | unsigned vector = ~regs->orig_rax; |
109 | unsigned irq; | ||
110 | |||
111 | exit_idle(); | ||
112 | irq_enter(); | ||
113 | irq = vector_irq[vector]; | ||
109 | 114 | ||
110 | if (unlikely(irq >= NR_IRQS)) { | 115 | if (unlikely(irq >= NR_IRQS)) { |
111 | printk(KERN_EMERG "%s: cannot handle IRQ %d\n", | 116 | printk(KERN_EMERG "%s: cannot handle IRQ %d\n", |
@@ -113,8 +118,6 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs) | |||
113 | BUG(); | 118 | BUG(); |
114 | } | 119 | } |
115 | 120 | ||
116 | exit_idle(); | ||
117 | irq_enter(); | ||
118 | #ifdef CONFIG_DEBUG_STACKOVERFLOW | 121 | #ifdef CONFIG_DEBUG_STACKOVERFLOW |
119 | stack_overflow_check(regs); | 122 | stack_overflow_check(regs); |
120 | #endif | 123 | #endif |
diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h index 1a8dc185a79f..9f6a0bfed727 100644 --- a/include/asm-x86_64/hw_irq.h +++ b/include/asm-x86_64/hw_irq.h | |||
@@ -74,6 +74,7 @@ | |||
74 | 74 | ||
75 | #ifndef __ASSEMBLY__ | 75 | #ifndef __ASSEMBLY__ |
76 | extern u8 irq_vector[NR_IRQ_VECTORS]; | 76 | extern u8 irq_vector[NR_IRQ_VECTORS]; |
77 | extern int vector_irq[NR_VECTORS]; | ||
77 | #define IO_APIC_VECTOR(irq) (irq_vector[irq]) | 78 | #define IO_APIC_VECTOR(irq) (irq_vector[irq]) |
78 | 79 | ||
79 | /* | 80 | /* |