xen: Provide a variant of xen_poll_irq with timeout.
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 5 Nov 2009 21:33:09 +0000 (16:33 -0500)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Mon, 18 Oct 2010 14:49:28 +0000 (10:49 -0400)
The 'xen_poll_irq_timeout' provides a method to pass in
the poll timeout for IRQs if requested. We also export
those two poll functions as Xen PCI fronted uses them.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
drivers/xen/events.c
include/xen/events.h

index bab5ac1..4e0f868 100644 (file)
@@ -1139,7 +1139,7 @@ void xen_clear_irq_pending(int irq)
        if (VALID_EVTCHN(evtchn))
                clear_evtchn(evtchn);
 }
-
+EXPORT_SYMBOL(xen_clear_irq_pending);
 void xen_set_irq_pending(int irq)
 {
        int evtchn = evtchn_from_irq(irq);
@@ -1159,9 +1159,9 @@ bool xen_test_irq_pending(int irq)
        return ret;
 }
 
-/* Poll waiting for an irq to become pending.  In the usual case, the
  irq will be disabled so it won't deliver an interrupt. */
-void xen_poll_irq(int irq)
+/* Poll waiting for an irq to become pending with timeout.  In the usual case,
* the irq will be disabled so it won't deliver an interrupt. */
+void xen_poll_irq_timeout(int irq, u64 timeout)
 {
        evtchn_port_t evtchn = evtchn_from_irq(irq);
 
@@ -1169,13 +1169,20 @@ void xen_poll_irq(int irq)
                struct sched_poll poll;
 
                poll.nr_ports = 1;
-               poll.timeout = 0;
+               poll.timeout = timeout;
                set_xen_guest_handle(poll.ports, &evtchn);
 
                if (HYPERVISOR_sched_op(SCHEDOP_poll, &poll) != 0)
                        BUG();
        }
 }
+EXPORT_SYMBOL(xen_poll_irq_timeout);
+/* Poll waiting for an irq to become pending.  In the usual case, the
+ * irq will be disabled so it won't deliver an interrupt. */
+void xen_poll_irq(int irq)
+{
+       xen_poll_irq_timeout(irq, 0 /* no timeout */);
+}
 
 void xen_irq_resume(void)
 {
index 8227da8..2532f8b 100644 (file)
@@ -53,6 +53,10 @@ bool xen_test_irq_pending(int irq);
    irq will be disabled so it won't deliver an interrupt. */
 void xen_poll_irq(int irq);
 
+/* Poll waiting for an irq to become pending with a timeout.  In the usual case,
+ * the irq will be disabled so it won't deliver an interrupt. */
+void xen_poll_irq_timeout(int irq, u64 timeout);
+
 /* Determine the IRQ which is bound to an event channel */
 unsigned irq_from_evtchn(unsigned int evtchn);