ia64/xen-unstable

changeset 19066:af1d9af1a993

x86: Fix unmaskable MSI handling, and also some other EOI-notification issues.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jan 21 14:44:43 2009 +0000 (2009-01-21)
parents 033945166a3a
children a37267e43365
files xen/arch/x86/io_apic.c xen/arch/x86/irq.c xen/arch/x86/physdev.c xen/include/asm-x86/irq.h
line diff
     1.1 --- a/xen/arch/x86/io_apic.c	Wed Jan 21 11:58:01 2009 +0000
     1.2 +++ b/xen/arch/x86/io_apic.c	Wed Jan 21 14:44:43 2009 +0000
     1.3 @@ -1554,11 +1554,14 @@ static unsigned int startup_msi_vector(u
     1.4  
     1.5  static void ack_msi_vector(unsigned int vector)
     1.6  {
     1.7 -    ack_APIC_irq();
     1.8 +    if ( msi_maskable_irq(irq_desc[vector].msi_desc) )
     1.9 +        ack_APIC_irq(); /* ACKTYPE_NONE */
    1.10  }
    1.11  
    1.12  static void end_msi_vector(unsigned int vector)
    1.13  {
    1.14 +    if ( !msi_maskable_irq(irq_desc[vector].msi_desc) )
    1.15 +        ack_APIC_irq(); /* ACKTYPE_EOI */
    1.16  }
    1.17  
    1.18  static void shutdown_msi_vector(unsigned int vector)
     2.1 --- a/xen/arch/x86/irq.c	Wed Jan 21 11:58:01 2009 +0000
     2.2 +++ b/xen/arch/x86/irq.c	Wed Jan 21 14:44:43 2009 +0000
     2.3 @@ -705,6 +705,10 @@ static irq_guest_action_t *__pirq_guest_
     2.4              spin_lock_irq(&desc->lock);
     2.5          }
     2.6          break;
     2.7 +    case ACKTYPE_NONE:
     2.8 +        stop_timer(&irq_guest_eoi_timer[vector]);
     2.9 +        _irq_guest_eoi(desc);
    2.10 +        break;
    2.11      }
    2.12  
    2.13      /*
    2.14 @@ -853,10 +857,6 @@ int map_domain_pirq(
    2.15      ASSERT(spin_is_locked(&pcidevs_lock));
    2.16      ASSERT(spin_is_locked(&d->event_lock));
    2.17  
    2.18 -    /* XXX Until pcidev and msi locking is fixed. */
    2.19 -    if ( type == MAP_PIRQ_TYPE_MSI )
    2.20 -        return -EINVAL;
    2.21 -
    2.22      if ( !IS_PRIV(current->domain) )
    2.23          return -EPERM;
    2.24  
     3.1 --- a/xen/arch/x86/physdev.c	Wed Jan 21 11:58:01 2009 +0000
     3.2 +++ b/xen/arch/x86/physdev.c	Wed Jan 21 14:44:43 2009 +0000
     3.3 @@ -257,8 +257,15 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
     3.4          if ( (irq < 0) || (irq >= NR_IRQS) )
     3.5              break;
     3.6          irq_status_query.flags = 0;
     3.7 -        if ( pirq_acktype(v->domain, irq) != 0 )
     3.8 -            irq_status_query.flags |= XENIRQSTAT_needs_eoi;
     3.9 +        /*
    3.10 +         * Even edge-triggered or message-based IRQs can need masking from
    3.11 +         * time to time. If teh guest is not dynamically checking for this
    3.12 +         * via the new pirq_eoi_map mechanism, it must conservatively always
    3.13 +         * execute the EOI hypercall. In practice, this only really makes a
    3.14 +         * difference for maskable MSI sources, and if those are supported
    3.15 +         * then dom0 is probably modern anyway.
    3.16 +         */
    3.17 +        irq_status_query.flags |= XENIRQSTAT_needs_eoi;
    3.18          if ( pirq_shared(v->domain, irq) )
    3.19              irq_status_query.flags |= XENIRQSTAT_shared;
    3.20          ret = copy_to_guest(arg, &irq_status_query, 1) ? -EFAULT : 0;
     4.1 --- a/xen/include/asm-x86/irq.h	Wed Jan 21 11:58:01 2009 +0000
     4.2 +++ b/xen/include/asm-x86/irq.h	Wed Jan 21 14:44:43 2009 +0000
     4.3 @@ -52,7 +52,6 @@ extern unsigned long io_apic_irqs;
     4.4  extern atomic_t irq_err_count;
     4.5  extern atomic_t irq_mis_count;
     4.6  
     4.7 -int pirq_acktype(struct domain *d, int irq);
     4.8  int pirq_shared(struct domain *d , int irq);
     4.9  
    4.10  int map_domain_pirq(struct domain *d, int pirq, int vector, int type,