From patchwork Wed Oct 19 19:20:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 9385203 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 A993E60487 for ; Wed, 19 Oct 2016 19:23:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90C402966D for ; Wed, 19 Oct 2016 19:23:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84A5429699; Wed, 19 Oct 2016 19:23:55 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 613B72966D for ; Wed, 19 Oct 2016 19:23:53 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bwwPr-0007jJ-HD; Wed, 19 Oct 2016 19:20:43 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bwwPq-0007jD-Au for xen-devel@lists.xenproject.org; Wed, 19 Oct 2016 19:20:42 +0000 Received: from [193.109.254.147] by server-2.bemta-6.messagelabs.com id 2D/03-26478-987C7085; Wed, 19 Oct 2016 19:20:41 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsVybKJsh27HcfY Ig903bCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyDh6+wF6wQrFj+byJLA+Ne3i5GLg4hgamM EnPmTmWFcGYySZxrWMjSxcjJwSKgLXH17l9GEJtNwFDi75NNbF2MHBwSQPaSzxwgYREBfYlNt xvZQXqZBT4zSTTs62YFSQgLOEs8P3eBGaSeU8BH4sB7XxCTV8Bb4u3nQohVmxklPnybCLZKVE BX4tC/P2wgNq+AoMTJmU/A4swCWhLLp28DsyUEMiTm9cxhhbC9JBbduARlq0lcPbeJeQKj4Cw k7bOQtC9gZFrFqFGcWlSWWqRrZKCXVJSZnlGSm5iZo2toYKaXm1pcnJiempOYVKyXnJ+7iREY ngxAsIPx17KAQ4ySHExKorw8fewRQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4W48B5QSLUtNTK 9Iyc4CRApOW4OBREuH9ApLmLS5IzC3OTIdInWJUlBLnXQ2SEABJZJTmwbXBovMSo6yUMC8j0C FCPAWpRbmZJajyrxjFORiVhHmbQKbwZOaVwE1/BbSYCWjxuTwWkMUliQgpqQbGY0JtsRPb+i6 +XLcr/tCJv7xGZzeY/rfnYD3B6HT3l5s5i2TkYYl7dydEBZ+TtxT1nb3s/GqbP+K3DjqtfsFt Id3Ap35iocuPA6lBtyInrWtrzEs4cvT/ze3zvUyWTPx6OmLf1CN7Tm7692TP1Ptz5h9dLNQsy H+601bH68kUoUlFroq2PZo/7iixFGckGmoxFxUnAgC6+H4oyQIAAA== X-Env-Sender: sstabellini@kernel.org X-Msg-Ref: server-4.tower-27.messagelabs.com!1476904839!65488114!1 X-Originating-IP: [198.145.29.136] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.0.13; banners=-,-,- X-VirusChecked: Checked Received: (qmail 45812 invoked from network); 19 Oct 2016 19:20:40 -0000 Received: from mail.kernel.org (HELO mail.kernel.org) (198.145.29.136) by server-4.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 19 Oct 2016 19:20:40 -0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0AB4D2035E; Wed, 19 Oct 2016 19:20:38 +0000 (UTC) Received: from [10.1.10.56] (96-82-76-110-static.hfc.comcastbusiness.net [96.82.76.110]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 986942034E; Wed, 19 Oct 2016 19:20:36 +0000 (UTC) Date: Wed, 19 Oct 2016 12:20:35 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-X260 To: Stefano Stabellini In-Reply-To: Message-ID: References: <1476874004-10969-1-git-send-email-wei.liu2@citrix.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP Cc: Juergen Gross , Wei Liu , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Jan Beulich , Xen-devel Subject: Re: [Xen-devel] [PATCH RFC 0/2] Fix PAGE_SIZE issues in public headers X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Wed, 19 Oct 2016, Stefano Stabellini wrote: > On Wed, 19 Oct 2016, Juergen Gross wrote: > > On 19/10/16 12:46, Wei Liu wrote: > > > Reference to PAGE_SIZE slipped in to two public header files. QEMU build on > > > ARM64 is broken by this. > > > > > > This series tries to fix that. The approach is discussed at [0]. > > > > > > QEMU will need to update its copy of usbif.h. > > > > There is no QEMU copy of Xen headers. This is the reason why an > > imcompatible change is not possible. With the patches there is no > > longer an urgent need for qemu to be modified. > > Yes, as long as we backport the fixes to the Xen stable trees as soon as > possible. I spoke too soon. Actually QEMU xen-usb.c references PAGE_SIZE directly, which also needs to be fixed. In this case, I think I would use XC_PAGE_SIZE, because we are already using it in that file and because this way we don't tie the fix with the public headers fixes in Xen. Reviewed-by: Juergen Gross --- xen-usb: do not reference PAGE_SIZE PAGE_SIZE is undefined on ARM64. Use XC_PAGE_SIZE instead, which is always 4096 even when page granularity is 64K. For this to actually work with 64K pages, more changes are required. Signed-off-by: Stefano Stabellini diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c index 174d715..de2ebd6 100644 --- a/hw/usb/xen-usb.c +++ b/hw/usb/xen-usb.c @@ -160,7 +160,7 @@ static int usbback_gnttab_map(struct usbback_req *usbback_req) for (i = 0; i < nr_segs; i++) { if ((unsigned)usbback_req->req.seg[i].offset + - (unsigned)usbback_req->req.seg[i].length > PAGE_SIZE) { + (unsigned)usbback_req->req.seg[i].length > XC_PAGE_SIZE) { xen_be_printf(xendev, 0, "segment crosses page boundary\n"); return -EINVAL; } @@ -183,7 +183,7 @@ static int usbback_gnttab_map(struct usbback_req *usbback_req) for (i = 0; i < usbback_req->nr_buffer_segs; i++) { seg = usbback_req->req.seg + i; - addr = usbback_req->buffer + i * PAGE_SIZE + seg->offset; + addr = usbback_req->buffer + i * XC_PAGE_SIZE + seg->offset; qemu_iovec_add(&usbback_req->packet.iov, addr, seg->length); } }