diff -Nurp custom-source-xen.orig/drivers/xen/core/evtchn.c custom-source-xen/drivers/xen/core/evtchn.c --- custom-source-xen.orig/drivers/xen/core/evtchn.c 2011-03-29 13:34:19.025232010 +0000 +++ custom-source-xen/drivers/xen/core/evtchn.c 2011-03-29 14:39:23.824587517 +0000 @@ -245,7 +245,7 @@ asmlinkage void evtchn_do_upcall(struct #ifndef CONFIG_X86 /* No need for a barrier -- XCHG is a barrier on x86. */ /* Clear master flag /before/ clearing selector flag. */ - rmb(); + wmb(); #endif l1 = xchg(&vcpu_info->evtchn_pending_sel, 0); @@ -279,6 +279,8 @@ asmlinkage void evtchn_do_upcall(struct /* process port */ port = (l1i * BITS_PER_LONG) + l2i; + mask_evtchn(port); + clear_evtchn(port); if ((irq = evtchn_to_irq[port]) != -1) do_IRQ(irq, regs); else { @@ -701,24 +703,12 @@ static void mask_dynirq(unsigned int irq mask_evtchn(evtchn); } -static void ack_dynirq(unsigned int irq) -{ - int evtchn = evtchn_from_irq(irq); - - move_native_irq(irq); - - if (VALID_EVTCHN(evtchn)) { - mask_evtchn(evtchn); - clear_evtchn(evtchn); - } -} - static void end_dynirq(unsigned int irq) { - int evtchn = evtchn_from_irq(irq); - - if (VALID_EVTCHN(evtchn) && !(irq_desc[irq].status & IRQ_DISABLED)) - unmask_evtchn(evtchn); + if (!(irq_desc[irq].status & IRQ_DISABLED)) { + move_masked_irq(irq); + unmask_dynirq(irq); + } } static struct irq_chip dynirq_chip = { @@ -726,8 +716,7 @@ static struct irq_chip dynirq_chip = { .startup = startup_dynirq, .mask = mask_dynirq, .unmask = unmask_dynirq, - .mask_ack = ack_dynirq, - .ack = ack_dynirq, + .ack = end_dynirq, .end = end_dynirq, #ifdef CONFIG_SMP .set_affinity = set_affinity_irq, @@ -816,30 +805,18 @@ static void unmask_pirq(unsigned int irq static void mask_pirq(unsigned int irq) { -} - -static void ack_pirq(unsigned int irq) -{ - int evtchn = evtchn_from_irq(irq); - - move_native_irq(irq); - - if (VALID_EVTCHN(evtchn)) { - mask_evtchn(evtchn); - clear_evtchn(evtchn); - } + mask_dynirq(irq); } static void end_pirq(unsigned int irq) { - int evtchn = evtchn_from_irq(irq); - if ((irq_desc[irq].status & (IRQ_DISABLED|IRQ_PENDING)) == (IRQ_DISABLED|IRQ_PENDING)) { shutdown_pirq(irq); - } else if (VALID_EVTCHN(evtchn)) { - unmask_evtchn(evtchn); - pirq_unmask_notify(irq_to_pirq(irq)); + } else { + if (!(irq_desc[irq].status & IRQ_DISABLED)) + move_masked_irq(irq); + unmask_pirq(irq); } } @@ -850,8 +827,7 @@ static struct irq_chip pirq_chip = { .shutdown = shutdown_pirq, .mask = mask_pirq, .unmask = unmask_pirq, - .mask_ack = ack_pirq, - .ack = ack_pirq, + .ack = end_pirq, .end = end_pirq, #ifdef CONFIG_SMP .set_affinity = set_affinity_irq, @@ -1034,7 +1010,7 @@ void __init xen_init_IRQ(void) irq_desc[dynirq_to_irq(i)].action = NULL; irq_desc[dynirq_to_irq(i)].depth = 1; set_irq_chip_and_handler_name(dynirq_to_irq(i), &dynirq_chip, - handle_level_irq, "level"); + handle_edge_irq, "edge"); } /* Phys IRQ space is statically bound (1:1 mapping). Nail refcnts. */ @@ -1051,6 +1027,6 @@ void __init xen_init_IRQ(void) irq_desc[pirq_to_irq(i)].action = NULL; irq_desc[pirq_to_irq(i)].depth = 1; set_irq_chip_and_handler_name(pirq_to_irq(i), &pirq_chip, - handle_level_irq, "level"); + handle_edge_irq, "edge"); } }