From patchwork Mon Sep 19 15:58:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 9339861 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 34446607D0 for ; Mon, 19 Sep 2016 16:14:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2315229550 for ; Mon, 19 Sep 2016 16:14:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1629C29569; Mon, 19 Sep 2016 16:14:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3A92229550 for ; Mon, 19 Sep 2016 16:14:20 +0000 (UTC) Received: from localhost ([::1]:56512 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bm1D0-0005mN-Pm for patchwork-qemu-devel@patchwork.kernel.org; Mon, 19 Sep 2016 12:14:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bm0xq-0001bd-0m for qemu-devel@nongnu.org; Mon, 19 Sep 2016 11:58:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bm0xk-0007eO-3J for qemu-devel@nongnu.org; Mon, 19 Sep 2016 11:58:37 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:28851) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bm0xj-0007dy-U9 for qemu-devel@nongnu.org; Mon, 19 Sep 2016 11:58:32 -0400 X-IronPort-AV: E=Sophos;i="5.30,362,1470700800"; d="scan'208";a="387391935" Date: Mon, 19 Sep 2016 16:58:23 +0100 From: Wei Liu To: Paulina Szubarczyk Message-ID: <20160919155823.GP30319@citrix.com> References: <1473880203-4360-1-git-send-email-paulinaszubarczyk@gmail.com> <1473880203-4360-2-git-send-email-paulinaszubarczyk@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1473880203-4360-2-git-send-email-paulinaszubarczyk@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-DLP: MIA1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.63 Subject: Re: [Qemu-devel] [PATCH v7 1/2] libs/gnttab: introduce grant copy interface 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: sstabellini@kernel.org, wei.liu2@citrix.com, ian.jackson@eu.citrix.com, qemu-devel@nongnu.org, david.vrabel@citrix.com, anthony.perard@citrix.com, xen-devel@lists.xenproject.org, roger.pau@citrix.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Sep 14, 2016 at 09:10:02PM +0200, Paulina Szubarczyk wrote: > In a linux part an ioctl(gntdev, IOCTL_GNTDEV_GRANT_COPY, ..) > system call is invoked. In mini-os the operation is yet not > implemented. For the OSs that does not implement gnttab the > call of the grant copy operation causes abort. > > Signed-off-by: Paulina Szubarczyk > Reviewed-by: David Vrabel Paulina, this is mostly for your information. No action is needed on your side. Thanks for putting in the effort to contribute to Xen. Because Ian prefers another way of dealing with BUILD_BUG_ON, I've sent out another patch for that. I also write the following patch to fix up this patch. ---8<--- From 096fef32bffaef5b3e273bdfe75d620d8a7c8792 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Mon, 19 Sep 2016 16:50:35 +0100 Subject: [PATCH] fixup! libs/gnttab: introduce grant copy interface --- tools/libs/gnttab/linux.c | 116 +++++++++++++++++++++++----------------------- 1 file changed, 59 insertions(+), 57 deletions(-) diff --git a/tools/libs/gnttab/linux.c b/tools/libs/gnttab/linux.c index 6bd9bd2..69b7e26 100644 --- a/tools/libs/gnttab/linux.c +++ b/tools/libs/gnttab/linux.c @@ -31,6 +31,8 @@ #include #include +#include + #include "private.h" #define DEVXEN "/dev/xen/" @@ -244,63 +246,63 @@ int osdep_gnttab_grant_copy(xengnttab_handle *xgt, int fd = xgt->fd; struct ioctl_gntdev_grant_copy copy; - XENGNTTAB_BUILD_BUG_ON(sizeof(struct ioctl_gntdev_grant_copy_segment) != - sizeof(xengnttab_grant_copy_segment_t)); - - XENGNTTAB_BUILD_BUG_ON(__alignof__(struct ioctl_gntdev_grant_copy_segment) != - __alignof__(xengnttab_grant_copy_segment_t)); - - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - source.virt) != - offsetof(xengnttab_grant_copy_segment_t, - source.virt)); - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - source.foreign) != - offsetof(xengnttab_grant_copy_segment_t, - source.foreign)); - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - source.foreign.ref) != - offsetof(xengnttab_grant_copy_segment_t, - source.foreign)); - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - source.foreign.offset) != - offsetof(xengnttab_grant_copy_segment_t, - source.foreign.offset)); - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - source.foreign.domid) != - offsetof(xengnttab_grant_copy_segment_t, - source.foreign.domid)); - - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - dest.virt) != - offsetof(xengnttab_grant_copy_segment_t, - dest.virt)); - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - dest.foreign) != - offsetof(xengnttab_grant_copy_segment_t, - dest.foreign)); - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - dest.foreign.ref) != - offsetof(xengnttab_grant_copy_segment_t, - dest.foreign)); - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - dest.foreign.offset) != - offsetof(xengnttab_grant_copy_segment_t, - dest.foreign.offset)); - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - dest.foreign.domid) != - offsetof(xengnttab_grant_copy_segment_t, - dest.foreign.domid)); - - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - len) != - offsetof(xengnttab_grant_copy_segment_t, len)); - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - flags) != - offsetof(xengnttab_grant_copy_segment_t, flags)); - XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, - status) != - offsetof(xengnttab_grant_copy_segment_t, status)); + BUILD_BUG_ON(sizeof(struct ioctl_gntdev_grant_copy_segment) != + sizeof(xengnttab_grant_copy_segment_t)); + + BUILD_BUG_ON(__alignof__(struct ioctl_gntdev_grant_copy_segment) != + __alignof__(xengnttab_grant_copy_segment_t)); + + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + source.virt) != + offsetof(xengnttab_grant_copy_segment_t, + source.virt)); + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + source.foreign) != + offsetof(xengnttab_grant_copy_segment_t, + source.foreign)); + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + source.foreign.ref) != + offsetof(xengnttab_grant_copy_segment_t, + source.foreign)); + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + source.foreign.offset) != + offsetof(xengnttab_grant_copy_segment_t, + source.foreign.offset)); + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + source.foreign.domid) != + offsetof(xengnttab_grant_copy_segment_t, + source.foreign.domid)); + + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + dest.virt) != + offsetof(xengnttab_grant_copy_segment_t, + dest.virt)); + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + dest.foreign) != + offsetof(xengnttab_grant_copy_segment_t, + dest.foreign)); + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + dest.foreign.ref) != + offsetof(xengnttab_grant_copy_segment_t, + dest.foreign)); + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + dest.foreign.offset) != + offsetof(xengnttab_grant_copy_segment_t, + dest.foreign.offset)); + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + dest.foreign.domid) != + offsetof(xengnttab_grant_copy_segment_t, + dest.foreign.domid)); + + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + len) != + offsetof(xengnttab_grant_copy_segment_t, len)); + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + flags) != + offsetof(xengnttab_grant_copy_segment_t, flags)); + BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment, + status) != + offsetof(xengnttab_grant_copy_segment_t, status)); copy.segments = (struct ioctl_gntdev_grant_copy_segment *)segs; copy.count = count;