xcp-1.6-updates/xen-4.1.hg

changeset 23234:a43a31a97603

x86/IO-APIC: refine EOI-ing of migrating level interrupts

Rather than going through all IO-APICs and calling
io_apic_eoi_vector()
for the vector in question, just use eoi_IO_APIC_irq().

This in turn allows to eliminate quite a bit of other code.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen-unstable changeset: 24155:0d50e704834f
xen-unstable date: Fri Nov 18 09:18:41 2011 +0100
author Jan Beulich <jbeulich@suse.com>
date Wed Mar 07 08:02:59 2012 +0000 (2012-03-07)
parents 637eaa1421d1
children dab13447cd8c
files xen/arch/x86/io_apic.c
line diff
     1.1 --- a/xen/arch/x86/io_apic.c	Wed Mar 07 07:59:58 2012 +0000
     1.2 +++ b/xen/arch/x86/io_apic.c	Wed Mar 07 08:02:59 2012 +0000
     1.3 @@ -69,10 +69,6 @@ int __read_mostly nr_ioapics;
     1.4  
     1.5  #define ioapic_has_eoi_reg(apic) (mp_ioapics[(apic)].mpc_apicver >= 0x20)
     1.6  
     1.7 -#define io_apic_eoi_vector(apic, vector) io_apic_eoi((apic), (vector), -1)
     1.8 -#define io_apic_eoi_pin(apic, pin) io_apic_eoi((apic), -1, (pin))
     1.9 -
    1.10 -
    1.11  /*
    1.12   * This is performance-critical, we want to do it O(1)
    1.13   *
    1.14 @@ -208,16 +204,13 @@ static void ioapic_write_entry(int apic,
    1.15      spin_unlock_irqrestore(&ioapic_lock, flags);
    1.16  }
    1.17  
    1.18 -/* EOI an IO-APIC entry.  One of vector or pin may be -1, indicating that
    1.19 - * it should be worked out using the other.  This function expect that the
    1.20 - * ioapic_lock is taken, and interrupts are disabled (or there is a good reason
    1.21 - * not to), and that if both pin and vector are passed, that they refer to the
    1.22 +/* EOI an IO-APIC entry.  Vector may be -1, indicating that it should be
    1.23 + * worked out using the pin.  This function expects that the ioapic_lock is
    1.24 + * being held, and interrupts are disabled (or there is a good reason not
    1.25 + * to), and that if both pin and vector are passed, that they refer to the
    1.26   * same redirection entry in the IO-APIC. */
    1.27  static void __io_apic_eoi(unsigned int apic, unsigned int vector, unsigned int pin)
    1.28  {
    1.29 -    /* Ensure some useful information is passed in */
    1.30 -    BUG_ON( (vector == -1 && pin == -1) );
    1.31 -    
    1.32      /* Prefer the use of the EOI register if available */
    1.33      if ( ioapic_has_eoi_reg(apic) )
    1.34      {
    1.35 @@ -234,42 +227,6 @@ static void __io_apic_eoi(unsigned int a
    1.36          struct IO_APIC_route_entry entry;
    1.37          bool_t need_to_unmask = 0;
    1.38  
    1.39 -        /* If pin is unknown, search for it */
    1.40 -        if ( pin == -1 )
    1.41 -        {
    1.42 -            unsigned int p;
    1.43 -            for ( p = 0; p < nr_ioapic_registers[apic]; ++p )
    1.44 -            {
    1.45 -                entry = __ioapic_read_entry(apic, p, TRUE);
    1.46 -                if ( entry.vector == vector )
    1.47 -                {
    1.48 -                    pin = p;
    1.49 -                    /* break; */
    1.50 -
    1.51 -                    /* Here should be a break out of the loop, but at the 
    1.52 -                     * Xen code doesn't actually prevent multiple IO-APIC
    1.53 -                     * entries being assigned the same vector, so EOI all
    1.54 -                     * pins which have the correct vector.
    1.55 -                     *
    1.56 -                     * Remove the following code when the above assertion
    1.57 -                     * is fulfilled. */
    1.58 -                    __io_apic_eoi(apic, vector, p);
    1.59 -                }
    1.60 -            }
    1.61 -            
    1.62 -            /* If search fails, nothing to do */
    1.63 -
    1.64 -            /* if ( pin == -1 ) */
    1.65 -
    1.66 -            /* Because the loop wasn't broken out of (see comment above),
    1.67 -             * all relevant pins have been EOI, so we can always return.
    1.68 -             * 
    1.69 -             * Re-instate the if statement above when the Xen logic has been
    1.70 -             * fixed.*/
    1.71 -
    1.72 -            return;
    1.73 -        }
    1.74 -
    1.75          entry = __ioapic_read_entry(apic, pin, TRUE);
    1.76  
    1.77          if ( ! entry.mask )
    1.78 @@ -296,17 +253,6 @@ static void __io_apic_eoi(unsigned int a
    1.79      }
    1.80  }
    1.81  
    1.82 -/* EOI an IO-APIC entry.  One of vector or pin may be -1, indicating that
    1.83 - * it should be worked out using the other.  This function disables interrupts
    1.84 - * and takes the ioapic_lock */
    1.85 -static void io_apic_eoi(unsigned int apic, unsigned int vector, unsigned int pin)
    1.86 -{
    1.87 -    unsigned int flags;
    1.88 -    spin_lock_irqsave(&ioapic_lock, flags);
    1.89 -    __io_apic_eoi(apic, vector, pin);
    1.90 -    spin_unlock_irqrestore(&ioapic_lock, flags);
    1.91 -}
    1.92 -
    1.93  /*
    1.94   * Saves all the IO-APIC RTE's
    1.95   */
    1.96 @@ -1809,11 +1755,7 @@ static void end_level_ioapic_irq (unsign
    1.97  
    1.98      /* Manually EOI the old vector if we are moving to the new */
    1.99      if ( vector && i != vector )
   1.100 -    {
   1.101 -        int ioapic;
   1.102 -        for (ioapic = 0; ioapic < nr_ioapics; ioapic++)
   1.103 -            io_apic_eoi_vector(ioapic, i);
   1.104 -    }
   1.105 +        eoi_IO_APIC_irq(irq);
   1.106  
   1.107      v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1));
   1.108