Mailing List Archive

[xen-unstable] x86: Fix unmaskable MSI handling, and also some other EOI-notification issues.
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1232549083 0
# Node ID af1d9af1a993001bdfdb81d9af1af4fd4a9d3852
# Parent 033945166a3a5f3078b1e583bc5e50871ef7e801
x86: Fix unmaskable MSI handling, and also some other EOI-notification issues.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
---
xen/arch/x86/io_apic.c | 5 ++++-
xen/arch/x86/irq.c | 8 ++++----
xen/arch/x86/physdev.c | 11 +++++++++--
xen/include/asm-x86/irq.h | 1 -
4 files changed, 17 insertions(+), 8 deletions(-)

diff -r 033945166a3a -r af1d9af1a993 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c Wed Jan 21 11:58:01 2009 +0000
+++ b/xen/arch/x86/io_apic.c Wed Jan 21 14:44:43 2009 +0000
@@ -1554,11 +1554,14 @@ static unsigned int startup_msi_vector(u

static void ack_msi_vector(unsigned int vector)
{
- ack_APIC_irq();
+ if ( msi_maskable_irq(irq_desc[vector].msi_desc) )
+ ack_APIC_irq(); /* ACKTYPE_NONE */
}

static void end_msi_vector(unsigned int vector)
{
+ if ( !msi_maskable_irq(irq_desc[vector].msi_desc) )
+ ack_APIC_irq(); /* ACKTYPE_EOI */
}

static void shutdown_msi_vector(unsigned int vector)
diff -r 033945166a3a -r af1d9af1a993 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c Wed Jan 21 11:58:01 2009 +0000
+++ b/xen/arch/x86/irq.c Wed Jan 21 14:44:43 2009 +0000
@@ -705,6 +705,10 @@ static irq_guest_action_t *__pirq_guest_
spin_lock_irq(&desc->lock);
}
break;
+ case ACKTYPE_NONE:
+ stop_timer(&irq_guest_eoi_timer[vector]);
+ _irq_guest_eoi(desc);
+ break;
}

/*
@@ -852,10 +856,6 @@ int map_domain_pirq(

ASSERT(spin_is_locked(&pcidevs_lock));
ASSERT(spin_is_locked(&d->event_lock));
-
- /* XXX Until pcidev and msi locking is fixed. */
- if ( type == MAP_PIRQ_TYPE_MSI )
- return -EINVAL;

if ( !IS_PRIV(current->domain) )
return -EPERM;
diff -r 033945166a3a -r af1d9af1a993 xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c Wed Jan 21 11:58:01 2009 +0000
+++ b/xen/arch/x86/physdev.c Wed Jan 21 14:44:43 2009 +0000
@@ -257,8 +257,15 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
if ( (irq < 0) || (irq >= NR_IRQS) )
break;
irq_status_query.flags = 0;
- if ( pirq_acktype(v->domain, irq) != 0 )
- irq_status_query.flags |= XENIRQSTAT_needs_eoi;
+ /*
+ * Even edge-triggered or message-based IRQs can need masking from
+ * time to time. If teh guest is not dynamically checking for this
+ * via the new pirq_eoi_map mechanism, it must conservatively always
+ * execute the EOI hypercall. In practice, this only really makes a
+ * difference for maskable MSI sources, and if those are supported
+ * then dom0 is probably modern anyway.
+ */
+ irq_status_query.flags |= XENIRQSTAT_needs_eoi;
if ( pirq_shared(v->domain, irq) )
irq_status_query.flags |= XENIRQSTAT_shared;
ret = copy_to_guest(arg, &irq_status_query, 1) ? -EFAULT : 0;
diff -r 033945166a3a -r af1d9af1a993 xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h Wed Jan 21 11:58:01 2009 +0000
+++ b/xen/include/asm-x86/irq.h Wed Jan 21 14:44:43 2009 +0000
@@ -52,7 +52,6 @@ extern atomic_t irq_err_count;
extern atomic_t irq_err_count;
extern atomic_t irq_mis_count;

-int pirq_acktype(struct domain *d, int irq);
int pirq_shared(struct domain *d , int irq);

int map_domain_pirq(struct domain *d, int pirq, int vector, int type,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog