[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86: Unify direct-apic and hiprio irq vector allocations.
# HG changeset patch # User Keir Fraser <keir@xxxxxxx> # Date 1333098075 -3600 # Node ID 6765a2510ee7ad899dcb87eefdf206f8c8ae34ae # Parent 14609be41f369c26e759c5d63cc0d2be2fc5b9b6 x86: Unify direct-apic and hiprio irq vector allocations. Signed-off-by: Keir Fraser <keir@xxxxxxx> --- diff -r 14609be41f36 -r 6765a2510ee7 xen/arch/x86/i8259.c --- a/xen/arch/x86/i8259.c Fri Mar 30 09:14:25 2012 +0100 +++ b/xen/arch/x86/i8259.c Fri Mar 30 10:01:15 2012 +0100 @@ -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 -r 14609be41f36 -r 6765a2510ee7 xen/arch/x86/io_apic.c --- a/xen/arch/x86/io_apic.c Fri Mar 30 09:14:25 2012 +0100 +++ b/xen/arch/x86/io_apic.c Fri Mar 30 10:01:15 2012 +0100 @@ -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 -r 14609be41f36 -r 6765a2510ee7 xen/arch/x86/irq.c --- a/xen/arch/x86/irq.c Fri Mar 30 09:14:25 2012 +0100 +++ b/xen/arch/x86/irq.c Fri Mar 30 10:01:15 2012 +0100 @@ -764,6 +764,14 @@ void pirq_set_affinity(struct domain *d, 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 -r 14609be41f36 -r 6765a2510ee7 xen/arch/x86/smpboot.c --- a/xen/arch/x86/smpboot.c Fri Mar 30 09:14:25 2012 +0100 +++ b/xen/arch/x86/smpboot.c Fri Mar 30 10:01:15 2012 +0100 @@ -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); } diff -r 14609be41f36 -r 6765a2510ee7 xen/include/asm-x86/irq.h --- a/xen/include/asm-x86/irq.h Fri Mar 30 09:14:25 2012 +0100 +++ b/xen/include/asm-x86/irq.h Fri Mar 30 10:01:15 2012 +0100 @@ -88,6 +88,8 @@ void pmu_apic_interrupt(struct cpu_user_ void spurious_interrupt(struct cpu_user_regs *regs); void irq_move_cleanup_interrupt(struct cpu_user_regs *regs); +uint8_t alloc_hipriority_vector(void); + void set_direct_apic_vector( uint8_t vector, void (*handler)(struct cpu_user_regs *)); void alloc_direct_apic_vector( diff -r 14609be41f36 -r 6765a2510ee7 xen/include/asm-x86/mach-default/irq_vectors.h --- a/xen/include/asm-x86/mach-default/irq_vectors.h Fri Mar 30 09:14:25 2012 +0100 +++ b/xen/include/asm-x86/mach-default/irq_vectors.h Fri Mar 30 10:01:15 2012 +0100 @@ -13,8 +13,10 @@ * High-priority dynamically-allocated vectors. For interrupts that * must be higher priority than any guest-bound interrupt. */ -#define FIRST_HIPRIORITY_VECTOR 0xf0 +#define FIRST_HIPRIORITY_VECTOR 0xf1 #define LAST_HIPRIORITY_VECTOR 0xf8 +/* IRQ0 (timer) is statically allocated but must be high priority. */ +#define IRQ0_VECTOR 0xf0 /* Legacy PIC uses vectors 0xe0-0xef. */ #define FIRST_LEGACY_VECTOR 0xe0 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |