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: 9382817 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 0018260487 for ; Tue, 18 Oct 2016 19:10:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFD6229720 for ; Tue, 18 Oct 2016 19:10:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D28992972C; Tue, 18 Oct 2016 19:10:24 +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 5B11329720 for ; Tue, 18 Oct 2016 19:10:23 +0000 (UTC) Received: from localhost ([::1]:43383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwZmI-0001TM-MC for patchwork-qemu-devel@patchwork.kernel.org; Tue, 18 Oct 2016 15:10:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwZm0-0001TA-89 for qemu-devel@nongnu.org; Tue, 18 Oct 2016 15:10:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwZlx-0006EQ-1f for qemu-devel@nongnu.org; Tue, 18 Oct 2016 15:10:04 -0400 Received: from mail.kernel.org ([198.145.29.136]:49478) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bwZlw-0006Dr-OK for qemu-devel@nongnu.org; Tue, 18 Oct 2016 15:10:00 -0400 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 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 198.145.29.136 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: [Qemu-devel] [PATCH] xen-usb.c/usbif.h: fix ARM64 build issue 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: jgross@suse.com, sstabellini@kernel.org, wei.liu2@citrix.com, qemu-devel@nongnu.org, julien.grall@arm.com, anthony.perard@citrix.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-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 /*