Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 30461
b: refs/heads/master
c: 0a1ad60
h: refs/heads/master
i:
  30459: bcd71cd
v: v3
  • Loading branch information
Jan Beulich authored and Linus Torvalds committed Jun 26, 2006
1 parent b52df2c commit a802b45
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a32073bffc656ca4bde6002b6cf7c1a8e0e22712
refs/heads/master: 0a1ad60d7a7eb433095bc1b2c8b475f3f278f61d
24 changes: 18 additions & 6 deletions trunk/arch/i386/kernel/io_apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ atomic_t irq_mis_count;
static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };

static DEFINE_SPINLOCK(ioapic_lock);
static DEFINE_SPINLOCK(vector_lock);

int timer_over_8254 __initdata = 1;

Expand Down Expand Up @@ -1161,27 +1162,38 @@ u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 };
int assign_irq_vector(int irq)
{
static int current_vector = FIRST_DEVICE_VECTOR, offset = 0;
int vector;

BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS);

spin_lock(&vector_lock);

BUG_ON(irq >= NR_IRQ_VECTORS);
if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0)
if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) {
spin_unlock(&vector_lock);
return IO_APIC_VECTOR(irq);
}
next:
current_vector += 8;
if (current_vector == SYSCALL_VECTOR)
goto next;

if (current_vector >= FIRST_SYSTEM_VECTOR) {
offset++;
if (!(offset%8))
if (!(offset%8)) {
spin_unlock(&vector_lock);
return -ENOSPC;
}
current_vector = FIRST_DEVICE_VECTOR + offset;
}

vector_irq[current_vector] = irq;
vector = current_vector;
vector_irq[vector] = irq;
if (irq != AUTO_ASSIGN)
IO_APIC_VECTOR(irq) = current_vector;
IO_APIC_VECTOR(irq) = vector;

spin_unlock(&vector_lock);

return current_vector;
return vector;
}

static struct hw_interrupt_type ioapic_level_type;
Expand Down
18 changes: 14 additions & 4 deletions trunk/arch/x86_64/kernel/io_apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ int timer_over_8254 __initdata = 0;
static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };

static DEFINE_SPINLOCK(ioapic_lock);
static DEFINE_SPINLOCK(vector_lock);

/*
* # of IRQ routing registers
Expand Down Expand Up @@ -834,10 +835,16 @@ u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 };
int assign_irq_vector(int irq)
{
static int current_vector = FIRST_DEVICE_VECTOR, offset = 0;
int vector;

BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS);
if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0)

spin_lock(&vector_lock);

if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) {
spin_unlock(&vector_lock);
return IO_APIC_VECTOR(irq);
}
next:
current_vector += 8;
if (current_vector == IA32_SYSCALL_VECTOR)
Expand All @@ -849,11 +856,14 @@ int assign_irq_vector(int irq)
current_vector = FIRST_DEVICE_VECTOR + offset;
}

vector_irq[current_vector] = irq;
vector = current_vector;
vector_irq[vector] = irq;
if (irq != AUTO_ASSIGN)
IO_APIC_VECTOR(irq) = current_vector;
IO_APIC_VECTOR(irq) = vector;

spin_unlock(&vector_lock);

return current_vector;
return vector;
}

extern void (*interrupt[NR_IRQS])(void);
Expand Down

0 comments on commit a802b45

Please sign in to comment.