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/irq.c | |
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/irq.c')
-rw-r--r-- | xen/arch/x86/irq.c | 14 |
1 files changed, 10 insertions, 4 deletions
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); } |