From bdc31d56d83d9de76dd501d33b90d59cf583b630 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 30 Mar 2012 09:14:25 +0100 Subject: x86: Allow direct vectored interrupts to be dynamically allocated. Use this for Intel's CMCI and thermal interrupts. Signed-off-by: Keir Fraser --- xen/arch/x86/irq.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'xen/arch/x86/irq.c') 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; -- cgit v1.2.3