Commit e500f574 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Linus Torvalds

[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: default avatarEric 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: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 23d0b8b0
...@@ -43,17 +43,10 @@ ...@@ -43,17 +43,10 @@
BI(x,8) BI(x,9) BI(x,a) BI(x,b) \ BI(x,8) BI(x,9) BI(x,a) BI(x,b) \
BI(x,c) BI(x,d) BI(x,e) BI(x,f) BI(x,c) BI(x,d) BI(x,e) BI(x,f)
#define BUILD_15_IRQS(x) \
BI(x,0) BI(x,1) BI(x,2) BI(x,3) \
BI(x,4) BI(x,5) BI(x,6) BI(x,7) \
BI(x,8) BI(x,9) BI(x,a) BI(x,b) \
BI(x,c) BI(x,d) BI(x,e)
/* /*
* ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts: * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:
* (these are usually mapped to vectors 0x20-0x2f) * (these are usually mapped to vectors 0x20-0x2f)
*/ */
BUILD_16_IRQS(0x0)
/* /*
* The IO-APIC gives us many more interrupt sources. Most of these * The IO-APIC gives us many more interrupt sources. Most of these
...@@ -65,17 +58,12 @@ BUILD_16_IRQS(0x0) ...@@ -65,17 +58,12 @@ BUILD_16_IRQS(0x0)
* *
* (these are usually mapped into the 0x30-0xff vector range) * (these are usually mapped into the 0x30-0xff vector range)
*/ */
BUILD_16_IRQS(0x1) BUILD_16_IRQS(0x2) BUILD_16_IRQS(0x3) BUILD_16_IRQS(0x2) BUILD_16_IRQS(0x3)
BUILD_16_IRQS(0x4) BUILD_16_IRQS(0x5) BUILD_16_IRQS(0x6) BUILD_16_IRQS(0x7) BUILD_16_IRQS(0x4) BUILD_16_IRQS(0x5) BUILD_16_IRQS(0x6) BUILD_16_IRQS(0x7)
BUILD_16_IRQS(0x8) BUILD_16_IRQS(0x9) BUILD_16_IRQS(0xa) BUILD_16_IRQS(0xb) BUILD_16_IRQS(0x8) BUILD_16_IRQS(0x9) BUILD_16_IRQS(0xa) BUILD_16_IRQS(0xb)
BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd) BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd) BUILD_16_IRQS(0xe) BUILD_16_IRQS(0xf)
#ifdef CONFIG_PCI_MSI
BUILD_15_IRQS(0xe)
#endif
#undef BUILD_16_IRQS #undef BUILD_16_IRQS
#undef BUILD_15_IRQS
#undef BI #undef BI
...@@ -88,29 +76,15 @@ BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd) ...@@ -88,29 +76,15 @@ BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd)
IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \ IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \
IRQ(x,c), IRQ(x,d), IRQ(x,e), IRQ(x,f) IRQ(x,c), IRQ(x,d), IRQ(x,e), IRQ(x,f)
#define IRQLIST_15(x) \
IRQ(x,0), IRQ(x,1), IRQ(x,2), IRQ(x,3), \
IRQ(x,4), IRQ(x,5), IRQ(x,6), IRQ(x,7), \
IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \
IRQ(x,c), IRQ(x,d), IRQ(x,e)
void (*interrupt[NR_IRQS])(void) = { void (*interrupt[NR_IRQS])(void) = {
IRQLIST_16(0x0), IRQLIST_16(0x2), IRQLIST_16(0x3),
IRQLIST_16(0x1), IRQLIST_16(0x2), IRQLIST_16(0x3),
IRQLIST_16(0x4), IRQLIST_16(0x5), IRQLIST_16(0x6), IRQLIST_16(0x7), IRQLIST_16(0x4), IRQLIST_16(0x5), IRQLIST_16(0x6), IRQLIST_16(0x7),
IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb), IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb),
IRQLIST_16(0xc), IRQLIST_16(0xd) IRQLIST_16(0xc), IRQLIST_16(0xd), IRQLIST_16(0xe), IRQLIST_16(0xf)
#ifdef CONFIG_PCI_MSI
, IRQLIST_15(0xe)
#endif
}; };
#undef IRQ #undef IRQ
#undef IRQLIST_16 #undef IRQLIST_16
#undef IRQLIST_14
/* /*
* This is the 'legacy' 8259A Programmable Interrupt Controller, * This is the 'legacy' 8259A Programmable Interrupt Controller,
...@@ -420,6 +394,26 @@ device_initcall(i8259A_init_sysfs); ...@@ -420,6 +394,26 @@ device_initcall(i8259A_init_sysfs);
*/ */
static struct irqaction irq2 = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL}; static struct irqaction irq2 = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL};
int vector_irq[NR_VECTORS] __read_mostly = {
[0 ... FIRST_EXTERNAL_VECTOR - 1] = -1,
[FIRST_EXTERNAL_VECTOR + 0] = 0,
[FIRST_EXTERNAL_VECTOR + 1] = 1,
[FIRST_EXTERNAL_VECTOR + 2] = 2,
[FIRST_EXTERNAL_VECTOR + 3] = 3,
[FIRST_EXTERNAL_VECTOR + 4] = 4,
[FIRST_EXTERNAL_VECTOR + 5] = 5,
[FIRST_EXTERNAL_VECTOR + 6] = 6,
[FIRST_EXTERNAL_VECTOR + 7] = 7,
[FIRST_EXTERNAL_VECTOR + 8] = 8,
[FIRST_EXTERNAL_VECTOR + 9] = 9,
[FIRST_EXTERNAL_VECTOR + 10] = 10,
[FIRST_EXTERNAL_VECTOR + 11] = 11,
[FIRST_EXTERNAL_VECTOR + 12] = 12,
[FIRST_EXTERNAL_VECTOR + 13] = 13,
[FIRST_EXTERNAL_VECTOR + 14] = 14,
[FIRST_EXTERNAL_VECTOR + 15] = 15,
[FIRST_EXTERNAL_VECTOR + 16 ... NR_VECTORS - 1] = -1
};
void __init init_ISA_irqs (void) void __init init_ISA_irqs (void)
{ {
...@@ -517,8 +511,6 @@ void __init init_IRQ(void) ...@@ -517,8 +511,6 @@ void __init init_IRQ(void)
*/ */
for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) { for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
int vector = FIRST_EXTERNAL_VECTOR + i; int vector = FIRST_EXTERNAL_VECTOR + i;
if (i >= NR_IRQS)
break;
if (vector != IA32_SYSCALL_VECTOR) if (vector != IA32_SYSCALL_VECTOR)
set_intr_gate(vector, interrupt[i]); set_intr_gate(vector, interrupt[i]);
} }
...@@ -528,7 +520,7 @@ void __init init_IRQ(void) ...@@ -528,7 +520,7 @@ void __init init_IRQ(void)
* IRQ0 must be given a fixed assignment and initialized, * IRQ0 must be given a fixed assignment and initialized,
* because it's used before the IO-APIC is set up. * because it's used before the IO-APIC is set up.
*/ */
set_intr_gate(FIRST_DEVICE_VECTOR, interrupt[0]); vector_irq[FIRST_DEVICE_VECTOR] = 0;
/* /*
* The reschedule interrupt is a CPU-to-CPU reschedule-helper * The reschedule interrupt is a CPU-to-CPU reschedule-helper
......
...@@ -615,6 +615,7 @@ next: ...@@ -615,6 +615,7 @@ next:
} }
vector = current_vector; vector = current_vector;
vector_irq[vector] = irq;
IO_APIC_VECTOR(irq) = vector; IO_APIC_VECTOR(irq) = vector;
return vector; return vector;
...@@ -649,7 +650,6 @@ static void ioapic_register_intr(int irq, int vector, unsigned long trigger) ...@@ -649,7 +650,6 @@ static void ioapic_register_intr(int irq, int vector, unsigned long trigger)
else else
set_irq_chip_and_handler(irq, &ioapic_chip, set_irq_chip_and_handler(irq, &ioapic_chip,
handle_edge_irq); handle_edge_irq);
set_intr_gate(vector, interrupt[irq]);
} }
static void __init setup_IO_APIC_irqs(void) static void __init setup_IO_APIC_irqs(void)
...@@ -1420,7 +1420,6 @@ static inline void check_timer(void) ...@@ -1420,7 +1420,6 @@ static inline void check_timer(void)
*/ */
disable_8259A_irq(0); disable_8259A_irq(0);
vector = assign_irq_vector(0); vector = assign_irq_vector(0);
set_intr_gate(vector, interrupt[0]);
/* /*
* Subtle, code in do_timer_interrupt() expects an AEOI * Subtle, code in do_timer_interrupt() expects an AEOI
...@@ -1671,7 +1670,6 @@ int create_irq(void) ...@@ -1671,7 +1670,6 @@ int create_irq(void)
spin_unlock_irqrestore(&vector_lock, flags); spin_unlock_irqrestore(&vector_lock, flags);
if (irq >= 0) { if (irq >= 0) {
set_intr_gate(vector, interrupt[irq]);
dynamic_irq_init(irq); dynamic_irq_init(irq);
} }
return irq; return irq;
......
...@@ -105,7 +105,12 @@ skip: ...@@ -105,7 +105,12 @@ skip:
asmlinkage unsigned int do_IRQ(struct pt_regs *regs) asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
{ {
/* high bit used in ret_from_ code */ /* high bit used in ret_from_ code */
unsigned irq = ~regs->orig_rax; unsigned vector = ~regs->orig_rax;
unsigned irq;
exit_idle();
irq_enter();
irq = vector_irq[vector];
if (unlikely(irq >= NR_IRQS)) { if (unlikely(irq >= NR_IRQS)) {
printk(KERN_EMERG "%s: cannot handle IRQ %d\n", printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
...@@ -113,8 +118,6 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs) ...@@ -113,8 +118,6 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
BUG(); BUG();
} }
exit_idle();
irq_enter();
#ifdef CONFIG_DEBUG_STACKOVERFLOW #ifdef CONFIG_DEBUG_STACKOVERFLOW
stack_overflow_check(regs); stack_overflow_check(regs);
#endif #endif
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
extern u8 irq_vector[NR_IRQ_VECTORS]; extern u8 irq_vector[NR_IRQ_VECTORS];
extern int vector_irq[NR_VECTORS];
#define IO_APIC_VECTOR(irq) (irq_vector[irq]) #define IO_APIC_VECTOR(irq) (irq_vector[irq])
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment