From patchwork Thu May 17 15:35:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 915508 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=2001:4830:134:3::11; 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 [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40mwQq261zz9s4V for ; Fri, 18 May 2018 01:37:07 +1000 (AEST) Received: from localhost ([::1]:32933 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJKxk-0005HR-QS for incoming@patchwork.ozlabs.org; Thu, 17 May 2018 11:37:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50493) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJKwx-0005FT-Aw for qemu-devel@nongnu.org; Thu, 17 May 2018 11:36:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJKws-0006Ss-9i for qemu-devel@nongnu.org; Thu, 17 May 2018 11:36:15 -0400 Received: from smtp03.citrix.com ([162.221.156.55]:38427) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fJKwr-0006SY-V9; Thu, 17 May 2018 11:36:10 -0400 X-IronPort-AV: E=Sophos;i="5.49,411,1520899200"; d="scan'208";a="54916625" From: Paul Durrant To: , , Date: Thu, 17 May 2018 16:35:50 +0100 Message-ID: <1526571358-26685-2-git-send-email-paul.durrant@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1526571358-26685-1-git-send-email-paul.durrant@citrix.com> References: <1526571358-26685-1-git-send-email-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 v4 1/9] xen: add a meaningful declaration of grant_copy_segment into xen_common.h 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 , Paul Durrant , Stefano Stabellini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Currently the xen_disk source has to carry #ifdef exclusions to compile against Xen older then 4.8. This is a bit messy so this patch lifts the definition of struct xengnttab_grant_copy_segment and adds it into the pre-4.8 compat area in xen_common.h, which allows xen_disk to be cleaned up. Signed-off-by: Paul Durrant Acked-by: Anthony PERARD --- Cc: Stefano Stabellini Cc: Anthony Perard v4: - New in v4 --- hw/block/xen_disk.c | 18 ------------------ include/hw/xen/xen_common.h | 17 +++++++++++++++-- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index f74fcd4..78bfb41 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -496,8 +496,6 @@ static int ioreq_map(struct ioreq *ioreq) return 0; } -#if CONFIG_XEN_CTRL_INTERFACE_VERSION >= 40800 - static void ioreq_free_copy_buffers(struct ioreq *ioreq) { int i; @@ -579,22 +577,6 @@ static int ioreq_grant_copy(struct ioreq *ioreq) return rc; } -#else -static void ioreq_free_copy_buffers(struct ioreq *ioreq) -{ - abort(); -} - -static int ioreq_init_copy_buffers(struct ioreq *ioreq) -{ - abort(); -} - -static int ioreq_grant_copy(struct ioreq *ioreq) -{ - abort(); -} -#endif static int ioreq_runio_qemu_aio(struct ioreq *ioreq); diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h index 5f1402b..bbf207d 100644 --- a/include/hw/xen/xen_common.h +++ b/include/hw/xen/xen_common.h @@ -667,8 +667,21 @@ static inline int xen_domain_create(xc_interface *xc, uint32_t ssidref, #if CONFIG_XEN_CTRL_INTERFACE_VERSION < 40800 - -typedef void *xengnttab_grant_copy_segment_t; +struct xengnttab_grant_copy_segment { + union xengnttab_copy_ptr { + void *virt; + struct { + uint32_t ref; + uint16_t offset; + uint16_t domid; + } foreign; + } source, dest; + uint16_t len; + uint16_t flags; + int16_t status; +}; + +typedef struct xengnttab_grant_copy_segment xengnttab_grant_copy_segment_t; static inline int xengnttab_grant_copy(xengnttab_handle *xgt, uint32_t count, xengnttab_grant_copy_segment_t *segs)