diff options
author | Keir Fraser <keir@xen.org> | 2012-03-30 10:01:15 +0100 |
---|---|---|
committer | Keir Fraser <keir@xen.org> | 2012-03-30 10:01:15 +0100 |
commit | 8db87324fc94e93bc84b7fcd94ba678acb9ea4b9 (patch) | |
tree | 7136fc628a85fd2dd6790f4b218dee3fbafee67c /xen/arch/x86 | |
parent | bdc31d56d83d9de76dd501d33b90d59cf583b630 (diff) | |
download | xen-8db87324fc94e93bc84b7fcd94ba678acb9ea4b9.tar.gz xen-8db87324fc94e93bc84b7fcd94ba678acb9ea4b9.tar.bz2 xen-8db87324fc94e93bc84b7fcd94ba678acb9ea4b9.zip |
x86: Unify direct-apic and hiprio irq vector allocations.
Signed-off-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/arch/x86')
-rw-r--r-- | xen/arch/x86/i8259.c | 2 | ||||
-rw-r--r-- | xen/arch/x86/io_apic.c | 2 | ||||
-rw-r--r-- | xen/arch/x86/irq.c | 14 | ||||
-rw-r--r-- | xen/arch/x86/smpboot.c | 9 |
4 files changed, 17 insertions, 10 deletions
diff --git a/xen/arch/x86/i8259.c b/xen/arch/x86/i8259.c index 3c7fca28f5..ee291d3edf 100644 --- a/xen/arch/x86/i8259.c +++ b/xen/arch/x86/i8259.c @@ -402,7 +402,7 @@ void __init init_IRQ(void) desc->arch.vector = FIRST_LEGACY_VECTOR + irq; } - per_cpu(vector_irq, cpu)[FIRST_HIPRIORITY_VECTOR] = 0; + per_cpu(vector_irq, cpu)[IRQ0_VECTOR] = 0; apic_intr_init(); diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index 31f1541aea..72b32ce46b 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -1856,7 +1856,7 @@ static void __init check_timer(void) * get/set the timer IRQ vector: */ disable_8259A_irq(irq_to_desc(0)); - vector = FIRST_HIPRIORITY_VECTOR; + vector = IRQ0_VECTOR; clear_irq_vector(0); cpumask_setall(&mask_all); diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index 2e150bc05b..425af20387 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -764,6 +764,14 @@ void pirq_set_affinity(struct domain *d, int pirq, const cpumask_t *mask) DEFINE_PER_CPU(unsigned int, irq_count); +uint8_t alloc_hipriority_vector(void) +{ + static uint8_t next = FIRST_HIPRIORITY_VECTOR; + BUG_ON(next < FIRST_HIPRIORITY_VECTOR); + BUG_ON(next > LAST_HIPRIORITY_VECTOR); + return next++; +} + static void (*direct_apic_vector[NR_VECTORS])(struct cpu_user_regs *); void set_direct_apic_vector( uint8_t vector, void (*handler)(struct cpu_user_regs *)) @@ -775,14 +783,12 @@ void set_direct_apic_vector( void alloc_direct_apic_vector( uint8_t *vector, void (*handler)(struct cpu_user_regs *)) { - static uint8_t next = LAST_HIPRIORITY_VECTOR; static DEFINE_SPINLOCK(lock); spin_lock(&lock); if (*vector == 0) { - BUG_ON(next == FIRST_HIPRIORITY_VECTOR); - set_direct_apic_vector(next, handler); - *vector = next--; + *vector = alloc_hipriority_vector(); + set_direct_apic_vector(*vector, handler); } spin_unlock(&lock); } diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 41bc32fd1d..675ca45121 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -1005,13 +1005,13 @@ void __init smp_cpus_done(void) void __init smp_intr_init(void) { - int irq, seridx, cpu = smp_processor_id(); + int irq, vector, seridx, cpu = smp_processor_id(); /* * IRQ0 must be given a fixed assignment and initialized, * because it's used before the IO-APIC is set up. */ - irq_to_desc(0)->arch.vector = FIRST_HIPRIORITY_VECTOR; + irq_to_desc(0)->arch.vector = IRQ0_VECTOR; /* * Also ensure serial interrupts are high priority. We do not @@ -1021,8 +1021,9 @@ void __init smp_intr_init(void) { if ( (irq = serial_irq(seridx)) < 0 ) continue; - per_cpu(vector_irq, cpu)[FIRST_HIPRIORITY_VECTOR + seridx + 1] = irq; - irq_to_desc(irq)->arch.vector = FIRST_HIPRIORITY_VECTOR + seridx + 1; + vector = alloc_hipriority_vector(); + per_cpu(vector_irq, cpu)[vector] = irq; + irq_to_desc(irq)->arch.vector = vector; cpumask_copy(irq_to_desc(irq)->arch.cpu_mask, &cpu_online_map); } |