# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 5eda9308b0ca7282b452d142873ab7d6755ed006
# Parent 2a3e10a132a2a57795ff9a46e465f99793c31da5
Remove bind_evtchn_to_irq/unbind_evtchn_from_irq from the
evtchn kernel interface. Fix error path in bind_evtchn_to_irqhandler.
Fix backend drivers to avoid double freeing IRQs.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
diff -r 2a3e10a132a2 -r 5eda9308b0ca
linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c Fri Oct 7
10:16:28 2005
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c Fri Oct 7
10:54:38 2005
@@ -65,12 +65,6 @@
mask_evtchn(evtchn);
evtchns[evtchn].handler = NULL;
-}
-
-void unbind_evtchn_from_irq(unsigned int evtchn)
-{
- printk("unbind_evtchn_from_irq called... FIXME??\n");
- while(1);
}
irqreturn_t evtchn_interrupt(int irq, void *dev_id, struct pt_regs *regs)
diff -r 2a3e10a132a2 -r 5eda9308b0ca
linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c Fri Oct 7 10:16:28 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c Fri Oct 7 10:54:38 2005
@@ -296,7 +296,7 @@
}
EXPORT_SYMBOL(unbind_ipi_from_irq);
-int bind_evtchn_to_irq(unsigned int evtchn)
+static int bind_evtchn_to_irq(unsigned int evtchn)
{
int irq;
@@ -314,9 +314,8 @@
return irq;
}
-EXPORT_SYMBOL(bind_evtchn_to_irq);
-
-void unbind_evtchn_from_irq(unsigned int irq)
+
+static void unbind_evtchn_from_irq(unsigned int irq)
{
evtchn_op_t op = { .cmd = EVTCHNOP_close };
int evtchn = irq_to_evtchn[irq];
@@ -333,7 +332,6 @@
spin_unlock(&irq_mapping_update_lock);
}
-EXPORT_SYMBOL(unbind_evtchn_from_irq);
int bind_evtchn_to_irqhandler(
unsigned int evtchn,
@@ -347,8 +345,10 @@
irq = bind_evtchn_to_irq(evtchn);
retval = request_irq(irq, handler, irqflags, devname, dev_id);
- if (retval != 0)
+ if (retval != 0) {
unbind_evtchn_from_irq(irq);
+ return retval;
+ }
return irq;
}
diff -r 2a3e10a132a2 -r 5eda9308b0ca
linux-2.6-xen-sparse/drivers/xen/blkback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c Fri Oct 7
10:16:28 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c Fri Oct 7
10:54:38 2005
@@ -74,6 +74,10 @@
.u.bind_interdomain.remote_dom = blkif->domid,
.u.bind_interdomain.remote_port = evtchn };
+ /* Already connected through? */
+ if (blkif->irq)
+ return 0;
+
if ( (blkif->blk_ring_area = alloc_vm_area(PAGE_SIZE)) == NULL )
return -ENOMEM;
@@ -107,8 +111,12 @@
{
blkif_t *blkif = (blkif_t *)arg;
- if (blkif->irq)
- unbind_evtchn_from_irqhandler(blkif->irq, blkif);
+ /* Already disconnected? */
+ if (!blkif->irq)
+ return;
+
+ unbind_evtchn_from_irqhandler(blkif->irq, blkif);
+ blkif->irq = 0;
vbd_free(&blkif->vbd);
diff -r 2a3e10a132a2 -r 5eda9308b0ca
linux-2.6-xen-sparse/drivers/xen/netback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c Fri Oct 7
10:16:28 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c Fri Oct 7
10:54:38 2005
@@ -183,6 +183,10 @@
.u.bind_interdomain.remote_dom = netif->domid,
.u.bind_interdomain.remote_port = evtchn };
+ /* Already connected through? */
+ if (netif->irq)
+ return 0;
+
netif->comms_area = alloc_vm_area(2*PAGE_SIZE);
if (netif->comms_area == NULL)
return -ENOMEM;
@@ -227,13 +231,12 @@
{
netif_t *netif = (netif_t *)arg;
- /*
- * This can't be done in netif_disconnect() because at that point
- * there may be outstanding requests in the network stack whose
- * asynchronous responses must still be notified to the remote driver.
- */
- if (netif->irq)
- unbind_evtchn_from_irqhandler(netif->irq, netif);
+ /* Already disconnected? */
+ if (!netif->irq)
+ return;
+
+ unbind_evtchn_from_irqhandler(netif->irq, netif);
+ netif->irq = 0;
unregister_netdev(netif->dev);
diff -r 2a3e10a132a2 -r 5eda9308b0ca
linux-2.6-xen-sparse/include/asm-xen/evtchn.h
--- a/linux-2.6-xen-sparse/include/asm-xen/evtchn.h Fri Oct 7 10:16:28 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/evtchn.h Fri Oct 7 10:54:38 2005
@@ -50,14 +50,6 @@
/* Dynamically bind an IPI source to Linux IRQ space. */
extern int bind_ipi_to_irq(int ipi);
extern void unbind_ipi_from_irq(int ipi);
-
-/*
- * Dynamically bind an event-channel port to Linux IRQ space.
- * BIND: Returns IRQ or error.
- * UNBIND: Takes IRQ to unbind from; automatically closes the event channel.
- */
-extern int bind_evtchn_to_irq(unsigned int evtchn);
-extern void unbind_evtchn_from_irq(unsigned int irq);
/*
* Dynamically bind an event-channel port to an IRQ-like callback handler.
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|