summaryrefslogtreecommitdiffstats
path: root/sys/dev/xen/blkback/blkback.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/xen/blkback/blkback.c')
-rw-r--r--sys/dev/xen/blkback/blkback.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/sys/dev/xen/blkback/blkback.c b/sys/dev/xen/blkback/blkback.c
index 4208702..33f6faf 100644
--- a/sys/dev/xen/blkback/blkback.c
+++ b/sys/dev/xen/blkback/blkback.c
@@ -70,14 +70,13 @@ __FBSDID("$FreeBSD$");
#include <geom/geom.h>
#include <machine/_inttypes.h>
-#include <machine/xen/xen-os.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
#include <vm/vm_kern.h>
+#include <xen/xen-os.h>
#include <xen/blkif.h>
-#include <xen/evtchn.h>
#include <xen/gnttab.h>
#include <xen/xen_intr.h>
@@ -682,7 +681,7 @@ struct xbb_softc {
blkif_back_rings_t rings;
/** IRQ mapping for the communication ring event channel. */
- int irq;
+ xen_intr_handle_t xen_intr_handle;
/**
* \brief Backend access mode flags (e.g. write, or read-only).
@@ -1347,7 +1346,7 @@ xbb_send_response(struct xbb_softc *xbb, struct xbb_xen_req *req, int status)
taskqueue_enqueue(xbb->io_taskqueue, &xbb->io_task);
if (notify)
- notify_remote_via_irq(xbb->irq);
+ xen_intr_signal(xbb->xen_intr_handle);
}
/**
@@ -1616,8 +1615,8 @@ xbb_dispatch_io(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist)
sg = NULL;
/* Check that number of segments is sane. */
- if (unlikely(nseg == 0)
- || unlikely(nseg > xbb->max_request_segments)) {
+ if (__predict_false(nseg == 0)
+ || __predict_false(nseg > xbb->max_request_segments)) {
DPRINTF("Bad number of segments in request (%d)\n",
nseg);
reqlist->status = BLKIF_RSP_ERROR;
@@ -1734,7 +1733,7 @@ xbb_dispatch_io(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist)
for (seg_idx = 0, map = xbb->maps; seg_idx < reqlist->nr_segments;
seg_idx++, map++){
- if (unlikely(map->status != 0)) {
+ if (__predict_false(map->status != 0)) {
DPRINTF("invalid buffer -- could not remap "
"it (%d)\n", map->status);
DPRINTF("Mapping(%d): Host Addr 0x%lx, flags "
@@ -2026,14 +2025,16 @@ xbb_run_queue(void *context, int pending)
* \param arg Callback argument registerd during event channel
* binding - the xbb_softc for this instance.
*/
-static void
-xbb_intr(void *arg)
+static int
+xbb_filter(void *arg)
{
struct xbb_softc *xbb;
- /* Defer to kernel thread. */
+ /* Defer to taskqueue thread. */
xbb = (struct xbb_softc *)arg;
taskqueue_enqueue(xbb->io_taskqueue, &xbb->io_task);
+
+ return (FILTER_HANDLED);
}
SDT_PROVIDER_DEFINE(xbb);
@@ -2081,7 +2082,7 @@ xbb_dispatch_dev(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist,
if (operation == BIO_FLUSH) {
nreq = STAILQ_FIRST(&reqlist->contig_req_list);
bio = g_new_bio();
- if (unlikely(bio == NULL)) {
+ if (__predict_false(bio == NULL)) {
DPRINTF("Unable to allocate bio for BIO_FLUSH\n");
error = ENOMEM;
return (error);
@@ -2143,7 +2144,7 @@ xbb_dispatch_dev(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist,
}
bio = bios[nbio++] = g_new_bio();
- if (unlikely(bio == NULL)) {
+ if (__predict_false(bio == NULL)) {
error = ENOMEM;
goto fail_free_bios;
}
@@ -2811,10 +2812,7 @@ xbb_disconnect(struct xbb_softc *xbb)
if ((xbb->flags & XBBF_RING_CONNECTED) == 0)
return (0);
- if (xbb->irq != 0) {
- unbind_from_irqhandler(xbb->irq);
- xbb->irq = 0;
- }
+ xen_intr_unbind(&xbb->xen_intr_handle);
mtx_unlock(&xbb->lock);
taskqueue_drain(xbb->io_taskqueue, &xbb->io_task);
@@ -2966,13 +2964,14 @@ xbb_connect_ring(struct xbb_softc *xbb)
xbb->flags |= XBBF_RING_CONNECTED;
- error =
- bind_interdomain_evtchn_to_irqhandler(xbb->otherend_id,
- xbb->ring_config.evtchn,
- device_get_nameunit(xbb->dev),
- xbb_intr, /*arg*/xbb,
- INTR_TYPE_BIO | INTR_MPSAFE,
- &xbb->irq);
+ error = xen_intr_bind_remote_port(xbb->dev,
+ xbb->otherend_id,
+ xbb->ring_config.evtchn,
+ xbb_filter,
+ /*ithread_handler*/NULL,
+ /*arg*/xbb,
+ INTR_TYPE_BIO | INTR_MPSAFE,
+ &xbb->xen_intr_handle);
if (error) {
(void)xbb_disconnect(xbb);
xenbus_dev_fatal(xbb->dev, error, "binding event channel");
@@ -3791,9 +3790,10 @@ xbb_attach(device_t dev)
* Create a taskqueue for doing work that must occur from a
* thread context.
*/
- xbb->io_taskqueue = taskqueue_create(device_get_nameunit(dev), M_NOWAIT,
- taskqueue_thread_enqueue,
- /*context*/&xbb->io_taskqueue);
+ xbb->io_taskqueue = taskqueue_create_fast(device_get_nameunit(dev),
+ M_NOWAIT,
+ taskqueue_thread_enqueue,
+ /*contxt*/&xbb->io_taskqueue);
if (xbb->io_taskqueue == NULL) {
xbb_attach_failed(xbb, error, "Unable to create taskqueue");
return (ENOMEM);
OpenPOWER on IntegriCloud