Commit dbeb2be2 authored by Rusty Russell's avatar Rusty Russell Committed by Thomas Gleixner

i386: introduce "used_vectors" bitmap which can be used to reserve vectors.

This simplifies the io_apic.c __assign_irq_vector() logic and removes
the explicit SYSCALL_VECTOR check, and also allows for vectors to be
reserved by other mechanisms (ie. lguest).

[ tglx: arch/x86 adaptation ]
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 39743c9e
...@@ -403,7 +403,8 @@ void __init native_init_IRQ(void) ...@@ -403,7 +403,8 @@ void __init native_init_IRQ(void)
int vector = FIRST_EXTERNAL_VECTOR + i; int vector = FIRST_EXTERNAL_VECTOR + i;
if (i >= NR_IRQS) if (i >= NR_IRQS)
break; break;
if (vector != SYSCALL_VECTOR) /* SYSCALL_VECTOR was reserved in trap_init. */
if (!test_bit(vector, used_vectors))
set_intr_gate(vector, interrupt[i]); set_intr_gate(vector, interrupt[i]);
} }
......
...@@ -1198,7 +1198,7 @@ static u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 } ...@@ -1198,7 +1198,7 @@ static u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 }
static int __assign_irq_vector(int irq) static int __assign_irq_vector(int irq)
{ {
static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0; static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0;
int vector, offset, i; int vector, offset;
BUG_ON((unsigned)irq >= NR_IRQ_VECTORS); BUG_ON((unsigned)irq >= NR_IRQ_VECTORS);
...@@ -1215,11 +1215,8 @@ static int __assign_irq_vector(int irq) ...@@ -1215,11 +1215,8 @@ static int __assign_irq_vector(int irq)
} }
if (vector == current_vector) if (vector == current_vector)
return -ENOSPC; return -ENOSPC;
if (vector == SYSCALL_VECTOR) if (test_and_set_bit(vector, used_vectors))
goto next; goto next;
for (i = 0; i < NR_IRQ_VECTORS; i++)
if (irq_vector[i] == vector)
goto next;
current_vector = vector; current_vector = vector;
current_offset = offset; current_offset = offset;
...@@ -2295,6 +2292,12 @@ static inline void __init check_timer(void) ...@@ -2295,6 +2292,12 @@ static inline void __init check_timer(void)
void __init setup_IO_APIC(void) void __init setup_IO_APIC(void)
{ {
int i;
/* Reserve all the system vectors. */
for (i = FIRST_SYSTEM_VECTOR; i < NR_VECTORS; i++)
set_bit(i, used_vectors);
enable_IO_APIC(); enable_IO_APIC();
if (acpi_ioapic) if (acpi_ioapic)
......
...@@ -63,6 +63,9 @@ ...@@ -63,6 +63,9 @@
int panic_on_unrecovered_nmi; int panic_on_unrecovered_nmi;
DECLARE_BITMAP(used_vectors, NR_VECTORS);
EXPORT_SYMBOL_GPL(used_vectors);
asmlinkage int system_call(void); asmlinkage int system_call(void);
/* Do we ignore FPU interrupts ? */ /* Do we ignore FPU interrupts ? */
...@@ -1120,6 +1123,8 @@ static void __init set_task_gate(unsigned int n, unsigned int gdt_entry) ...@@ -1120,6 +1123,8 @@ static void __init set_task_gate(unsigned int n, unsigned int gdt_entry)
void __init trap_init(void) void __init trap_init(void)
{ {
int i;
#ifdef CONFIG_EISA #ifdef CONFIG_EISA
void __iomem *p = ioremap(0x0FFFD9, 4); void __iomem *p = ioremap(0x0FFFD9, 4);
if (readl(p) == 'E'+('I'<<8)+('S'<<16)+('A'<<24)) { if (readl(p) == 'E'+('I'<<8)+('S'<<16)+('A'<<24)) {
...@@ -1179,6 +1184,11 @@ void __init trap_init(void) ...@@ -1179,6 +1184,11 @@ void __init trap_init(void)
set_system_gate(SYSCALL_VECTOR,&system_call); set_system_gate(SYSCALL_VECTOR,&system_call);
/* Reserve all the builtin and the syscall vector. */
for (i = 0; i < FIRST_EXTERNAL_VECTOR; i++)
set_bit(i, used_vectors);
set_bit(SYSCALL_VECTOR, used_vectors);
/* /*
* Should be a barrier for any external CPU state. * Should be a barrier for any external CPU state.
*/ */
......
...@@ -45,4 +45,7 @@ unsigned int do_IRQ(struct pt_regs *regs); ...@@ -45,4 +45,7 @@ unsigned int do_IRQ(struct pt_regs *regs);
void init_IRQ(void); void init_IRQ(void);
void __init native_init_IRQ(void); void __init native_init_IRQ(void);
/* Interrupt vector management */
extern DECLARE_BITMAP(used_vectors, NR_VECTORS);
#endif /* _ASM_IRQ_H */ #endif /* _ASM_IRQ_H */
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