ia64/xen-unstable

changeset 19184:e15d25401309

Revert 19178:4fcf4c9c9751ccb8ed

Breaks boot on every box under the sun it seems.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Feb 09 12:46:26 2009 +0000 (2009-02-09)
parents 57e98fc0d956
children 54492bf232f7
files xen/arch/x86/io_apic.c xen/arch/x86/irq.c xen/arch/x86/smpboot.c xen/include/asm-x86/irq.h
line diff
     1.1 --- a/xen/arch/x86/io_apic.c	Fri Feb 06 11:18:45 2009 +0000
     1.2 +++ b/xen/arch/x86/io_apic.c	Mon Feb 09 12:46:26 2009 +0000
     1.3 @@ -39,10 +39,6 @@
     1.4  #include <io_ports.h>
     1.5  #include <public/physdev.h>
     1.6  
     1.7 -
     1.8 -#define IO_APIC_IRQ(irq)    (!IS_LEGACY_IRQ(irq))
     1.9 -#define IO_APIC_VECTOR(irq) (ioapic_irq_vector[irq])
    1.10 -
    1.11  /* Different to Linux: our implementation can be simpler. */
    1.12  #define make_8259A_irq(irq) (io_apic_irqs &= ~(1<<(irq)))
    1.13  
    1.14 @@ -666,8 +662,8 @@ static inline int IO_APIC_irq_trigger(in
    1.15      return 0;
    1.16  }
    1.17  
    1.18 -/* irq vectors are indexed by the sum of all RTEs in all I/O APICs. */
    1.19 -u8 ioapic_irq_vector[NR_IRQS] __read_mostly;
    1.20 +/* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */
    1.21 +u8 irq_vector[NR_IRQS] __read_mostly;
    1.22  
    1.23  static struct hw_interrupt_type ioapic_level_type;
    1.24  static struct hw_interrupt_type ioapic_edge_type;
    1.25 @@ -744,7 +740,6 @@ static void __init setup_IO_APIC_irqs(vo
    1.26  
    1.27              if (IO_APIC_IRQ(irq)) {
    1.28                  vector = assign_irq_vector(irq);
    1.29 -                ioapic_irq_vector[irq] = vector;
    1.30                  entry.vector = vector;
    1.31                  ioapic_register_intr(irq, vector, IOAPIC_AUTO);
    1.32  		
    1.33 @@ -938,9 +933,9 @@ void /*__init*/ __print_IO_APIC(void)
    1.34          struct irq_pin_list *entry = irq_2_pin + i;
    1.35          if (entry->pin < 0)
    1.36              continue;
    1.37 -        printk(KERN_DEBUG "IRQ%-3d (vec %3d)", i, IO_APIC_VECTOR(i));
    1.38 +        printk(KERN_DEBUG "IRQ%d ", IO_APIC_VECTOR(i));
    1.39          for (;;) {
    1.40 -            printk(" -> %d:%d", entry->apic, entry->pin);
    1.41 +            printk("-> %d:%d", entry->apic, entry->pin);
    1.42              if (!entry->next)
    1.43                  break;
    1.44              entry = irq_2_pin + entry->next;
    1.45 @@ -1667,7 +1662,6 @@ static inline void check_timer(void)
    1.46       */
    1.47      disable_8259A_irq(0);
    1.48      vector = assign_irq_vector(0);
    1.49 -    ioapic_irq_vector[0] = vector;
    1.50  
    1.51      irq_desc[IO_APIC_VECTOR(0)].action = irq_desc[LEGACY_VECTOR(0)].action;
    1.52      irq_desc[IO_APIC_VECTOR(0)].depth  = 0;
    1.53 @@ -2025,7 +2019,6 @@ int io_apic_set_pci_routing (int ioapic,
    1.54          add_pin_to_irq(irq, ioapic, pin);
    1.55  
    1.56      entry.vector = assign_irq_vector(irq);
    1.57 -    ioapic_irq_vector[irq] = entry.vector;
    1.58  
    1.59      apic_printk(APIC_DEBUG, KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry "
    1.60  		"(%d-%d -> 0x%x -> IRQ %d Mode:%i Active:%i)\n", ioapic,
     2.1 --- a/xen/arch/x86/irq.c	Fri Feb 06 11:18:45 2009 +0000
     2.2 +++ b/xen/arch/x86/irq.c	Mon Feb 09 12:46:26 2009 +0000
     2.3 @@ -82,9 +82,9 @@ int assign_irq_vector(int irq)
     2.4  
     2.5      spin_lock(&vector_lock);
     2.6  
     2.7 -    if ((irq != AUTO_ASSIGN) && (ioapic_irq_vector[irq] > 0)) {
     2.8 +    if ((irq != AUTO_ASSIGN) && (IO_APIC_VECTOR(irq) > 0)) {
     2.9          spin_unlock(&vector_lock);
    2.10 -        return ioapic_irq_vector[irq];
    2.11 +        return IO_APIC_VECTOR(irq);
    2.12      }
    2.13  
    2.14      vector = current_vector;
    2.15 @@ -101,6 +101,8 @@ int assign_irq_vector(int irq)
    2.16  
    2.17      current_vector = vector;
    2.18      vector_irq[vector] = irq;
    2.19 +    if (irq != AUTO_ASSIGN)
    2.20 +        IO_APIC_VECTOR(irq) = vector;
    2.21  
    2.22      spin_unlock(&vector_lock);
    2.23  
     3.1 --- a/xen/arch/x86/smpboot.c	Fri Feb 06 11:18:45 2009 +0000
     3.2 +++ b/xen/arch/x86/smpboot.c	Mon Feb 09 12:46:26 2009 +0000
     3.3 @@ -1477,6 +1477,7 @@ void __init smp_intr_init(void)
     3.4  	 * IRQ0 must be given a fixed assignment and initialized,
     3.5  	 * because it's used before the IO-APIC is set up.
     3.6  	 */
     3.7 +	irq_vector[0] = FIRST_HIPRIORITY_VECTOR;
     3.8  	vector_irq[FIRST_HIPRIORITY_VECTOR] = 0;
     3.9  
    3.10  	/*
    3.11 @@ -1486,6 +1487,7 @@ void __init smp_intr_init(void)
    3.12  	for (seridx = 0; seridx < 2; seridx++) {
    3.13  		if ((irq = serial_irq(seridx)) < 0)
    3.14  			continue;
    3.15 +		irq_vector[irq] = FIRST_HIPRIORITY_VECTOR + seridx + 1;
    3.16  		vector_irq[FIRST_HIPRIORITY_VECTOR + seridx + 1] = irq;
    3.17  	}
    3.18  
     4.1 --- a/xen/include/asm-x86/irq.h	Fri Feb 06 11:18:45 2009 +0000
     4.2 +++ b/xen/include/asm-x86/irq.h	Mon Feb 09 12:46:26 2009 +0000
     4.3 @@ -7,20 +7,21 @@
     4.4  #include <asm/atomic.h>
     4.5  #include <irq_vectors.h>
     4.6  
     4.7 -#define IS_LEGACY_IRQ(irq) (((irq) < 16) && !((1 << (irq)) & io_apic_irqs))
     4.8 +#define IO_APIC_IRQ(irq)    (((irq) >= 16) || ((1<<(irq)) & io_apic_irqs))
     4.9 +#define IO_APIC_VECTOR(irq) (irq_vector[irq])
    4.10 +
    4.11  #define LEGACY_VECTOR(irq)          ((irq) + FIRST_LEGACY_VECTOR)
    4.12  #define LEGACY_IRQ_FROM_VECTOR(vec) ((vec) - FIRST_LEGACY_VECTOR)
    4.13  
    4.14 -/* Special IRQ numbers */
    4.15 +#define irq_to_vector(irq)  \
    4.16 +    (IO_APIC_IRQ(irq) ? IO_APIC_VECTOR(irq) : LEGACY_VECTOR(irq))
    4.17 +#define vector_to_irq(vec)  (vector_irq[vec])
    4.18 +
    4.19 +extern int vector_irq[NR_VECTORS];
    4.20 +extern u8 irq_vector[NR_IRQS];
    4.21  #define AUTO_ASSIGN    -1
    4.22  #define NEVER_ASSIGN   -2
    4.23  #define FREE_TO_ASSIGN -3
    4.24 -extern int vector_irq[NR_VECTORS];
    4.25 -extern u8 ioapic_irq_vector[NR_IRQS];
    4.26 -
    4.27 -#define vector_to_irq(vec)              (vector_irq[vec])
    4.28 -#define irq_to_vector(irq) \
    4.29 -    (IS_LEGACY_IRQ(irq) ? LEGACY_VECTOR(irq) : ioapic_irq_vector[irq])
    4.30  
    4.31  #define platform_legacy_irq(irq)	((irq) < 16)
    4.32  
    4.33 @@ -59,14 +60,12 @@ int unmap_domain_pirq(struct domain *d, 
    4.34  int get_free_pirq(struct domain *d, int type, int index);
    4.35  void free_domain_pirqs(struct domain *d);
    4.36  
    4.37 -#define domain_irq_to_vector(d, irq)                            \
    4.38 -    ((d)->arch.pirq_vector[irq] ? (d)->arch.pirq_vector[irq] :  \
    4.39 -     IS_LEGACY_IRQ(irq) ? LEGACY_VECTOR(irq) : 0)
    4.40 -
    4.41 -#define domain_vector_to_irq(d, vec)                                    \
    4.42 -    ((d)->arch.vector_pirq[vec] ? (d)->arch.vector_pirq[vec] :          \
    4.43 -     ((vec) < FIRST_LEGACY_VECTOR || (vec) > LAST_LEGACY_VECTOR) ?      \
    4.44 -     0 : LEGACY_IRQ_FROM_VECTOR(vec))
    4.45 +#define domain_irq_to_vector(d, irq) ((d)->arch.pirq_vector[irq] ?: \
    4.46 +                                      IO_APIC_IRQ(irq) ? 0 : LEGACY_VECTOR(irq))
    4.47 +#define domain_vector_to_irq(d, vec) ((d)->arch.vector_pirq[vec] ?: \
    4.48 +                                      ((vec) < FIRST_LEGACY_VECTOR || \
    4.49 +                                       (vec) > LAST_LEGACY_VECTOR) ? \
    4.50 +                                      0 : LEGACY_IRQ_FROM_VECTOR(vec))
    4.51  
    4.52  int pirq_guest_force_unbind(struct domain *d, int irq);
    4.53