From patchwork Tue Oct 18 19:09:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 9382819 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 AEBC360487 for ; Tue, 18 Oct 2016 19:12:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9ECFE29749 for ; Tue, 18 Oct 2016 19:12:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93AC42974B; Tue, 18 Oct 2016 19:12:18 +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 90A7129749 for ; Tue, 18 Oct 2016 19:12:16 +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 1bwZm3-0001VA-09; Tue, 18 Oct 2016 19:10:07 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bwZm1-0001T1-MD for xen-devel@lists.xenproject.org; Tue, 18 Oct 2016 19:10:05 +0000 Received: from [85.158.137.68] by server-4.bemta-3.messagelabs.com id 52/9D-15788-C8376085; Tue, 18 Oct 2016 19:10:04 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFIsWRWlGSWpSXmKPExsVybKJsh25nMVu EwZ9tAhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8akGbvZCq6JV1z7dY61gXGucBcjF4eQwFRG iddbm5ggnJlMEss6rzJ2MXJysAhoS/Qdn8wOYrMJGEr8fbKJrYuRg0MCyF7ymQMkLCKgJHFv1 WSwXmaBXkaJBctPsYEkhAUsJU7veMoEYvMKeEv8mbSeGcQWFdCVOPTvDxtEXFDi5MwnLCA2s4 CvxOEHy5ggbG+Jp1tXgNVLCGRIzOuZwwphe0ksunEJylaTuHpuE/MERoFZSEbNQjJqFpJRELa 6xMHtDxghbHmJbddXscLUvDn7iWkBI9sqRvXi1KKy1CJdM72kosz0jJLcxMwcXUMDY73c1OLi xPTUnMSkYr3k/NxNjMAwr2dgYNzBeKXN+RCjJAeTkihvqzdbhBBfUn5KZUZicUZ8UWlOavEhR hkODiUJ3tQioJxgUWp6akVaZg4w4mDSEhw8SiK8vSBp3uKCxNzizHSI1ClGRSlxXk+QhABIIq M0D64NFuWXGGWlhHkZGRgYhHgKUotyM0tQ5V8xinMwKgnzVoJM4cnMK4Gb/gpoMRPQ4nN5LCC LSxIRUlINjML7Sqp79mRePOwbfU1BMKFTu65T6aHU5rMPzzYb1y99KJH1luHUWhMTy4BP26Xd 7Jokv59rM1glquKyxE3mgcS3BQ9je2cyu1j94JlW8Dk3UvnDzl9HvzxT+uDgzNjIwXrn7mW2e TM2/Mi4t2b2X4eoTxGNnJ+53s2I0VLjW/Dtx5F/09KUmpVYijMSDbWYi4oTAdki1K/tAgAA X-Env-Sender: sstabellini@kernel.org X-Msg-Ref: server-12.tower-31.messagelabs.com!1476817799!50016523!1 X-Originating-IP: [198.145.29.136] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 50350 invoked from network); 18 Oct 2016 19:10:00 -0000 Received: from mail.kernel.org (HELO mail.kernel.org) (198.145.29.136) by server-12.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 18 Oct 2016 19:10:00 -0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 263C0202EB; Tue, 18 Oct 2016 19:09:58 +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 9F423202E5; Tue, 18 Oct 2016 19:09:56 +0000 (UTC) Date: Tue, 18 Oct 2016 12:09:55 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-X260 To: xen-devel@lists.xenproject.org Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-ID: X-Virus-Scanned: ClamAV using ClamSMTP Cc: jgross@suse.com, sstabellini@kernel.org, wei.liu2@citrix.com, qemu-devel@nongnu.org, julien.grall@arm.com, anthony.perard@citrix.com Subject: [Xen-devel] [PATCH] xen-usb.c/usbif.h: fix ARM64 build issue 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 Hi all, While I was investigating the recent libxl ARM64 build issue, I found another ARM64 build problem. This one is in QEMU: CC hw/usb/xen-usb.o hw/usb/xen-usb.c: In function ‘usbback_gnttab_map’: hw/usb/xen-usb.c:163:56: error: ‘PAGE_SIZE’ undeclared (first use in this function) (unsigned)usbback_req->req.seg[i].length > PAGE_SIZE) { ^ hw/usb/xen-usb.c:163:56: note: each undeclared identifier is reported only once for each function it appears in In file included from hw/usb/xen-usb.c:36:0: hw/usb/xen-usb.c: In function ‘usbback_alloc’: /users/stefanos/xen/tools/../tools/include/xen/io/usbif.h:229:56: error: ‘PAGE_SIZE’ undeclared (first use in this function) #define USB_URB_RING_SIZE __CONST_RING_SIZE(usbif_urb, PAGE_SIZE) ^ /users/stefanos/xen/tools/../tools/include/xen/io/ring.h:45:23: note: in definition of macro ‘__RD32’ #define __RD32(_x) (((_x) & 0xffff0000) ? __RD16((_x)>>16)<<16 : __RD16(_x)) ^ /users/stefanos/xen/tools/../tools/include/xen/io/usbif.h:229:27: note: in expansion of macro ‘__CONST_RING_SIZE’ #define USB_URB_RING_SIZE __CONST_RING_SIZE(usbif_urb, PAGE_SIZE) ^ hw/usb/xen-usb.c:1029:51: note: in expansion of macro ‘USB_URB_RING_SIZE’ max_grants = USBIF_MAX_SEGMENTS_PER_REQUEST * USB_URB_RING_SIZE + 2; ^ make: *** [hw/usb/xen-usb.o] Error 1 It is caused by PAGE_SIZE being utilized in xen/include/public/io/usbif.h, but undefined on ARM64 (in userspace). QEMU includes xen/include/public/io/usbif.h directly, therefore hw/usb/xen-usb.c doesn't build. I don't think we should be using "PAGE_SIZE" in public/io/usbif.h, but that file is present in too many Xen releases to ignore now. So I am going to work around the issue in QEMU. --- xen-usb.c does not build on ARM64 because it includes xen/io/usbif.h which uses PAGE_SIZE without defining it. The header file has been shipped with too many Xen releases to be able to solve the problem at the source. This patch define PAGE_SIZE as XC_PAGE_SIZE when undefined. Signed-off-by: Stefano Stabellini diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c index 174d715..ca9df87 100644 --- a/hw/usb/xen-usb.c +++ b/hw/usb/xen-usb.c @@ -34,6 +34,11 @@ #include "qapi/qmp/qstring.h" #include + +/* xen/io/usbif.h references PAGE_SIZE without defining it */ +#ifndef PAGE_SIZE +#define PAGE_SIZE XC_PAGE_SIZE +#endif #include /*