diff options
author | Keir Fraser <keir@xen.org> | 2012-03-30 09:14:25 +0100 |
---|---|---|
committer | Keir Fraser <keir@xen.org> | 2012-03-30 09:14:25 +0100 |
commit | bdc31d56d83d9de76dd501d33b90d59cf583b630 (patch) | |
tree | 315b3748d94f9fbb40749b0c89a81b63dc19d63d /xen/arch/x86/irq.c | |
parent | 33c4b1044d00866e9b6d9362048fb194e76afb77 (diff) | |
download | xen-bdc31d56d83d9de76dd501d33b90d59cf583b630.tar.gz xen-bdc31d56d83d9de76dd501d33b90d59cf583b630.tar.bz2 xen-bdc31d56d83d9de76dd501d33b90d59cf583b630.zip |
x86: Allow direct vectored interrupts to be dynamically allocated.
Use this for Intel's CMCI and thermal interrupts.
Signed-off-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/arch/x86/irq.c')
-rw-r--r-- | xen/arch/x86/irq.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index ab5fd15556..2e150bc05b 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -772,6 +772,21 @@ void set_direct_apic_vector( direct_apic_vector[vector] = handler; } +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--; + } + spin_unlock(&lock); +} + void do_IRQ(struct cpu_user_regs *regs) { struct irqaction *action; |