[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Move more drivers to bind_evtchn_to_irqhandler() interface.
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID 60c4cd9ebaa16a6fcac05275e5e21056794339ad # Parent 33bb0b41aa73cf27fb2314f5f47caf5ab345415a Move more drivers to bind_evtchn_to_irqhandler() interface. The most important ones are all done now. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> diff -r 33bb0b41aa73 -r 60c4cd9ebaa1 linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c --- a/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c Wed Aug 3 14:44:19 2005 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c Wed Aug 3 16:11:32 2005 @@ -116,9 +116,9 @@ #elif defined (__x86_64__) #define IRQ_REG orig_rax #endif -#define do_IRQ(irq, regs) do { \ - (regs)->IRQ_REG = (irq); \ - do_IRQ((regs)); \ +#define do_IRQ(irq, regs) do { \ + (regs)->IRQ_REG = (irq); \ + do_IRQ((regs)); \ } while (0) #endif @@ -137,7 +137,7 @@ /* NB. Interrupts are disabled on entry. */ asmlinkage void evtchn_do_upcall(struct pt_regs *regs) { - u32 l1, l2; + u32 l1, l2; unsigned int l1i, l2i, port; int irq, cpu = smp_processor_id(); shared_info_t *s = HYPERVISOR_shared_info; @@ -230,13 +230,13 @@ panic("Failed to unbind virtual IRQ %d\n", virq); /* - * This is a slight hack. Interdomain ports can be allocated directly - * by userspace, and at that point they get bound by Xen to vcpu 0. We - * therefore need to make sure that if we get an event on an event - * channel we don't know about vcpu 0 handles it. Binding channels to - * vcpu 0 when closing them achieves this. + * This is a slight hack. Interdomain ports can be allocated directly + * by userspace, and at that point they get bound by Xen to vcpu 0. We + * therefore need to make sure that if we get an event on an event + * channel we don't know about vcpu 0 handles it. Binding channels to + * vcpu 0 when closing them achieves this. */ - bind_evtchn_to_cpu(evtchn, 0); + bind_evtchn_to_cpu(evtchn, 0); evtchn_to_irq[evtchn] = -1; irq_to_evtchn[irq] = -1; per_cpu(virq_to_irq, cpu)[virq] = -1; @@ -270,7 +270,7 @@ } else { - irq = evtchn_to_irq[evtchn]; + irq = evtchn_to_irq[evtchn]; } irq_bindcount[irq]++; @@ -291,17 +291,17 @@ if ( --irq_bindcount[irq] == 0 ) { - op.cmd = EVTCHNOP_close; - op.u.close.dom = DOMID_SELF; - op.u.close.port = evtchn; - if ( HYPERVISOR_event_channel_op(&op) != 0 ) - panic("Failed to unbind virtual IPI %d on cpu %d\n", ipi, cpu); - - /* See comments in unbind_virq_from_irq */ - bind_evtchn_to_cpu(evtchn, 0); + op.cmd = EVTCHNOP_close; + op.u.close.dom = DOMID_SELF; + op.u.close.port = evtchn; + if ( HYPERVISOR_event_channel_op(&op) != 0 ) + panic("Failed to unbind virtual IPI %d on cpu %d\n", ipi, cpu); + + /* See comments in unbind_virq_from_irq */ + bind_evtchn_to_cpu(evtchn, 0); evtchn_to_irq[evtchn] = -1; irq_to_evtchn[irq] = -1; - per_cpu(ipi_to_evtchn, cpu)[ipi] = 0; + per_cpu(ipi_to_evtchn, cpu)[ipi] = 0; } spin_unlock(&irq_mapping_update_lock); @@ -352,8 +352,6 @@ unsigned int irq; int retval; - BUG_ON((irqflags & ~SA_SAMPLE_RANDOM) != 0); - irq = bind_evtchn_to_irq(evtchn); retval = request_irq(irq, handler, irqflags, devname, dev_id); if ( retval != 0 ) @@ -382,8 +380,8 @@ spin_lock(&irq_mapping_update_lock); evtchn = irq_to_evtchn[irq]; if (!VALID_EVTCHN(evtchn)) { - spin_unlock(&irq_mapping_update_lock); - return; + spin_unlock(&irq_mapping_update_lock); + return; } /* Tell Xen to send future instances of this interrupt to other vcpu. */ @@ -397,7 +395,7 @@ * but don't do the xenlinux-level rebind in that case. */ if (HYPERVISOR_event_channel_op(&op) >= 0) - bind_evtchn_to_cpu(evtchn, tcpu); + bind_evtchn_to_cpu(evtchn, tcpu); spin_unlock(&irq_mapping_update_lock); @@ -412,7 +410,7 @@ * they start again. This is kind of a hack. */ if (!irqs_disabled()) - smp_call_function(do_nothing_function, NULL, 0, 0); + smp_call_function(do_nothing_function, NULL, 0, 0); } @@ -658,7 +656,7 @@ evtchn = op.u.bind_virq.port; /* Record the new mapping. */ - bind_evtchn_to_cpu(evtchn, 0); + bind_evtchn_to_cpu(evtchn, 0); evtchn_to_irq[evtchn] = irq; irq_to_evtchn[irq] = evtchn; @@ -682,9 +680,9 @@ #endif for ( cpu = 0; cpu < NR_CPUS; cpu++ ) { - /* No VIRQ -> IRQ mappings. */ - for ( i = 0; i < NR_VIRQS; i++ ) - per_cpu(virq_to_irq, cpu)[i] = -1; + /* No VIRQ -> IRQ mappings. */ + for ( i = 0; i < NR_VIRQS; i++ ) + per_cpu(virq_to_irq, cpu)[i] = -1; } /* No event-channel -> IRQ mappings. */ diff -r 33bb0b41aa73 -r 60c4cd9ebaa1 linux-2.6-xen-sparse/drivers/xen/blkback/interface.c --- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c Wed Aug 3 14:44:19 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c Wed Aug 3 16:11:32 2005 @@ -32,29 +32,20 @@ blkif_t *blkif = (blkif_t *)arg; ctrl_msg_t cmsg; blkif_be_disconnect_t disc; +#ifdef CONFIG_XEN_BLKDEV_GRANT + struct gnttab_unmap_grant_ref op; +#endif /* * These can't be done in blkif_disconnect() because at that point there * may be outstanding requests at the disc whose asynchronous responses * must still be notified to the remote driver. */ - unbind_evtchn_from_irqhandler(blkif->evtchn, blkif); - #ifdef CONFIG_XEN_BLKDEV_GRANT - { - /* - * Release the shared memory page. - */ - struct gnttab_unmap_grant_ref op; - - op.host_virt_addr = blkif->shmem_vaddr; - op.handle = blkif->shmem_handle; - op.dev_bus_addr = 0; - - if(unlikely(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1))) { - BUG(); - } - } + op.host_virt_addr = blkif->shmem_vaddr; + op.handle = blkif->shmem_handle; + op.dev_bus_addr = 0; + BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1)); #endif vfree(blkif->blk_ring.sring); @@ -76,8 +67,7 @@ * another CPU doesn't see the status change yet. */ mb(); - if ( blkif->status != DISCONNECTING ) - BUG(); + BUG_ON(blkif->status != DISCONNECTING); blkif->status = DISCONNECTED; mb(); @@ -277,6 +267,7 @@ blkif->status = DISCONNECTING; blkif->disconnect_rspid = rsp_id; wmb(); /* Let other CPUs see the status change. */ + unbind_evtchn_from_irqhandler(blkif->evtchn, blkif); blkif_deschedule(blkif); blkif_put(blkif); return 0; /* Caller should not send response message. */ diff -r 33bb0b41aa73 -r 60c4cd9ebaa1 linux-2.6-xen-sparse/drivers/xen/blktap/blktap.h --- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.h Wed Aug 3 14:44:19 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.h Wed Aug 3 16:11:32 2005 @@ -71,7 +71,6 @@ /* Physical parameters of the comms window. */ unsigned long shmem_frame; unsigned int evtchn; - int irq; /* Comms information. */ blkif_back_ring_t blk_ring; diff -r 33bb0b41aa73 -r 60c4cd9ebaa1 linux-2.6-xen-sparse/drivers/xen/blktap/blktap_controlmsg.c --- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap_controlmsg.c Wed Aug 3 14:44:19 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap_controlmsg.c Wed Aug 3 16:11:32 2005 @@ -16,16 +16,15 @@ [BLKIF_STATE_CONNECTED] = "connected", }; -static char * blkif_status_name[] = { +static char *blkif_status_name[] = { [BLKIF_INTERFACE_STATUS_CLOSED] = "closed", [BLKIF_INTERFACE_STATUS_DISCONNECTED] = "disconnected", [BLKIF_INTERFACE_STATUS_CONNECTED] = "connected", [BLKIF_INTERFACE_STATUS_CHANGED] = "changed", }; -static unsigned blktap_be_irq; -unsigned int blktap_be_state = BLKIF_STATE_CLOSED; -unsigned int blktap_be_evtchn; +unsigned int blktap_be_state = BLKIF_STATE_CLOSED; +unsigned int blktap_be_evtchn; /*-----[ Control Messages to/from Frontend VMs ]--------------------------*/ @@ -55,7 +54,6 @@ * may be outstanding requests at the disc whose asynchronous responses * must still be notified to the remote driver. */ - unbind_evtchn_from_irq(blkif->evtchn); vfree(blkif->blk_ring.sring); /* Construct the deferred response message. */ @@ -232,12 +230,12 @@ BACK_RING_INIT(&blkif->blk_ring, sring, PAGE_SIZE); blkif->evtchn = evtchn; - blkif->irq = bind_evtchn_to_irq(evtchn); blkif->shmem_frame = shmem_frame; blkif->status = CONNECTED; blkif_get(blkif); - request_irq(blkif->irq, blkif_ptfe_int, 0, "blkif-pt-backend", blkif); + bind_evtchn_to_irqhandler( + evtchn, blkif_ptfe_int, 0, "blkif-pt-backend", blkif); connect->status = BLKIF_BE_STATUS_OKAY; } @@ -264,7 +262,7 @@ blkif->status = DISCONNECTING; blkif->disconnect_rspid = rsp_id; wmb(); /* Let other CPUs see the status change. */ - free_irq(blkif->irq, blkif); + unbind_evtchn_from_irqhandler(blkif->evtchn, blkif); blkif_deschedule(blkif); blkif_put(blkif); return 0; /* Caller should not send response message. */ @@ -313,12 +311,11 @@ int err = 0; blktap_be_evtchn = status->evtchn; - blktap_be_irq = bind_evtchn_to_irq(blktap_be_evtchn); - - err = request_irq(blktap_be_irq, blkif_ptbe_int, - SA_SAMPLE_RANDOM, "blkif", NULL); + + err = bind_evtchn_to_irqhandler( + blktap_be_evtchn, blkif_ptbe_int, SA_SAMPLE_RANDOM, "blkif", NULL); if ( err ) { - WPRINTK("blkfront request_irq failed (%d)\n", err); + WPRINTK("blkfront bind_evtchn_to_irqhandler failed (%d)\n", err); return; } else { /* transtion to connected in case we need to do a diff -r 33bb0b41aa73 -r 60c4cd9ebaa1 linux-2.6-xen-sparse/drivers/xen/netback/common.h --- a/linux-2.6-xen-sparse/drivers/xen/netback/common.h Wed Aug 3 14:44:19 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/common.h Wed Aug 3 16:11:32 2005 @@ -42,7 +42,6 @@ unsigned long tx_shmem_frame; unsigned long rx_shmem_frame; unsigned int evtchn; - int irq; /* The shared rings and indexes. */ netif_tx_interface_t *tx; diff -r 33bb0b41aa73 -r 60c4cd9ebaa1 linux-2.6-xen-sparse/drivers/xen/netback/interface.c --- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c Wed Aug 3 14:44:19 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c Wed Aug 3 16:11:32 2005 @@ -33,7 +33,8 @@ spin_lock_bh(&dev->xmit_lock); netif->active = 1; spin_unlock_bh(&dev->xmit_lock); - (void)request_irq(netif->irq, netif_be_int, 0, dev->name, netif); + (void)bind_evtchn_to_irqhandler( + netif->evtchn, netif_be_int, 0, dev->name, netif); netif_schedule_work(netif); } @@ -43,7 +44,7 @@ spin_lock_bh(&dev->xmit_lock); netif->active = 0; spin_unlock_bh(&dev->xmit_lock); - free_irq(netif->irq, netif); + unbind_evtchn_from_irqhandler(netif->evtchn, netif); netif_deschedule_work(netif); } @@ -76,7 +77,6 @@ * may be outstanding requests in the network stack whose asynchronous * responses must still be notified to the remote driver. */ - unbind_evtchn_from_irq(netif->evtchn); vfree(netif->tx); /* Frees netif->rx as well. */ /* Construct the deferred response message. */ @@ -322,7 +322,6 @@ } netif->evtchn = evtchn; - netif->irq = bind_evtchn_to_irq(evtchn); netif->tx_shmem_frame = tx_shmem_frame; netif->rx_shmem_frame = rx_shmem_frame; netif->tx = diff -r 33bb0b41aa73 -r 60c4cd9ebaa1 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Wed Aug 3 14:44:19 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Wed Aug 3 16:11:32 2005 @@ -152,7 +152,6 @@ unsigned int handle; unsigned int evtchn; - unsigned int irq; /* What is the status of our connection to the remote backend? */ #define BEST_CLOSED 0 @@ -887,12 +886,11 @@ { #if DEBUG if (np) { - IPRINTK("<vif handle=%u %s(%s) evtchn=%u irq=%u tx=%p rx=%p>\n", + IPRINTK("<vif handle=%u %s(%s) evtchn=%u tx=%p rx=%p>\n", np->handle, be_state_name[np->backend_state], np->user_state ? "open" : "closed", np->evtchn, - np->irq, np->tx, np->rx); } else { @@ -947,12 +945,11 @@ spin_unlock_irq(&np->tx_lock); /* Free resources. */ - if(np->tx != NULL){ - free_irq(np->irq, np->dev); - unbind_evtchn_from_irq(np->evtchn); + if ( np->tx != NULL ) + { + unbind_evtchn_from_irqhandler(np->evtchn, np->dev); free_page((unsigned long)np->tx); free_page((unsigned long)np->rx); - np->irq = 0; np->evtchn = 0; np->tx = NULL; np->rx = NULL; @@ -1022,11 +1019,11 @@ memcpy(dev->dev_addr, status->mac, ETH_ALEN); network_connect(dev, status); np->evtchn = status->evtchn; - np->irq = bind_evtchn_to_irq(np->evtchn); #if defined(CONFIG_XEN_NETDEV_GRANT_TX) || defined(CONFIG_XEN_NETDEV_GRANT_RX) rdomid = status->domid; #endif - (void)request_irq(np->irq, netif_int, SA_SAMPLE_RANDOM, dev->name, dev); + (void)bind_evtchn_to_irqhandler( + np->evtchn, netif_int, SA_SAMPLE_RANDOM, dev->name, dev); netctrl_connected_count(); (void)send_fake_arp(dev); vif_show(np); @@ -1430,8 +1427,7 @@ static void vif_suspend(struct net_private *np) { /* Avoid having tx/rx stuff happen until we're ready. */ - free_irq(np->irq, np->dev); - unbind_evtchn_from_irq(np->evtchn); + unbind_evtchn_from_irqhandler(np->evtchn, np->dev); } static void vif_resume(struct net_private *np) diff -r 33bb0b41aa73 -r 60c4cd9ebaa1 linux-2.6-xen-sparse/drivers/xen/usbback/common.h --- a/linux-2.6-xen-sparse/drivers/xen/usbback/common.h Wed Aug 3 14:44:19 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/usbback/common.h Wed Aug 3 16:11:32 2005 @@ -37,7 +37,6 @@ /* Physical parameters of the comms window. */ unsigned long shmem_frame; unsigned int evtchn; - int irq; /* Comms Information */ usbif_back_ring_t usb_ring; /* Private fields. */ diff -r 33bb0b41aa73 -r 60c4cd9ebaa1 linux-2.6-xen-sparse/drivers/xen/usbback/interface.c --- a/linux-2.6-xen-sparse/drivers/xen/usbback/interface.c Wed Aug 3 14:44:19 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/usbback/interface.c Wed Aug 3 16:11:32 2005 @@ -6,15 +6,6 @@ * by Mark Williamson, Copyright (c) 2004 */ - -/****************************************************************************** - * arch/xen/drivers/blkif/backend/interface.c - * - * Block-device interface management. - * - * Copyright (c) 2004, Keir Fraser - */ - #include "common.h" #define USBIF_HASHSZ 1024 @@ -42,7 +33,6 @@ * may be outstanding requests at the device whose asynchronous responses * must still be notified to the remote driver. */ - unbind_evtchn_from_irq(usbif->evtchn); vfree(usbif->usb_ring.sring); /* Construct the deferred response message. */ @@ -198,12 +188,12 @@ BACK_RING_INIT(&up->usb_ring, sring, PAGE_SIZE); up->evtchn = evtchn; - up->irq = bind_evtchn_to_irq(evtchn); up->shmem_frame = shmem_frame; up->status = CONNECTED; usbif_get(up); - request_irq(up->irq, usbif_be_int, 0, "usbif-backend", up); + (void)bind_evtchn_to_irqhandler( + evtchn, usbif_be_int, 0, "usbif-backend", up); connect->status = USBIF_BE_STATUS_OKAY; } @@ -233,7 +223,7 @@ up->status = DISCONNECTING; up->disconnect_rspid = rsp_id; wmb(); /* Let other CPUs see the status change. */ - free_irq(up->irq, up); + unbind_evtchn_from_irqhandler(up->evtchn, up); usbif_deschedule(up); usbif_put(up); return 0; /* Caller should not send response message. */ diff -r 33bb0b41aa73 -r 60c4cd9ebaa1 linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront.c --- a/linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront.c Wed Aug 3 14:44:19 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront.c Wed Aug 3 16:11:32 2005 @@ -1536,8 +1536,7 @@ /* Clean up resources. */ free_page((unsigned long)xhci->usb_ring.sring); - free_irq(xhci->irq, xhci); - unbind_evtchn_from_irq(xhci->evtchn); + unbind_evtchn_from_irqhandler(xhci->evtchn, xhci); /* Plug the ring. */ xhci->recovery = 1; @@ -1572,7 +1571,6 @@ } xhci->evtchn = status->evtchn; - xhci->irq = bind_evtchn_to_irq(xhci->evtchn); xhci->bandwidth = status->bandwidth; xhci->rh.numports = status->num_ports; @@ -1595,14 +1593,14 @@ usb_claim_bandwidth(xhci->rh.dev, xhci->rh.urb, 1000 - xhci->bandwidth, 0); - if ( (rc = request_irq(xhci->irq, xhci_interrupt, + if ( (rc = bind_evtchn_to_irqhandler(xhci->evtchn, xhci_interrupt, SA_SAMPLE_RANDOM, "usbif", xhci)) ) printk(KERN_ALERT"usbfront request_irq failed (%ld)\n",rc); DPRINTK(KERN_INFO __FILE__ - ": USB XHCI: SHM at %p (0x%lx), EVTCHN %d IRQ %d\n", + ": USB XHCI: SHM at %p (0x%lx), EVTCHN %d\n", xhci->usb_ring.sring, virt_to_machine(xhci->usbif), - xhci->evtchn, xhci->irq); + xhci->evtchn); xhci->state = USBIF_STATE_CONNECTED; diff -r 33bb0b41aa73 -r 60c4cd9ebaa1 linux-2.6-xen-sparse/drivers/xen/usbfront/xhci.h --- a/linux-2.6-xen-sparse/drivers/xen/usbfront/xhci.h Wed Aug 3 14:44:19 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/usbfront/xhci.h Wed Aug 3 16:11:32 2005 @@ -54,7 +54,6 @@ #endif int evtchn; /* Interdom channel to backend */ - int irq; /* Bound to evtchn */ enum { USBIF_STATE_CONNECTED = 2, USBIF_STATE_DISCONNECTED = 1, diff -r 33bb0b41aa73 -r 60c4cd9ebaa1 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c Wed Aug 3 14:44:19 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c Wed Aug 3 16:11:32 2005 @@ -26,7 +26,6 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ -//#define DEBUG #include <asm-xen/hypervisor.h> #include <asm-xen/evtchn.h> @@ -35,8 +34,6 @@ #include <linux/sched.h> #include <linux/err.h> #include "xenbus_comms.h" - -static unsigned int xb_irq; #define RINGBUF_DATASIZE ((PAGE_SIZE / 2) - sizeof(struct ringbuf_head)) struct ringbuf_head @@ -212,9 +209,9 @@ if (!xen_start_info.store_evtchn) return 0; - xb_irq = bind_evtchn_to_irq(xen_start_info.store_evtchn); - - err = request_irq(xb_irq, wake_waiting, 0, "xenbus", &xb_waitq); + err = bind_evtchn_to_irqhandler( + xen_start_info.store_evtchn, wake_waiting, + 0, "xenbus", &xb_waitq); if (err) { printk(KERN_ERR "XENBUS request irq failed %i\n", err); unbind_evtchn_from_irq(xen_start_info.store_evtchn); @@ -234,6 +231,5 @@ if (!xen_start_info.store_evtchn) return; - free_irq(xb_irq, &xb_waitq); - unbind_evtchn_from_irq(xen_start_info.store_evtchn); -} + unbind_evtchn_from_irqhandler(xen_start_info.store_evtchn, &xb_waitq); +} _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |