aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2007-10-19 14:35:03 -0400
committerThomas Gleixner <tglx@linutronix.de>2007-10-19 14:35:03 -0400
commitdbeb2be21d678c49a8d8bbf774903df15dd55474 (patch)
treecea1b478ec3af36134aa06633be1a45787f35f75 /arch/x86
parent39743c9ef717fd4f2b5583f010115c5f2482b8ae (diff)
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: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/i8259_32.c3
-rw-r--r--arch/x86/kernel/io_apic_32.c13
-rw-r--r--arch/x86/kernel/traps_32.c10
3 files changed, 20 insertions, 6 deletions
diff --git a/arch/x86/kernel/i8259_32.c b/arch/x86/kernel/i8259_32.c
index d34a10cc13a7..f634fc715c99 100644
--- a/arch/x86/kernel/i8259_32.c
+++ b/arch/x86/kernel/i8259_32.c
@@ -403,7 +403,8 @@ void __init native_init_IRQ(void)
403 int vector = FIRST_EXTERNAL_VECTOR + i; 403 int vector = FIRST_EXTERNAL_VECTOR + i;
404 if (i >= NR_IRQS) 404 if (i >= NR_IRQS)
405 break; 405 break;
406 if (vector != SYSCALL_VECTOR) 406 /* SYSCALL_VECTOR was reserved in trap_init. */
407 if (!test_bit(vector, used_vectors))
407 set_intr_gate(vector, interrupt[i]); 408 set_intr_gate(vector, interrupt[i]);
408 } 409 }
409 410
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index 5f10c7189534..0c55e9d86f69 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -1198,7 +1198,7 @@ static u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 }
1198static int __assign_irq_vector(int irq) 1198static int __assign_irq_vector(int irq)
1199{ 1199{
1200 static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0; 1200 static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0;
1201 int vector, offset, i; 1201 int vector, offset;
1202 1202
1203 BUG_ON((unsigned)irq >= NR_IRQ_VECTORS); 1203 BUG_ON((unsigned)irq >= NR_IRQ_VECTORS);
1204 1204
@@ -1215,11 +1215,8 @@ next:
1215 } 1215 }
1216 if (vector == current_vector) 1216 if (vector == current_vector)
1217 return -ENOSPC; 1217 return -ENOSPC;
1218 if (vector == SYSCALL_VECTOR) 1218 if (test_and_set_bit(vector, used_vectors))
1219 goto next; 1219 goto next;
1220 for (i = 0; i < NR_IRQ_VECTORS; i++)
1221 if (irq_vector[i] == vector)
1222 goto next;
1223 1220
1224 current_vector = vector; 1221 current_vector = vector;
1225 current_offset = offset; 1222 current_offset = offset;
@@ -2295,6 +2292,12 @@ static inline void __init check_timer(void)
2295 2292
2296void __init setup_IO_APIC(void) 2293void __init setup_IO_APIC(void)
2297{ 2294{
2295 int i;
2296
2297 /* Reserve all the system vectors. */
2298 for (i = FIRST_SYSTEM_VECTOR; i < NR_VECTORS; i++)
2299 set_bit(i, used_vectors);
2300
2298 enable_IO_APIC(); 2301 enable_IO_APIC();
2299 2302
2300 if (acpi_ioapic) 2303 if (acpi_ioapic)
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index 3f02e0f42e6a..47e6d10902fe 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -63,6 +63,9 @@
63 63
64int panic_on_unrecovered_nmi; 64int panic_on_unrecovered_nmi;
65 65
66DECLARE_BITMAP(used_vectors, NR_VECTORS);
67EXPORT_SYMBOL_GPL(used_vectors);
68
66asmlinkage int system_call(void); 69asmlinkage int system_call(void);
67 70
68/* Do we ignore FPU interrupts ? */ 71/* Do we ignore FPU interrupts ? */
@@ -1120,6 +1123,8 @@ static void __init set_task_gate(unsigned int n, unsigned int gdt_entry)
1120 1123
1121void __init trap_init(void) 1124void __init trap_init(void)
1122{ 1125{
1126 int i;
1127
1123#ifdef CONFIG_EISA 1128#ifdef CONFIG_EISA
1124 void __iomem *p = ioremap(0x0FFFD9, 4); 1129 void __iomem *p = ioremap(0x0FFFD9, 4);
1125 if (readl(p) == 'E'+('I'<<8)+('S'<<16)+('A'<<24)) { 1130 if (readl(p) == 'E'+('I'<<8)+('S'<<16)+('A'<<24)) {
@@ -1179,6 +1184,11 @@ void __init trap_init(void)
1179 1184
1180 set_system_gate(SYSCALL_VECTOR,&system_call); 1185 set_system_gate(SYSCALL_VECTOR,&system_call);
1181 1186
1187 /* Reserve all the builtin and the syscall vector. */
1188 for (i = 0; i < FIRST_EXTERNAL_VECTOR; i++)
1189 set_bit(i, used_vectors);
1190 set_bit(SYSCALL_VECTOR, used_vectors);
1191
1182 /* 1192 /*
1183 * Should be a barrier for any external CPU state. 1193 * Should be a barrier for any external CPU state.
1184 */ 1194 */