From: Anthony PERARD <anthony.perard@citrix.com>
To: <qemu-devel@nongnu.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
xen-devel@lists.xenproject.org,
Peter Maydell <peter.maydell@linaro.org>
Subject: [Qemu-devel] [PULL 3/8] xen-bus: allow AioContext to be specified for each event channel
Date: Mon, 24 Jun 2019 16:32:52 +0100 [thread overview]
Message-ID: <20190624153257.20163-4-anthony.perard@citrix.com> (raw)
In-Reply-To: <20190624153257.20163-1-anthony.perard@citrix.com>
From: Paul Durrant <paul.durrant@citrix.com>
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.durrant@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Message-Id: <20190408151617.13025-3-paul.durrant@citrix.com>
[Call aio_set_fd_handler() with is_external=true]
Signed-off-by: Anthony PERARD <anthony.perard@citrix.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 6da5c77fbb..aadca75644 100644
--- a/hw/block/dataplane/xen-block.c
+++ b/hw/block/dataplane/xen-block.c
@@ -806,7 +806,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 43a90cae42..2210526490 100644
--- a/hw/xen/xen-bus.c
+++ b/hw/xen/xen-bus.c
@@ -925,6 +925,7 @@ void xen_device_copy_grant_refs(XenDevice *xendev, bool to_domain,
struct XenEventChannel {
QLIST_ENTRY(XenEventChannel) list;
+ AioContext *ctx;
xenevtchn_handle *xeh;
evtchn_port_t local_port;
XenEventHandler handler;
@@ -944,6 +945,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)
@@ -969,8 +971,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), true,
+ xen_device_event, NULL, NULL, channel);
QLIST_INSERT_HEAD(&xendev->event_channels, channel, list);
@@ -1011,7 +1014,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), true,
+ 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);
--
Anthony PERARD
next prev parent reply other threads:[~2019-06-24 15:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-24 15:32 [Qemu-devel] [PULL 0/8] xen queue 2019-06-24 Anthony PERARD
2019-06-24 15:32 ` [Qemu-devel] [PULL 1/8] xen-block: support feature-large-sector-size Anthony PERARD
2019-06-24 15:32 ` [Qemu-devel] [PULL 2/8] xen-bus: use a separate fd for each event channel Anthony PERARD
2019-06-24 15:32 ` Anthony PERARD [this message]
2019-06-24 15:32 ` [Qemu-devel] [PULL 4/8] xen-bus / xen-block: add support for event channel polling Anthony PERARD
2019-06-24 15:32 ` [Qemu-devel] [PULL 5/8] xen: Avoid VLA Anthony PERARD
2019-06-24 15:32 ` [Qemu-devel] [PULL 6/8] xen: Drop includes of xen/hvm/params.h Anthony PERARD
2019-06-24 15:32 ` [Qemu-devel] [PULL 7/8] Revert xen/io/ring.h of "Clean up a few header guard symbols" Anthony PERARD
2019-06-24 15:32 ` [Qemu-devel] [PULL 8/8] xen: Import other xen/io/*.h Anthony PERARD
2019-06-24 16:10 ` [Qemu-devel] [Xen-devel] [PULL 0/8] xen queue 2019-06-24 no-reply
2019-06-24 16:28 ` no-reply
2019-06-24 16:34 ` no-reply
2019-06-24 16:48 ` no-reply
2019-06-24 17:19 ` no-reply
2019-07-01 12:45 ` [Qemu-devel] " Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190624153257.20163-4-anthony.perard@citrix.com \
--to=anthony.perard@citrix.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).