From nobody Sun Feb 8 14:08:52 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547230462517197.9101560430364; Fri, 11 Jan 2019 10:14:22 -0800 (PST) Received: from localhost ([127.0.0.1]:38013 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gi1Ju-0005Hf-Gn for importer@patchew.org; Fri, 11 Jan 2019 13:14:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gi1G2-0002h2-Pu for qemu-devel@nongnu.org; Fri, 11 Jan 2019 13:10:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gi1G0-0005tR-5n for qemu-devel@nongnu.org; Fri, 11 Jan 2019 13:10:14 -0500 Received: from smtp03.citrix.com ([162.221.156.55]:57209) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gi1Fz-0005qo-T8 for qemu-devel@nongnu.org; Fri, 11 Jan 2019 13:10:12 -0500 X-IronPort-AV: E=Sophos;i="5.56,466,1539648000"; d="scan'208";a="75390760" From: Anthony PERARD To: Date: Fri, 11 Jan 2019 18:09:41 +0000 Message-ID: <20190111180941.6198-1-anthony.perard@citrix.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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] xen: Fix event channel interface for XenDevice-s 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: Anthony PERARD , "open list:X86" , Stefano Stabellini , Paul Durrant Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Patch "xen: add event channel interface for XenDevice-s" makes use of the type xenevtchn_port_or_error_t, but this isn't avaiable before Xen 4.7. Also the function xen_device_bind_event_channel assign the return value of xenevtchn_bind_interdomain to channel->local_port but check the result for error with xendev->local_port. Fix by: - removing local_port from struct XenDevice as it isn't use anywere. - adding a compatibility typedef for xenevtchn_port_or_error_t for Xen 4.6 and earlier. As extra, replace the type of XenEventChannel->local_port by evtchn_port_t. Signed-off-by: Anthony PERARD Reviewed-by: Paul Durrant --- hw/xen/xen-bus.c | 12 +++++++----- include/hw/xen/xen-bus.h | 1 - include/hw/xen/xen_common.h | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index f90bcf2342..3aeccec69c 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -917,7 +917,7 @@ void xen_device_copy_grant_refs(XenDevice *xendev, bool= to_domain, } =20 struct XenEventChannel { - unsigned int local_port; + evtchn_port_t local_port; XenEventHandler handler; void *opaque; Notifier notifier; @@ -939,17 +939,19 @@ XenEventChannel *xen_device_bind_event_channel(XenDev= ice *xendev, void *opaque, Error **errp) { XenEventChannel *channel =3D g_new0(XenEventChannel, 1); + xenevtchn_port_or_error_t local_port; =20 - channel->local_port =3D xenevtchn_bind_interdomain(xendev->xeh, - xendev->frontend_id, - port); - if (xendev->local_port < 0) { + local_port =3D xenevtchn_bind_interdomain(xendev->xeh, + xendev->frontend_id, + port); + if (local_port < 0) { error_setg_errno(errp, errno, "xenevtchn_bind_interdomain failed"); =20 g_free(channel); return NULL; } =20 + channel->local_port =3D local_port; channel->handler =3D handler; channel->opaque =3D opaque; channel->notifier.notify =3D event_notify; diff --git a/include/hw/xen/xen-bus.h b/include/hw/xen/xen-bus.h index e55a5de5f1..3183f10e3c 100644 --- a/include/hw/xen/xen-bus.h +++ b/include/hw/xen/xen-bus.h @@ -29,7 +29,6 @@ typedef struct XenDevice { xengnttab_handle *xgth; bool feature_grant_copy; xenevtchn_handle *xeh; - xenevtchn_port_or_error_t local_port; NotifierList event_notifiers; } XenDevice; =20 diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h index 2b91d199a1..9a8155e172 100644 --- a/include/hw/xen/xen_common.h +++ b/include/hw/xen/xen_common.h @@ -32,6 +32,7 @@ extern xc_interface *xen_xc; typedef xc_interface xenforeignmemory_handle; typedef xc_evtchn xenevtchn_handle; typedef xc_gnttab xengnttab_handle; +typedef evtchn_port_or_error_t xenevtchn_port_or_error_t; =20 #define xenevtchn_open(l, f) xc_evtchn_open(l, f); #define xenevtchn_close(h) xc_evtchn_close(h) --=20 Anthony PERARD