This patch adds an AioContext parameter to xen_device_bind_event_channel() and then uses aio_set_fd_handler() to set the callback rather than qemu_set_fd_handler().
Signed-off-by: Paul Durrant <paul.durr...@citrix.com> --- Cc: Stefano Stabellini <sstabell...@kernel.org> Cc: Anthony Perard <anthony.per...@citrix.com> Cc: Stefan Hajnoczi <stefa...@redhat.com> Cc: Kevin Wolf <kw...@redhat.com> Cc: Max Reitz <mre...@redhat.com> --- hw/block/dataplane/xen-block.c | 2 +- hw/xen/xen-bus.c | 10 +++++++--- include/hw/xen/xen-bus.h | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/block/dataplane/xen-block.c b/hw/block/dataplane/xen-block.c index bb8f1186e4..1046f965c4 100644 --- a/hw/block/dataplane/xen-block.c +++ b/hw/block/dataplane/xen-block.c @@ -802,7 +802,7 @@ void xen_block_dataplane_start(XenBlockDataPlane *dataplane, } dataplane->event_channel = - xen_device_bind_event_channel(xendev, event_channel, + xen_device_bind_event_channel(xendev, dataplane->ctx, event_channel, xen_block_dataplane_event, dataplane, &local_err); if (local_err) { diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index 9e391492ac..4f634d1291 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -924,6 +924,7 @@ done: struct XenEventChannel { QLIST_ENTRY(XenEventChannel) list; + AioContext *ctx; xenevtchn_handle *xeh; evtchn_port_t local_port; XenEventHandler handler; @@ -943,6 +944,7 @@ static void xen_device_event(void *opaque) } XenEventChannel *xen_device_bind_event_channel(XenDevice *xendev, + AioContext *ctx, unsigned int port, XenEventHandler handler, void *opaque, Error **errp) @@ -968,8 +970,9 @@ XenEventChannel *xen_device_bind_event_channel(XenDevice *xendev, channel->handler = handler; channel->opaque = opaque; - qemu_set_fd_handler(xenevtchn_fd(channel->xeh), xen_device_event, NULL, - channel); + channel->ctx = ctx; + aio_set_fd_handler(channel->ctx, xenevtchn_fd(channel->xeh), false, + xen_device_event, NULL, NULL, channel); QLIST_INSERT_HEAD(&xendev->event_channels, channel, list); @@ -1010,7 +1013,8 @@ void xen_device_unbind_event_channel(XenDevice *xendev, QLIST_REMOVE(channel, list); - qemu_set_fd_handler(xenevtchn_fd(channel->xeh), NULL, NULL, NULL); + aio_set_fd_handler(channel->ctx, xenevtchn_fd(channel->xeh), false, + NULL, NULL, NULL, NULL); if (xenevtchn_unbind(channel->xeh, channel->local_port) < 0) { error_setg_errno(errp, errno, "xenevtchn_unbind failed"); diff --git a/include/hw/xen/xen-bus.h b/include/hw/xen/xen-bus.h index 3315f0de20..8183b98c7d 100644 --- a/include/hw/xen/xen-bus.h +++ b/include/hw/xen/xen-bus.h @@ -122,6 +122,7 @@ void xen_device_copy_grant_refs(XenDevice *xendev, bool to_domain, typedef void (*XenEventHandler)(void *opaque); XenEventChannel *xen_device_bind_event_channel(XenDevice *xendev, + AioContext *ctx, unsigned int port, XenEventHandler handler, void *opaque, Error **errp); -- 2.20.1.2.gb21ebb6