All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: xen-devel@lists.xenproject.org, wei.liu2@citrix.com,
	jgross@suse.com, qemu-devel@nongnu.org,
	anthony.perard@citrix.com, julien.grall@arm.com
Subject: Re: [Qemu-devel] [PATCH] xen-usb.c/usbif.h: fix ARM64 build issue
Date: Wed, 19 Oct 2016 09:50:59 +0100	[thread overview]
Message-ID: <20161019085059.GC2639@citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1610181145470.16441@sstabellini-ThinkPad-X260>

On Tue, Oct 18, 2016 at 12:09:55PM -0700, Stefano Stabellini wrote:
> 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.
> 

Actually it was introduced in 4.7.

> ---
> 
> 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 <sstabellini@kernel.org>
> 
> 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/ring.h>
> +
> +/* xen/io/usbif.h references PAGE_SIZE without defining it */
> +#ifndef PAGE_SIZE
> +#define PAGE_SIZE XC_PAGE_SIZE
> +#endif
>  #include <xen/io/usbif.h>


Can we just change the macro to

  #define USB_CONN_RING_SIZE(pg_size) __CONST_RING_SIZE(usbif_conn, (pg_size)

?

I also found a similar issue in vscsiif.h.

Wei.


>  
>  /*

  parent reply	other threads:[~2016-10-19  8:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-18 19:09 [Qemu-devel] [PATCH] xen-usb.c/usbif.h: fix ARM64 build issue Stefano Stabellini
2016-10-19  8:50 ` Wei Liu
2016-10-19  8:50 ` Wei Liu [this message]
2016-10-19  9:09   ` [Qemu-devel] " Juergen Gross
2016-10-19  9:22     ` Wei Liu
2016-10-19  9:22     ` [Qemu-devel] " Wei Liu
2016-10-19  9:40       ` Juergen Gross
2016-10-19  9:55         ` Wei Liu
2016-10-19 18:07           ` Stefano Stabellini
2016-10-19 18:07             ` Stefano Stabellini
2016-10-19  9:55         ` Wei Liu
2016-10-19  9:40       ` Juergen Gross
2016-10-19  9:09   ` Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161019085059.GC2639@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=jgross@suse.com \
    --cc=julien.grall@arm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.