Move more drivers to bind_evtchn_to_irqhandler() interface.

The most important ones are all done now.
Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
kaf24@firebug.cl.cam.ac.uk committed 2005-08-03 16:11:32 +00:00
1 parent 98506e40b1
commit e8657a7dad
12 files changed
+66 -105

No files matched your search

+27 -29
View File
@@ -116,9 +116,9 @@ extern asmlinkage unsigned int do_IRQ(struct pt_regs *regs);
#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 @@ void force_evtchn_callback(void)
/* 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 @@ void unbind_virq_from_irq(int virq)
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 @@ int bind_ipi_to_irq(int ipi)
}
else
{
irq = evtchn_to_irq[evtchn];
irq = evtchn_to_irq[evtchn];
}
irq_bindcount[irq]++;
@@ -291,17 +291,17 @@ void unbind_ipi_from_irq(int ipi)
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);
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);
/* 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 @@ int bind_evtchn_to_irqhandler(
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 @@ static void rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
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 @@ static void rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
* 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 @@ static void rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
* 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 @@ void irq_resume(void)
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 @@ void __init init_IRQ(void)
#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. */
@@ -32,29 +32,20 @@ static void __blkif_disconnect_complete(void *arg)
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 @@ static void __blkif_disconnect_complete(void *arg)
* 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 @@ int blkif_disconnect(blkif_be_disconnect_t *disconnect, u8 rsp_id)
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. */
@@ -71,7 +71,6 @@ typedef struct blkif_st {
/* Physical parameters of the comms window. */
unsigned long shmem_frame;
unsigned int evtchn;
int irq;
/* Comms information. */
blkif_back_ring_t blk_ring;
@@ -16,16 +16,15 @@ static char *blkif_state_name[] = {
[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 @@ static void __blkif_disconnect_complete(void *arg)
* 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 @@ void blkif_ptfe_connect(blkif_be_connect_t *connect)
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 @@ int blkif_ptfe_disconnect(blkif_be_disconnect_t *disconnect, u8 rsp_id)
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 @@ static void blkif_ptbe_connect(blkif_fe_interface_status_t *status)
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
@@ -42,7 +42,6 @@ typedef struct netif_st {
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;
@@ -33,7 +33,8 @@ static void __netif_up(netif_t *netif)
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 @@ static void __netif_down(netif_t *netif)
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 @@ static void __netif_disconnect_complete(void *arg)
* 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 @@ void netif_connect(netif_be_connect_t *connect)
}
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 =
@@ -152,7 +152,6 @@ struct net_private
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 @@ static void vif_show(struct net_private *np)
{
#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 @@ static void vif_release(struct net_private *np)
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 @@ vif_connect(struct net_private *np, netif_fe_interface_status_t *status)
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 netif_exit(void)
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)
@@ -37,7 +37,6 @@ struct usbif_priv_st {
/* 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. */
@@ -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 @@ static void __usbif_disconnect_complete(void *arg)
* 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 @@ void usbif_connect(usbif_be_connect_t *connect)
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 @@ int usbif_disconnect(usbif_be_disconnect_t *disconnect, u8 rsp_id)
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. */
@@ -1536,8 +1536,7 @@ static void usbif_status_change(usbif_fe_interface_status_changed_t *status)
/* 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 @@ static void usbif_status_change(usbif_fe_interface_status_changed_t *status)
}
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 @@ static void usbif_status_change(usbif_fe_interface_status_changed_t *status)
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;
@@ -54,7 +54,6 @@ struct xhci {
#endif
int evtchn; /* Interdom channel to backend */
int irq; /* Bound to evtchn */
enum {
USBIF_STATE_CONNECTED = 2,
USBIF_STATE_DISCONNECTED = 1,
@@ -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>
@@ -36,8 +35,6 @@
#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 @@ int xb_init_comms(void)
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 @@ void xb_suspend_comms(void)
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);
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.