From patchwork Mon Apr 8 15:16:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 1081154 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=citrix.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44dDZc6XP5z9sPP for ; Tue, 9 Apr 2019 01:18:16 +1000 (AEST) Received: from localhost ([127.0.0.1]:54676 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDW2I-00037V-MZ for incoming@patchwork.ozlabs.org; Mon, 08 Apr 2019 11:18:14 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDW1L-0002wV-1P for qemu-devel@nongnu.org; Mon, 08 Apr 2019 11:17:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hDW1J-00024M-Sm for qemu-devel@nongnu.org; Mon, 08 Apr 2019 11:17:15 -0400 Received: from smtp03.citrix.com ([162.221.156.55]:43196) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hDW1A-00010C-0A; Mon, 08 Apr 2019 11:17:05 -0400 X-IronPort-AV: E=Sophos;i="5.60,325,1549929600"; d="scan'208";a="83016892" From: Paul Durrant To: , , Date: Mon, 8 Apr 2019 16:16:16 +0100 Message-ID: <20190408151617.13025-3-paul.durrant@citrix.com> X-Mailer: git-send-email 2.20.1.2.gb21ebb6 In-Reply-To: <20190408151617.13025-1-paul.durrant@citrix.com> References: <20190408151617.13025-1-paul.durrant@citrix.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 162.221.156.55 Subject: [Qemu-devel] [PATCH 2/3] xen-bus: allow AioContext to be specified for each event channel X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Stefano Stabellini , Max Reitz , Paul Durrant , Stefan Hajnoczi , Anthony Perard Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 Reviewed-by: Anthony PERARD --- Cc: Stefano Stabellini Cc: Anthony Perard Cc: Stefan Hajnoczi Cc: Kevin Wolf Cc: Max Reitz --- 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);