]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
xen: add rebind_evtchn_irq
authorJeremy Fitzhardinge <jeremy@goop.org>
Mon, 26 May 2008 22:31:23 +0000 (23:31 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 27 May 2008 08:11:37 +0000 (10:11 +0200)
Add rebind_evtchn_irq(), which will rebind an device driver's existing
irq to a new event channel on restore.  Since the new event channel
will be masked and bound to vcpu0, we update the state accordingly and
unmask the irq once everything is set up.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
drivers/xen/events.c
include/xen/events.h

index 4f0f22b020ea4aa192dbab56cba76edd6076a837..f64e9798129c7393accc448bea284d57f10a387f 100644 (file)
@@ -557,6 +557,33 @@ out:
        put_cpu();
 }
 
+/* Rebind a new event channel to an existing irq. */
+void rebind_evtchn_irq(int evtchn, int irq)
+{
+       /* Make sure the irq is masked, since the new event channel
+          will also be masked. */
+       disable_irq(irq);
+
+       spin_lock(&irq_mapping_update_lock);
+
+       /* After resume the irq<->evtchn mappings are all cleared out */
+       BUG_ON(evtchn_to_irq[evtchn] != -1);
+       /* Expect irq to have been bound before,
+          so the bindcount should be non-0 */
+       BUG_ON(irq_bindcount[irq] == 0);
+
+       evtchn_to_irq[evtchn] = irq;
+       irq_info[irq] = mk_irq_info(IRQT_EVTCHN, 0, evtchn);
+
+       spin_unlock(&irq_mapping_update_lock);
+
+       /* new event channels are always bound to cpu 0 */
+       irq_set_affinity(irq, cpumask_of_cpu(0));
+
+       /* Unmask the event channel. */
+       enable_irq(irq);
+}
+
 /* Rebind an evtchn so that it gets delivered to a specific cpu */
 static void rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
 {
index acd8e062c85f381b5520c2ac27f13681053bedd0..a82ec0c45c3843e27ce08a5f6487d064946ef0d1 100644 (file)
@@ -32,6 +32,7 @@ void unbind_from_irqhandler(unsigned int irq, void *dev_id);
 
 void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector);
 int resend_irq_on_evtchn(unsigned int irq);
+void rebind_evtchn_irq(int evtchn, int irq);
 
 static inline void notify_remote_via_evtchn(int port)
 {